Check if page/post has any anchors that link to an image jpg/gif/png

This method has worked in the past for checking if a shortcode exists on a page. You will have to test it and see if it fires in time to enqueue the javascript> add_filter(‘the_posts’, ‘c3_image_check’); function c3_image_check($posts){ if (empty($posts)) return $posts; $img_found = false; foreach ($posts as $post) { if (stripos($post->post_content, ‘<img src=”https://wordpress.stackexchange.com/questions/53585/)) { $img_found … Read more

Enqueue AWS Script

Try to save jQuery.noConflict(); as jquery-no-conflict.js. Then enqueue everything with proper dependencies: <?php function img_scripts_with_jquery() { wp_enqueue_script( ‘jquery-no-conflict’, ‘path/to/jquery-no-conflict.js’, array( ‘jquery’ ), ‘version’, true ); wp_enqueue_script( ‘aws-cba’, ‘https://images-na.ssl-images-amazon.com/images/G/01/cba/js/common/cba_shared.js’, array( ‘jquery-no-conflict’ ), ‘version’, true ); wp_enqueue_script( ‘aws-merchant-cart’, ‘https://images-na.ssl-images-amazon.com/images/G/01/cba/js/shoppingcart/merchant_cart.js’, array( ‘jquery-no-conflict’ ), ‘version’, true ); } add_action( ‘wp_enqueue_scripts’, ‘img_scripts_with_jquery’ );

Bootstrap js refuses to load

Expanding @RRikesh comment, you might have enqueued/loaded the bootstap.js with same handle theme-js. So only one script gets enqueued. Try to use different handle for example nav-sidebar. See the following code. Also it’s recommended to use prefix, here I used wpse. Also use get_template_directory_uri instead of get_stylesheet_directory_uri() if it’s not a child theme. function wpse_sidebar … Read more

wp_enqueue_script fails to include in footer

Use the approach below to enqueue your scripts using a single action hook: /** * Proper way to enqueue scripts. * The same approach can be used to enqueue styles. */ function my_interface_enqueues() { wp_enqueue_script( ‘require-js’, plugin_dir_url( __FILE__ ) . ‘js/libs/requirejs/require.js’, array(), ‘1.0.0’, true ); wp_enqueue_script( ‘main-js’, plugin_dir_url( __FILE__ ) . ‘js/main.js’, array(), ‘1.0.0’, true … Read more

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