File Manager / wp-content Search Upload New Item Settings File "db5.php" Full path: /home1/epichome/public_html/wp-content/db5.php File size: 60.67 B (60.67 KB bytes) MIME-type: text/x-php Charset: utf-8 Download Open Edit Advanced Editor Back
/* global jQuery, soWidgets, sowbForms */
( function( $ ) {
$( document ).on( 'sowsetupform', '.siteorigin-widget-field-type-posts', function( e ) {
const $postsField = $( this );
const hasCount = $postsField.find( '.sow-current-count' ).length > 0;
if ( ! hasCount ) {
return;
}
$postsField.on( 'change', function( event ) {
var postsValues = sowbForms.getWidgetFormValues( $postsField );
var queryObj = postsValues.hasOwnProperty( 'posts' ) ? postsValues.posts : null;
var query = '';
for ( var key in queryObj ) {
if ( query !== '' ) {
query += '&';
}
query += key + '=' + queryObj[ key ];
}
$.post(
soWidgets.ajaxurl,
{ action: 'sow_get_posts_count', query: query },
function( data ) {
$postsField.find( '.sow-current-count' ).text( data.posts_count );
}
);
} );
} );
} )( jQuery );
