Genesis Tip — How To Remove Post Info From A Specific Or Custom Post Type

Time and again we come across unique requirements from clients. Like, sometimes a client wants to hide date, time and admin link from specific or a custom post types. If you are using Genesis, you can use the Genesis filter ‘genesis_post_info’ to remove or hide Post Info.

To hide or remove post-info from the desired post you can place the following code in functions.php:

function custom_post_info($post_info)
	{
	global $post;
	if(get_post_type($post->ID) == 'post_type_name' )
		{
		return false;
		}
	else 
		{
		return $post_info; 
		}
	}
add_filter('genesis_post_info', 'custom_post_info '); 

In the above code you just need to replace ‘post_type_name’ with your post type. That’s all for hiding date, time and admin link.

Posted In:

UX UI Front-end Development, Code Snippets, Genesis WordPress Theme Framework Child-Theme

13 Comments

  1. Just gave this a try and it removes the post info from both the CPT as well as normal blog posts. Is there something missing?

    Reply
  2. thanks alot im looking for this only u provide nice information for me…..

    Reply
  3. I gave it a try and it simply removed the post info everywhere as if I had done, remove_action(‘genesis_before_post_content’, ‘genesis_post_info’);

    What am I missing?

    Thanks!

    Reply
    1. That’s what it does: removes it from a custom or specific “post type”. If you just want to remove from a particular post than filter it through a conditional with that specific post ID.

      Reply
  4. I thought I had. I’m having a problem where when I use WP ecommerce it shows the post info when in theory it shouldn’t. I thought that maybe applying a filter like this might solve the problem. Maybe I will have to remove the post info and find another way of displaying the post info for blog posts only.

    Any ideas would be great.

    Thanks.

    Reply
  5. The problem I have is with WP e-commerce and with another plugin where post info gets shown. I’ve tested with another theme and the problem disappears. When I change back to Genesis it comes back. The other plugin I’ve confirmed it’s calling on single.php so that’s a separate issue I have to figure out but WP ecommerce is using the correct template.

    Maybe I’m not using the right custom post type when I tried your code. Did I understand correctly that what you put in ‘post_type_name’ is the type you want not to show post info or is it the other way around? My brain gets pretty muddled by the time Friday comes around.

    Is it doable with this code or is there a way of adding a similar code into a plugin such as WP ecommerce which could filter out the post info?

    Thanks.

    Reply
  6. Rob: To check if you are applying to the correct post type is to use this code. And then navigate to the URL whose post type you want to verify (provided it is still running on WordPress).

    function show_post_type()
    	{
    	global $post;
    	echo get_post_type();
     
    	}
    add_action('wp_footer','show_post_type');
    
    Reply
  7. Thanks. I will try it out this weekend and let you know. Fingers crossed!

    Reply
  8. I had the right post type, which was wpsc-product, and I put it in place of ‘post_type_name’. It still took out the post info everywhere. I’m stumped…

    Reply
  9. Hi, Can you please tell me how to remove ‘Post Info’ from specific category pages or tags? Thanks in advance.

    Reply

Comment on Genesis Tip — How To Remove Post Info From A Specific Or Custom Post Type

Your email address will not be published. Required fields are marked *