Only output function from functions.php if conditional tag is true

Move the is_tax() conditional inside the slug_scripts_masonry function. function slug_scripts_masonry() { if ( is_tax() ) { wp_enqueue_script( ‘masonry’ ); wp_enqueue_style( ‘masonry’, get_template_directory_uri().’/css/’ ); } } add_action( ‘wp_enqueue_scripts’, ‘slug_scripts_masonry’ ); Because WordPress has not yet executed the code which determines the result of is_tax() it will return false on all pages.

WordPress keeps showing mobile version on Internet Explorer

When I had this issue it was because I was missing something from the <head>. Below is the head from the basic template on the bootstrap website. <head> <meta charset=”utf-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1″> <!– The above 3 meta tags *must* come first in the head; any other head content must come … Read more

Javascipt issue on custom theme

Do you know about JavaScript dependencies? If some JavaScript depends on another, it must be loaded after the dependencies. In your codepen you are loading JavaScripts in the correct order: jQuery Bootstap (depends on jQuery) Masonry (depends on jQuery) ccd-javsscript (depends on Masonry and jQuery) One the features of WordPress is the dependencies manager for … Read more

Why isn’t wp_enqueue_script(‘jquery-masonry’) working?

jQuery’s Masonry is bundled with WordPress. All you should need is wp_enqueue_script(‘jquery-masonry’); but note that the “slug” is jquery-masonry, not jquery_masonry. And be sure your are enqueueing on the wp_enqueue_scripts hook or later. function enqueue_masonry() { wp_enqueue_script(‘jquery-masonry’); } add_action(‘wp_enqueue_scripts’,’enqueue_masonry’); I’d guess that your problem has something to do with when you register/enqueue because loading core … Read more

Display recent posts with thumbnail within Masonry

Add the meta_key parameter to fetch the latest posts which have featured image set. $args = array( ‘numberposts’ => ’10’, ‘meta_key’ => ‘_thumbnail_id’ ); <?php /* Template Name: Recent Profiles */ get_header(); ?> <h1 class=”page-title”><?php the_title(); ?></h1> <div id=”content”> <div id=”masonry”> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div … Read more