Topic: Add WP masonry in single.php page | WP Masonry Layout

Add WP masonry in single.php page

Home Forums Lite Version Add WP masonry in single.php page

This topic contains 1 reply, has 2 voices, and was last updated by  Masonry Guy 1 week, 2 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #17911 Reply

    Olivier

    Hi,

    Trying to add the shortcode for post linked to a specific category.

    I’ve changed the single.php file as below:

    <?php 
    	if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    	get_header();
    
    	$post_type = get_post_type();
    	$sidebarPosition = get_option ( THEME_NAME."_sidebar_position" ); 
    	$sidebarPositionCustom = get_post_meta ( $post->ID, THEME_NAME."_sidebar_position", true ); 
    
    	$categories = get_the_category();
    	//var_dump($categories);
    
    	foreach ($categories as $category) {
            	//var_dump($category);
    		//echo $category->cat_ID;  
    		//echo $category->cat_name; 
    		if ($category->cat_name == 'Picks') {
    			//echo($category->cat_name);
    			echo do_shortcode('[wmls name="picks_of_the_week" id="1"]');
    		} else {
    			if($post_type == OT_POST_GALLERY) {
    				get_template_part(THEME_INCLUDES.'gallery-single','style-1');
    			} else if($post_type == OT_POST_PORTFOLIO) {
    				get_template_part(THEME_INCLUDES.'portfolio-single');
    				get_footer();
    			} else {
    				get_template_part(THEME_INCLUDES.'news','single');
    				get_footer();
    			}
        		}
    	}
    
    ?>

    But when accessing my post nothing is displayed and I have in the developer console the following error:

    wmljs.js?ver=4.7.5:5 Uncaught TypeError: $container.imagesLoaded is not a function
    at HTMLDocument.<anonymous> (wmljs.js?ver=4.7.5:5)
    at i (jquery.js?ver=1.12.4:2)
    at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
    at Function.ready (jquery.js?ver=1.12.4:2)
    at HTMLDocument.K (jquery.js?ver=1.12.4:2)

    Any idea why?

    Thank you

    #17913 Reply

    Masonry Guy
    Keymaster

    Hi Olivier,

    Seems like js issue there rather than issue in your customization. Can you confirm the shortcode works in your theme ? I think there is some js conflict in your installation.

    Thanks

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Add WP masonry in single.php page
Your information: