Ajax Request with jQuery not happening

I solved my problem after a long time struggling, that’s why I think I should list some tips for someone with a problem like this: If you change your javascript file, use ctrl+f5 to force reload the page and the resources. The caching almost got me crazy as I changed the file and the changes … Read more

Generating embed code for users to share

Try following code. This will display embed code in the bottom of the page. <?php add_filter(‘the_content’,’my_custom_embed_code’); function my_custom_embed_code( $content ){ global $post; if ( ‘page’ == $post->post_type ) { $embed_code=””; $page_url = esc_url( get_permalink($post->ID ) ) ; $embed_code .= ‘<object data=”https://wordpress.stackexchange.com/questions/160604/.$page_url.” width=”100%” height=”500″><embed src=”https://wordpress.stackexchange.com/questions/160604/.$page_url.” width=”100%” height=”500″></embed> Error: Embedded data could not be displayed. Visit <a … Read more

Script work on non logged in user but not work for logged in user?

i finally know why this code not work. as menstioned by Jorn Lund in the comment that jQuery(document).ready() will fail when script loaded async ( i still dont know is my code load async) but with in mind i change from jQuery(document).ready() to self execution function (function($){ alert(“hello”); })(jQuery); and the code work very well … Read more

Loop through arguments of a function

wp_enqueue_script states the parameters type respectively as string – string – array – string – boolean. As you pass an array as the second parameter, the error occurs. Now, comparing your $array data, you can handle it extracting the array or using array key/value. – public function loadScripts() { $themeScripts = iarray( ‘custom’ => array( … Read more

jQuery + more won’t load in header

WordPress’s wp_register_script has an $in_footer parameter which allows you to state if the script should be written to wp_head or wp_footer. By default the value is false (don’t show in footer), but you could try it yourself. Replace your wp_register_script with this: wp_register_script( ‘jquery’, ‘//ajax.googleapis.com/ajax/libs/jquery/’. $jquery_ver .’/jquery.min.js’, ”, ”, false );

custom template – override plugin template in child theme – issue with scripts

Please Provide Proper path to enqueue scripts and styles Example- function theme_name_scripts() { wp_enqueue_style( ‘style-name’, get_stylesheet_uri() ); wp_enqueue_script( ‘script-name’, get_template_directory_uri() . ‘/js/example.js’, array(), ‘1.0.0’, true ); } add_action( ‘wp_enqueue_scripts’, ‘theme_name_scripts’ ); then it will work fine

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)