Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #396111

    Hi there,

    I am using the Magazine Content Element to list blog posts – It displays blog title with the date above but I would also like to display the post category(s) after the date. This is how all the other listings appear eg on single post page and the Blog Post Content Element. For consistency shouldn’t the magazine list also display the category or tag chosen? This is crucial information to the user for identifying content relevance.

    Can you help?

    I have seen how to add excerpt and Read More to magazine element but not how to add category to the meta list.

    Thanks in advance.

    #396118

    I do understand now how the magazine layout is designed to work – using the tabs for sorting categories – and therefore there would be no need to list category above the post title. However I was going to use the magazine layout without tabs because I have 20 – 30 categories and so it would be too many to use the tabs and list all the options for sorting.

    It would therefore still be useful to be able to have the category listed after the date above the post title to identify the information without having to list all categories as tabs.

    Hope that makes sense?

    #396543
    #396662

    Hi Josue,

    Thanks for your help but I don’t want to add a specific piece of text (eg MEMBERS ONLY) – I would like to automatically display the relevant category of the listed post.

    So…

    Post title
    Date / Category
    underline

    for each post in the magazine list

    #396788

    Hi!

    OK, ignore the CSS part, just make that part of the magazine.php code like this:

    			$magazine_category = get_the_category($entry->ID);
    			$output .= 		"<div class='av-magazine-content-wrap'>";
    			$output .=		"<header class='entry-content-header'>";
    			$output .=			"<time class='av-magazine-time updated' {$markupTime}>".$time."</time>";
    			$output .=			$separator.$author_output." / ".$magazine_category[0]->name;
    			$output .=			"<{$titleTag} class='av-magazine-title entry-title' {$markupTitle}>{$title}</{$titleTag}>";
    			$output .= 		"</header>";
    if($excerpt)$output .=		"<div class='av-magazine-content entry-content' {$markupContent}>{$excerpt}</div>";
    			$output .= 		"</div>";
    			$output .= 		"<footer class='entry-footer'></footer>";
    			$output .= "</article>";
    

    Regards,
    Josue

    #1082031

    What’s the best way to make the Category as a link to its archive page?

    And will this code loop and display multiple categories?

    • This reply was modified 5 years, 5 months ago by dhfairbairn.
    #1083907

    Hi,

    The modification above will only display the first category of the post. If you want it to link to the category archive page, use the available snippet from the docs.

    // https://developer.wordpress.org/reference/functions/get_the_category/#user-contributed-notes

    Best regards,
    Ismael

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