【问题标题】:Wordpress posts not displaying through dedicated urlWordpress 帖子未通过专用网址显示
【发布时间】:2014-12-22 14:21:05
【问题描述】:

有点奇怪。我的新闻帖子未通过其唯一 URL 显示。

示例: - 通过网站您可以看到新闻部分并点击: http://disciplesldn.com/

主题是自定义构建,使用 wordpress 插件“类型”作为 single.php 模板文件发布。

single.php 代码示例:

<?php get_header(); the_post(); ?>

<section id="singlepost">
<div class="loadwrapper">

<div class="titleheaderpost">
<h1 class="singletitle"><? the_title(); ?></h1>
<p class="back"><a href="<?php bloginfo('url'); ?>" class="newslink">< back to News</a></p>
</div><!-- end of .titleheader -->

<div class="thenewscontent" id="thecontent">

<? the_content(); ?>

</div>
</div>
</section><!-- end of #singlepost -->

<?php get_footer(); ?>

【问题讨论】:

    标签: php wordpress post wordpress-theming


    【解决方案1】:

    在第 757 行的 CSS 中,您在 'singlepost' id 上设置了定位样式。您需要删除 left & top 规则,帖子才能正确显示。

    例如:

    #singlepost {
         position: relative;
         /* left: 1200px; */
         /* top: -482px; */
         max-width: 960px;
         overflow: hidden;
         height: 100%;
         margin: 0 auto;
    }
    

    【讨论】:

    • 太棒了,我希望它比那更先进 :-) 好地方。感谢您的帮助。
    【解决方案2】:

    试试这个代码。

            <?php get_header();?>
            <?php while ( have_posts() ) : the_post(); ?>
            <section id="singlepost">
            <div class="loadwrapper">
    
            <div class="titleheaderpost">
            <h1 class="singletitle"><? the_title(); ?></h1>
            <p class="back"><a href="<?php bloginfo('url'); ?>" class="newslink">< back to News</a>  </p>
            </div><!-- end of .titleheader -->
    
            <div class="thenewscontent" id="thecontent">
    
            <? the_content(); ?>
    
            </div>
            </div>
            </section><!-- end of #singlepost -->
            <?php endwhile; // end of the loop. ?>
            <?php get_footer(); ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-12-06
      • 2011-06-06
      • 2017-08-02
      • 1970-01-01
      • 2019-08-24
      • 1970-01-01
      • 2017-04-21
      相关资源
      最近更新 更多