WORDPRESS: How to remove certain content on single post page of post_format gallery?

First off I created my own theme from scratch. I’ve been trying to figure this out all day yesterday. Ended up using a couple of twentyelevens and twentyten’s files just to accomplish this. Then deleted them cause there was no success. All I want to do is remove certain text such as “Filed Under” and “Posted By” that appears at the bottom of my single posts page. I want the Standard Single Posts Page to have the Meta Data, while the Gallery Single Posts Page doesn’t have Meta Data.

I tried to use the loop.php, loop-single.php, loop-gallery.php, content.php method but nothing was working for me. Where can I start to get these two different post formats to display differently on their single pages?
Is there anything I need to add to my functions.php file just to make this work?
Do I need to recreate the loop files?
Please help…

Related posts

Leave a Reply

1 comment

  1. If ‘gallery’ is a category, you could edit your single.php template and use is_category():

    <?php if ( in_category('gallery') ) : ?>
        <!-- Single post style for gallery posts -->
    <?php else: ?>
        <!-- Normal single post style -->
    <?php endif; ?>
    

    If it’s a custom post type, you could use get_post_type() in single.php and use its result in a condition, e.g.

    <?php 
    $post_type = get_post_type( $post->ID ); 
    
    if ( $post_type == 'gallery' ): ?>
        <!-- Single post style for gallery posts -->
    <?php else: ?>
        <!-- Normal single post style -->
    <?php endif; ?>
    

    If it’s a post format, use get_post_format(), e.g.

    <?php 
    $post_format = get_post_format( $post->ID ); 
    
    if ( $post_format == 'gallery' ): ?>
        <!-- Single post style for gallery posts -->
    <?php else: ?>
        <!-- Normal single post style -->
    <?php endif; ?>