PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.4.1
Post Views Counter v1.4.1
1.7.13 1.7.12 1.7.11 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.2 1.3.2.1 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.7.0 1.7.1 1.7.10 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9
post-views-counter / js / admin-quick-edit.js
post-views-counter / js Last commit date
admin-dashboard.js 2 years ago admin-post.js 5 years ago admin-quick-edit.js 5 years ago admin-settings.js 2 years ago admin-widgets.js 5 years ago block-editor.min.js 2 years ago counter.js 2 years ago counter.min.js 2 years ago frontend.js 2 years ago frontend.min.js 2 years ago
admin-quick-edit.js
62 lines
1 ( function( $ ) {
2
3 // we create a copy of the WP inline edit post function
4 var $wp_inline_edit = inlineEditPost.edit;
5
6 // and then we overwrite the function with our own code
7 inlineEditPost.edit = function( id ) {
8 // call the original WP edit function, we don't want to leave WordPress hanging
9 $wp_inline_edit.apply( this, arguments );
10
11 // get the post ID
12 var $post_id = 0;
13
14 if ( typeof ( id ) == 'object' )
15 $post_id = parseInt( this.getId( id ) );
16
17 if ( $post_id > 0 ) {
18 // define the edit row
19 var $edit_row = $( '#edit-' + $post_id ),
20 $post_row = $( '#post-' + $post_id );
21
22 // get the data
23 var $post_views = $( '.column-post_views', $post_row ).text();
24
25 // populate the data
26 $( ':input[name="post_views"]', $edit_row ).val( $post_views );
27 $( ':input[name="current_post_views"]', $edit_row ).val( $post_views );
28 }
29
30 return false;
31 };
32
33 $( document ).on( 'click', '#bulk_edit', function() {
34 // define the bulk edit row
35 var $bulk_row = $( '#bulk-edit' );
36
37 // get the selected post ids that are being edited
38 var $post_ids = new Array();
39
40 $bulk_row.find( '#bulk-titles' ).children().each( function() {
41 $post_ids.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) );
42 } );
43
44 // get the data
45 var $post_views = $bulk_row.find( 'input[name="post_views"]' ).val();
46
47 // save the data
48 $.ajax( {
49 url: ajaxurl, // this is a variable that WordPress has already defined for us
50 type: 'post',
51 async: false,
52 cache: false,
53 data: {
54 action: 'save_bulk_post_views', // this is the name of our WP AJAX function that we'll set up next
55 post_ids: $post_ids, // and these are the 2 parameters we're passing to our function
56 post_views: $post_views,
57 current_post_views: $post_views,
58 }
59 } );
60 } );
61
62 } )( jQuery );