Tagged: 

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #779236

    Hi there,
    I’ve tried adding the following code to my functions.php to display the category in the masonry blog posts but it isn’t showing up.

    add_filter( 'avf_masonry_loop_prepare', 'avf_masonry_loop_prepare_mod', 10, 2 );
    function avf_masonry_loop_prepare_mod( $key, $entries )
    {              
    	$class = preg_grep('/category/', $key['class']); 
        $getstr = str_replace('category-', '', implode(',', $class)); 
    	$categories = explode(',', $getstr);
    	$cat = implode(',', array_map('ucfirst', $categories));	
    	foreach ( $key as $post => $value ) {
    			if ( $post == 'content' ) { $value .= "<div class='av-masonry-categories'>".$cat."</div>"; }
    			$key[$post] = $value;
    	}
       

    Thank you

    #779390

    Hey 3mil-pedro,

    Could you please give us a link to your website and a page where you’re trying to do this, we need more context to be able to help you.

    Best regards,
    Victoria

    #779462

    Hi Victoria,

    Sure – posted below.

    Thank you

    #779888

    Hi 3mil-pedro,

    Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look.

    Best regards,
    Victoria

    #779983

    Hi Victoria,
    Absolutely, please find the details below.

    #780519

    Hi,

    The credentials did not work. Please update them.

    Best regards,
    Victoria

    #780549

    Hi Victoria,
    Thanks – can you try now?

    Thank you

    #782206

    Hi guys,

    Any suggestions on this?

    Thank you

    #782667

    Hi,

    I’m sorry for the late response. Please use the suggested filter in the following thread instead.

    // https://kriesi.at/support/topic/4-0-2-masonry-no-longer-display-the-right-category/#post-763505

    Best regards,
    Ismael

    #791634

    Hi Ismael,

    Thank you – this works great, it doesn’t appear to get the category for the portfolio items though.

    #792217

    Hi 3mil-pedro,

    It does not work for portfolio, because portfolio class looks like this “av-masonry-entry isotope-item post-8460 portfolio type-portfolio status-publish has-post-thumbnail hentry portfolio_entries-charity portfolio_entries-client-stories portfolio_entries-healthcare all_sort charity_sort client-stories_sort healthcare_sort av-masonry-item-with-image av-masonry-item-loaded”. So you have to add to this function the case for portfolio_entries-.

    If you need further assistance please let us know.
    Best regards,
    Victoria

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.