【问题标题】:Wordpress Use Theme for Blog OnlyWordPress 仅将主题用于博客
【发布时间】:2014-01-19 08:55:57
【问题描述】:

我希望仅将Pinbin 主题用于我的 Wordpress 博客。我已经为其他所有内容创建了一个自定义主题,但对于博客,我想使用这个主题。

我从这个模板中获取了主索引 php 文件,以及页眉和页脚文件。我重命名了页眉和页脚文件,并将页眉/页脚调用更改为这些文件,而不是网站其余部分使用的文件。

我将主题分配给了一个页面,但它没有显示任何帖子。代码如下:

<?php if (have_posts()) : ?>
<div id="post-area">
<?php while (have_posts()) : the_post(); ?> 
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( has_post_thumbnail() ) { ?>
<div class="pinbin-image"><a href="<?php the_permalink() ?>"><?php the_post_thumbnail( 'summary-image' );  ?></a></div>
<div class="pinbin-category"><p><?php the_category(', ') ?></p></div>
<?php } ?>
<div class="pinbin-copy"><h2><a class="front-link" href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<p class="pinbin-date"><?php the_time(get_option('date_format')); ?>  </p>
<?php the_excerpt(); ?> 
<p class="pinbin-link"><a href="<?php the_permalink() ?>">&rarr;</a></p>
</div>
</div>       
<?php endwhile; ?>

关于为什么我什么都没看到有什么想法吗?

谢谢,S

【问题讨论】:

    标签: wordpress wordpress-theming


    【解决方案1】:

    如果没有定义其他模板,index.php 文件将用作备份,如果要编辑特定页面类型,则必须编辑其他文件。请参阅 WordPress 法典中的 template hierarchy

      +

    您忘记了文件底部的endif;

    【讨论】:

    • 不幸的是,事情没那么简单——这个主题使用的是 index.php 文件。我在那里发表了评论,它在源代码中。
    猜你喜欢
    • 1970-01-01
    • 2011-03-26
    • 2010-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-27
    • 1970-01-01
    相关资源
    最近更新 更多