Lego2012
2/2/2017 - 10:43 AM

Remove Date from Posts in Particular Category

Remove Date from Posts in Particular Category

<?php
// Do NOT include the opening php tag

// You may want to remove date from all category but except few. In that case use the following code.

// Customize the entry meta in the entry header
add_filter( 'genesis_post_info', 'post_info_filter' );
function post_info_filter($post_info) {
  if( !in_category( array('cat-1','cat-2') )) {
  		$post_info = 'Posted by [post_author_posts_link] [post_comments] [post_edit]';
	}
	else {
		$post_info = '[post_date] by [post_author]  [post_comments] [post_edit]';
	}
  return $post_info;
}

// Above code removes date from all the categories except the posts in category mentioned. This is a inverse function of first code.
<?php
// Do NOT include the opening php tag

// Paste the following code at the end of your Genesis Child Theme’s functions.php

// Customize the entry meta in the entry header
add_filter( 'genesis_post_info', 'post_info_filter' );
function post_info_filter($post_info) {
  if( in_category( array('cat-1','cat-2') )) {
  		$post_info = 'Posted by [post_author_posts_link] [post_comments] [post_edit]';
	}
	else {
		$post_info = '[post_date] by [post_author]  [post_comments] [post_edit]';
	}
  return $post_info;
}

// In above code change cat-1 and cat-2 with the category id’s you found previously.
// The above code excludes date and outputs author name with link and comments count for posts inside categories mentioned.