PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.5.0
Post Views Counter v1.5.0
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 1 year ago admin-post.js 5 years ago admin-quick-edit.js 1 year ago admin-settings.js 1 year ago admin-widgets.js 5 years ago block-editor.min.js 1 year ago counter.js 1 year ago counter.min.js 1 year ago dummy.js 1 year ago frontend.js 1 year ago frontend.min.js 1 year ago
admin-quick-edit.js
73 lines
1 ( function( $ ) {
2
3 // ready event
4 $( function() {
5 // we create a copy of the WP inline edit post function
6 var wpInlineEdit = inlineEditPost.edit;
7
8 // and then we overwrite the function with our own code
9 inlineEditPost.edit = function( id ) {
10 // call the original WP edit function, we don't want to leave WordPress hanging
11 wpInlineEdit.apply( this, arguments );
12
13 // get the post ID
14 var postId = 0;
15
16 if ( typeof ( id ) == 'object' )
17 postId = parseInt( this.getId( id ) );
18
19 if ( postId > 0 ) {
20 // define the edit row
21 var editRow = $( '#edit-' + postId );
22 var postRow = $( '#post-' + postId );
23
24 // get the data
25 var postViews = $( '.column-post_views', postRow ).text();
26
27 // populate the data
28 $( ':input[name="post_views"]', editRow ).val( postViews );
29 $( ':input[name="current_post_views"]', editRow ).val( postViews );
30 }
31
32 return false;
33 };
34
35 $( document ).on( 'click', '#bulk_edit', function() {
36 // define the bulk edit row
37 var bulkRow = $( '#bulk-edit' );
38
39 // get the selected post ids that are being edited
40 var postIds = [];
41
42 // at least wp 5.9?
43 if ( pvcArgsQuickEdit.wpVersion59 ) {
44 bulkRow.find( '#bulk-titles-list' ).children( '.ntdelitem' ).each( function() {
45 postIds.push( $( this ).find( 'button' ).attr( 'id' ).replace( /[^0-9]/i, '' ) );
46 } );
47 } else {
48 bulkRow.find( '#bulk-titles' ).children().each( function() {
49 postIds.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) );
50 } );
51 }
52
53 // get the data
54 var postViews = bulkRow.find( 'input[name="post_views"]' ).val();
55
56 // save the data
57 $.ajax( {
58 url: ajaxurl, // this is a variable that WordPress has already defined for us
59 type: 'post',
60 async: false,
61 cache: false,
62 data: {
63 action: 'save_bulk_post_views', // this is the name of our WP AJAX function that we'll set up next
64 post_ids: postIds, // and these are the 2 parameters we're passing to our function
65 post_views: postViews,
66 current_post_views: postViews,
67 nonce: pvcArgsQuickEdit.nonce
68 }
69 } );
70 } );
71 } );
72
73 } )( jQuery );