【问题标题】:How to setup a custom posts page with WPTouch Pro Plugin如何使用 WPTouch Pro 插件设置自定义帖子页面
【发布时间】:2015-12-06 15:46:55
【问题描述】:

我有一个博客,它使用 wordpress 来显示帖子,而不是在首页上显示帖子,而是使用自定义模板(如 http://www.koolkatwebdesigns.com/blog/)用于桌面或非移动设备。对于移动设备,我正在使用带有包豪斯主题的 WPTouch Pro Plugin 无法显示帖子,仅显示页面标题,如下图所示:

page-2.php

<?php if ( foundation_is_theme_using_module( 'custom-latest-posts' ) && wptouch_fdn_is_custom_latest_posts_page() ) { ?>

    <?php wptouch_fdn_custom_latest_posts_query(); ?>
    <?php get_template_part( 'index' ); ?>

<?php } else { ?>

    <?php get_header(); ?>

    <div id="content">
        <?php if ( wptouch_have_posts() ) { ?>
            <?php wptouch_the_post(); ?>
            <?php get_template_part( 'page-content' ); ?>
        <?php } ?>
    </div> <!-- content -->

    <?php if ( wptouch_fdn_show_comments_on_pages() && ( comments_open() || have_comments() ) ) { ?>
        <div id="comments">
            <?php comments_template(); ?>
        </div>
    <?php } ?>

    <?php get_footer(); ?>

<?php } ?>

我该如何解决?

【问题讨论】:

  • 对于调试,您可以通过回显 hello &lt;?php echo " Hello "; ?&gt; 来查看它是否得到任何结果
  • @Steve 感谢您的帮助。我自己修好了。
  • 有趣的是,如果你没有那个模块,我会建议foundation_is_theme_using_module( 'custom-latest-posts' ) 可能是值得一看的——干得好! Echo hello 帮助我经常发现 WP 中发生的事情 - 事情并不总是像你想象的那样!
  • @steve 是的。我没有使用 echo 来解决我的问题,只是查看了我的自定义模板脚本(用于桌面版)并在上面的脚本中添加了一些修改。
  • 干得好 - 经常这样!

标签: php wordpress wordpress-theming


【解决方案1】:

我已经自己修好了,如下所示:

page-2.php

<?php get_header(); ?>
        <h2><a href=”<?php wptouch_the_permalink()?>”><?php wptouch_the_title(); ?></a></h2>
<?php if ( have_posts() ) { wptouch_the_post(); ?>
<div id="content">
    <div class="post-content">

        <?php query_posts('post_type=post&post_status=publish&posts_per_page=10&paged='. get_query_var('paged')); ?>
            <?php while ( have_posts() ) : the_post(); ?>
            <?php get_template_part( 'post-loop' ); ?>
             <?php endwhile;?>
    </div>
</div>
<?php } ?>

 <?php wp_reset_query(); ?>

<?php get_footer(); ?>

【讨论】:

    猜你喜欢
    • 2013-10-17
    • 2013-10-10
    • 2019-09-07
    • 1970-01-01
    • 2012-06-18
    • 2015-03-19
    • 1970-01-01
    • 1970-01-01
    • 2015-12-15
    相关资源
    最近更新 更多