Can’t access data from database using AJAX

Pass data as an argument in done(function(data) funtion. <script> jQuery.ajax({ type:”POST”, url: my_ajax_object.ajax_url, data: { ‘action’: ‘call_my_ajax_handler’ } }).done(function(data) { console.log(data); });

Load css classes after using ajax calls

Styles won’t be affected if you use different selectors. Create a custom stylesheet, and enqueue it immediatelly. When the page is ready just apply the styles to the mentioned responsive div, or create some logic behind it. So for example if you have <div class=”custom-sidebar”>Some content</div> Enqueue custom style within functions.php wp_enqueue_style( ‘some-custom-styles’, get_stylesheet_uri() . … Read more

why my “recepie” category is not taken into account in my request

This explicit code is missing from your example and you should verify that you have at least these statements (plus any additional post tag functions, or analogous calls to “the_content()”) included exactly as this in your original code: while ( $the_query->have_posts() ) : $the_query->the_post(); the_content(); endwhile; This should roughly be at the location noted by … Read more

JQuery WordPress gallery [closed]

Of course it’s possible. Galleria is a jQuery plugin that is similar, but better (fancy slide transition effects and more). You could include it yourself (see their documentation) or if you prefer WordPress plugins look at Photo Gallery which seems like it’s based on galleria (haven’t tried it). Another really popular gallery plugin is the … Read more

Can’t get jQuery to enqueue into post edit script

Use the admin_enqueue_scripts hook to add your own custom script. Put it in an external file, and use wp_localize_script to pass any data from php to javascript. jQuery is already used on the admin side, adding a script tag sourcing it from google will break things. function wpa80418_admin_enqueue( $hook ) { if( ‘post.php’ != $hook … Read more

Shortcode return is printing a 1 afterward

You are returning the result of calling include. You want to grab the output of the included file and return than instead. Use output buffering to do that. function build_total_search_method( $atts ) { ob_start(); include( dirname(__FILE__) . “/includes/total_search.php” ); $shorcode_php_function = ob_get_clean(); return $shorcode_php_function; } add_shortcode( ‘total_search’, ‘build_total_search_method’ );

Hook with jquery script is not working in wp-admin [closed]

The blank page is a PHP fatal error. You need to either escape the single quotes or change them to double quotes. $(e.target).prop(‘checked’, false); -> $(e.target).prop(“checked”, false); You can enable debugging in WordPress to see the PHP errors by setting WP_DEBUG to true in you wp-config.php file. You can also look in your server/PHP error … Read more