Home › Forums › Lite Version › Add WP masonry in single.php page
- This topic has 1 reply, 1 voice, and was last updated 3 years, 9 months ago by
Masonry Guy.
- AuthorPosts
Olivier
GuestHi,
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
Masonry Guy
KeymasterHi 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
- AuthorPosts