1

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...

KXXT
  • 251
  • 2
  • 4
  • 20
  • This could be an option: http://wordpress.org/extend/plugins/custom-post-template/ –  Oct 31 '12 at 17:48
  • @Jrod Yes I tried it with gallery.php but ended up deleting it. What are all the files I need im order to get this working? Here is my other post someone tried to help me but nothing worked...http://stackoverflow.com/questions/13151068/wordpress-style-post-format-loop-single-php-using-get-template-part – KXXT Oct 31 '12 at 23:11
  • @keihead it is hard to say exactly what files you need or perhaps don't need. Wordpress works on a hierarchy. For example when a gallery post is needed to be displayed wordpress will first look for gallery.php then single.php and failing both of those it will serve index.php. If you could provide a link to your project that would be helpful in trying to figure out which template is being served and then going into that file to remove the meta data. – Jared Nov 01 '12 at 13:10
  • Because it was incorrect. I misinterpreted the post formats. – Jared Nov 01 '12 at 19:51

1 Answers1

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; ?>
stealthyninja
  • 10,343
  • 11
  • 51
  • 59
  • @keihead -- No; for that you can use `get_post_format()` instead of `get_post_type()`. See my updated answer. – stealthyninja Nov 01 '12 at 09:57
  • @keihead -- What does your `single.php` currently look like? – stealthyninja Nov 01 '12 at 14:42
  • I did not try this method yet. I accidentally pressed the button without testing first. Would really appreciate the help if this method does not work. – KXXT Nov 01 '12 at 16:46
  • @keihead -- Try this updated version of your `single.php`: http://pastebin.com/mxweTHYE – stealthyninja Nov 01 '12 at 17:40
  • May I ask what the updated single.php does? Do you mind explaining the new code? – KXXT Nov 01 '12 at 17:44
  • @keihead -- What it does is integrate the third solution from my answer with your `single.php` template. Use it and it should accomplish what you're trying to do. – stealthyninja Nov 01 '12 at 18:56
  • Am I suppose to insert code where the notes are placed? Like the title of the post? – KXXT Nov 01 '12 at 20:02
  • Will this give me the option to REMOVE meta data from single gallery posts? – KXXT Nov 01 '12 at 21:29
  • Trying to figure out how this code will help me remove meta data from gallery format single posts? @stealthyninja – KXXT Nov 02 '12 at 04:03
  • @keihead -- Replace your `single.php` with the one I made for you. Test it. When it works, you'll have your answer. – stealthyninja Nov 02 '12 at 06:27