PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.3
Post Views Counter v1.3
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 6 years ago admin-post.js 6 years ago admin-quick-edit.js 6 years ago admin-settings.js 6 years ago admin-widgets.js 6 years ago chart.min.js 6 years ago frontend.js 6 years ago gutenberg.min.js 6 years ago
admin-quick-edit.js
65 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 console.log( 'edit' );
9 // call the original WP edit function
10 // we don't want to leave WordPress hanging
11 $wp_inline_edit.apply( this, arguments );
12
13 // get the post ID
14 var $post_id = 0;
15
16 if ( typeof ( id ) == 'object' )
17 $post_id = parseInt( this.getId( id ) );
18
19 if ( $post_id > 0 ) {
20 // define the edit row
21 var $edit_row = $( '#edit-' + $post_id ),
22 $post_row = $( '#post-' + $post_id );
23
24 // get the data
25 var $post_views = $( '.column-post_views', $post_row ).text();
26
27 // populate the data
28 $( ':input[name="post_views"]', $edit_row ).val( $post_views );
29 $( ':input[name="current_post_views"]', $edit_row ).val( $post_views );
30 }
31
32 return false;
33 };
34
35 $( document ).on( 'click', '#bulk_edit', function() {
36 console.log( 'bulk edit' );
37 // define the bulk edit row
38 var $bulk_row = $( '#bulk-edit' );
39
40 // get the selected post ids that are being edited
41 var $post_ids = new Array();
42
43 $bulk_row.find( '#bulk-titles' ).children().each( function() {
44 $post_ids.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) );
45 } );
46
47 // get the data
48 var $post_views = $bulk_row.find( 'input[name="post_views"]' ).val();
49
50 // save the data
51 $.ajax( {
52 url: ajaxurl, // this is a variable that WordPress has already defined for us
53 type: 'post',
54 async: false,
55 cache: false,
56 data: {
57 action: 'save_bulk_post_views', // this is the name of our WP AJAX function that we'll set up next
58 post_ids: $post_ids, // and these are the 2 parameters we're passing to our function
59 post_views: $post_views,
60 current_post_views: $post_views,
61 }
62 } );
63 } );
64
65 } )( jQuery );