javascript not loading in wordpress
Problem was a simple misspelling. The add_action should be add_action (‘wp_enqueue_scripts’, ‘theme_add_cycle_slide’ ); I wrote ‘script’
Problem was a simple misspelling. The add_action should be add_action (‘wp_enqueue_scripts’, ‘theme_add_cycle_slide’ ); I wrote ‘script’
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); });
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
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
Replace the wp-admin and wp-include folders only with fresh copies from a zip of WordPress, matching version of course. Sounds like a corrupt or missing file in one of the above folders. Alternatively, if the above doesn’t help, switch themes(only temporarily) to determine if the problem is theme related.
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
you should place your Javascript files in a subfolder of your theme rather than adding folders to the base structure of WP.
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
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’ );
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