WordPress的:样式Post_Format loop-single.php使用get_template_part? [英] Wordpress: Style Post_Format loop-single.php using get_template_part?
问题描述
这里是我的index.php //
p> <?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>
这是我的single.php // <
<?php get_header(); ?>
< div id =main-content>
<?php get_template_part('loop','single'); ?>
< / div>
< div class =clear>< / div>
<?php get_footer(); ?>
我不明白如何设置循环或循环单个文件为标准和图库单个职位获取单独的模板。
我添加了一个循环和循环single.php文件。
以下是这些文件的pastebins //
http://pastebin.com/9xSZKnJA - loop.php
http://pastebin.com/WiXwKf7d - loop-single.php
编辑// <
这个新的single-gallery.php和loop-gallery.php文件在这个pastebin里面//
http://pastebin.com/YukyZ9hm 解决方案 div> 如果你想为不同的类型使用不同的模板,你将需要为每个帖子类型创建一个模板。假设您正在使用 gallery
类型,您可能希望将 single.php
的内容复制到一个名为 single-gallery.php
并将循环模板部分更改为 get_template_part('loop','gallery');
。然后将 loop-single.php
复制到名为 loop-gallery.php
的文件中并根据需要修改其内容。
你可以在这里找到关于主题发展的更多信息 http: //codex.wordpress.org/Theme_Development
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
解决方案 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
这篇关于WordPress的:样式Post_Format loop-single.php使用get_template_part?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文
如果你想为不同的类型使用不同的模板,你将需要为每个帖子类型创建一个模板。假设您正在使用 gallery
类型,您可能希望将 single.php
的内容复制到一个名为 single-gallery.php
并将循环模板部分更改为 get_template_part('loop','gallery');
。然后将 loop-single.php
复制到名为 loop-gallery.php
的文件中并根据需要修改其内容。
你可以在这里找到关于主题发展的更多信息 http: //codex.wordpress.org/Theme_Development
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
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
这篇关于WordPress的:样式Post_Format loop-single.php使用get_template_part?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!