Wordpress: Style Post_Format loop-single.php using

2019-08-12 19:46发布

I pretty much just want to remove the post metadata from the Gallery Posts.

Here is my index.php//

<?php get_header(); ?>
  <div id="right-content">
     <?php get_template_part( 'loop', get_post_format() ); ?>
  </div>

<div id="left-content">
  <div class="inner"> 
  <?php get_sidebar(); ?>
  </div> 
</div> 

Here is my single.php//

<?php get_header(); ?>
<div id="main-content">     
<?php get_template_part( 'loop', 'single' ); ?>
</div>

<div class="clear"></div>
<?php get_footer(); ?>

What I don't understand is how to set up the loop or loop-single files in order to get separate templates for the standard and gallery single posts.

I have added a loop and loop-single.php file.

Here are pastebins of those files//

http://pastebin.com/9xSZKnJA - loop.php

http://pastebin.com/WiXwKf7d - loop-single.php

EDIT//

Here are the new "single-gallery.php" and "loop-gallery.php" files inside this pastebin// http://pastebin.com/YukyZ9hm

1条回答
欢心
2楼-- · 2019-08-12 20:29

If you want to use a different template for different types, you will need to create a template for each post type. Assuming that you are using the gallery type, you would want to copy the contents of single.php to a file called single-gallery.php and change the loop template part to be get_template_part( 'loop', 'gallery' );. You would then copy loop-single.php to a file called loop-gallery.php and modify its contents as desired.

You can find more info on theme development here http://codex.wordpress.org/Theme_Development

查看更多
登录 后发表回答