Jump to content


Photo

Remove Meta Data From 1 Category

meta data category date author

  • Please log in to reply
1 reply to this topic

#1 jen5mcfarland

jen5mcfarland

    Newbie

  • MD Customer
  • Pip
  • 2 posts

Posted 18 December 2017 - 07:58 AM

I've created a post category called "case studies" to showcase some of my work.

 

I used php to exclude the category from my regular blog posts and used menus to display it.

 

For the "case studies" post category I don't want to display the meta data (date, author). I've played around with it for a while (using CSS) but I can't get it to hide the meta data for this one category. 

 

Thanks for any help you can provide. 



#2 Alex

Alex

    Kolakube Staff

  • Kolakube Admin
  • 3,484 posts

Posted 20 December 2017 - 03:52 PM

Hey Jen! Thanks for your patience with my response.

 

You can use this function in your MD child theme to remove the byline from posts only in X category:

function md_child_theme_template_redirect() {

	// remove byline from any posts in Case Study category

	if ( in_category( 'case-studies' ) )
		remove_action( 'md_hook_before_headline', 'md_byline' );

}

add_filter( 'template_redirect', 'md_child_theme_template_redirect' );

In the condition "in_category()" you need to use the slug of the category page to target the right category. You can go to WP Admin > Posts > Categories and look in the "Slug" field to find the matching category.

 

Let me know if this works for you!


- Alex
Check out the Kolakube blog or follow me on Twitter.





Also tagged with one or more of these keywords: meta data, category, date, author

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users