Remove Metro Post Meta On Custom Post Types?

Community Forums Forums Design Tips and Tricks Remove Metro Post Meta On Custom Post Types?

This topic is: not resolved

This topic contains 6 replies, has 2 voices, and was last updated by  Metro 1 year, 2 months ago.

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

    Metro
    Participant
    Post count: 24

    Hi folks, I’ve searched every where for an answer to this but no luck.

    Does anyone have any ideas on how to remove the post meta (author, date) on custom post types while leaving them intact for normal posts?

    We’re using the Metro theme on a site currently in development.

    Thanks in advance for any help/insight anyone can offer.

    • This topic was modified 1 year, 2 months ago by  Metro.
    • This topic was modified 1 year, 2 months ago by  Metro.
    • This topic was modified 1 year, 2 months ago by  Metro.
    • This topic was modified 1 year, 2 months ago by  Metro.
    #40471

    braddalton
    Participant
    Post count: 8880

    The post meta is the category and tagged with.

    The post info is the author, date etc.

    Which one do you want to remove?


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #40482

    Metro
    Participant
    Post count: 24

    Oops, my mistake, I want to remove the post info (author, date, etc) only on custom post types.

    #40488

    braddalton
    Participant
    Post count: 8880

    Try the last code snippet in this block. I couldn’t test it (but i will) but there are NO errors.

    You’ll need to remove the shortcodes for the post info you want to remove.

    Code not displaying? Grab it on Github.

    Otherwise, you’ll find a link in the above code to a tutorial which includes CSS code to hide post info. You could use the portfolio page template name which you can grab from your source code, in the CSS code to target only posts using the portfolio custom post type.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #40516

    Metro
    Participant
    Post count: 24

    Thanks for the code brad. I gave all three snippets a try replacing the ‘portfolio’ with our ‘locations’ custom post type, however it removed the post info site wide, including on normal blog posts.

     

    Here’s an example of what I tried (hope it formats correctly):

    // 3. Replace portfolio with the name of the custom post type name
    
    add_filter( 'genesis_post_info', 'remove_post_info_locations_posts' );
    function remove_post_info_locations_posts($post_info) {
    if ( 'locations' == get_post_type() )  {
    	$post_info = '[post_date]';
    	return $post_info;
    }
       }
    
    ---
    
    If you have any suggestions that would be great, otherwise I'll continue playing around with the above and the css option (which I could't get to work either).
    
    Thanks again
    #40520

    braddalton
    Participant
    Post count: 8880

    Try CSS:

    You could use the body class for the custom post type (view the source code to grab this) as your selector with this CSS code.

    I haven’t tested the PHP yet because I need to replicate a custom post type which I need to create first and then I will update the Gist with code that works. I have marked the PHP code as untested for the moment and should work out the solution within the next day or two.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #40598

    Metro
    Participant
    Post count: 24

    Thanks brad, the CSS worked a treat.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.