Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1475290

    Hi,

    can ich add “blog-categories minor-meta” to the Masonry Blog layout somehow? Like you can see it in all the Author Blog layouts. (https://kriesi.at/themes/enfold/blog/blog-single-author-big/)

    • This topic was modified 1 month ago by FW.
    • This topic was modified 1 month ago by FW.
    #1475399

    Hey FW,

    Thank you for the inquiry.

    You can add the following filter to the functions.php file to display the date, author, and categories, but please note that they will not be accessible or will not be displayed as links.

    add_filter( 'avf_masonry_loop_prepare', 'avf_masonry_loop_prepare_mod_cat', 10, 2 );
    
    function avf_masonry_loop_prepare_mod_cat( $key, $entries ) {
        $categories = get_the_category($key['ID']);
        $separator = ' ';
        $output = '
        <div class="masonry-cat">';
        
        if ( ! empty( $categories ) ) {
            foreach( $categories as $category ) {
                $output .= '<span alt="' . esc_attr( sprintf( __( 'View all posts in %s', 'textdomain' ), $category->name ) ) . '">' . esc_html( $category->name ) . '</span>' . $separator;
            }
        }
        $output .= '</div>';
    
        $post_date = get_the_date( '', $key['ID'] );
        $output .= '<div class="masonry-date">' . $post_date . '</div>';
    
        $author_id = $key['post_author'];
        $author_name = get_the_author_meta( 'display_name', $author_id );
        $output .= '<div class="masonry-author">' . $author_name . '</div>';
    
        $key['text_after'] .= trim( $output, $separator );
    
        return $key;
    }
    

    Best regards,
    Ismael

    #1475967

    Thanks, exactly what i was looking for!

    #1475972

    Hi,

    Great, I’m glad that Ismael could help you out. Please let us know if you should need any further help on the topic, or if we can close it.

    Best regards,
    Rikard

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