Wordpress页面模板格式化不起作用

时间:2016-10-11 14:58:32

标签: php html wordpress templates

我正在构建一个单词pres主题,并发现格式化不起作用。例如,如果我在帖子中构建一个简单的列表。

<ul>
  <li>one</li>
  <li>two</li>
</ul>

它有效,但是当我在页面中尝试它时,它不会应用列表元素或任何其他元素。

我不知道为什么我的网页没有获得任何格式

single.php中

**<?php get_header(); ?>

    <div class="row">
        <div class="col-sm-12">

            <?php
            if ( have_posts() ) : while ( have_posts() ) : the_post();
                get_template_part( 'content-single', get_post_format() );

                if ( comments_open() || get_comments_number() ) :
                    comments_template();
                endif;

            endwhile; endif;
            ?>

        </div> <!-- /.col -->
    </div> <!-- /.row -->

<?php get_footer(); ?>**

content_single.php

<div class="blog-post">

<h2 class="blog-post-title"><?php the_title(); ?></h2>
<p class="blog-post-meta"><?php the_date(); ?> by <a href="#"><?php the_author(); ?></a></p>

<?php the_content(); ?>

<?php if ( has_post_thumbnail() ) {
    the_post_thumbnail();
} ?>

////////////和页面/////////////////////

page.php文件

<?php get_header(); ?>

    <div class="row">
        <div class="col-sm-12">

            <?php
            if ( have_posts() ) : while ( have_posts() ) : the_post();

                get_template_part( 'content', get_post_format() );

            endwhile; endif;
            ?>

        </div> <!-- /.col -->
    </div> <!-- /.row -->

<?php get_footer(); ?>

content.php

<div class="blog-post">

    <h2 class="blog-post-title">
        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    </h2>

    <p class="blog-post-meta">
        <?php the_date(); ?>by <a href="#"><?php the_author(); ?></a>
        <a href="<?php comments_link(); ?>">
            <?php printf(_nx('One Comment', '%1$s Comments', get_comments_number(), 'comments title', 'textdomain'), number_format_i18n(get_comments_number())); ?>
        </a>
    </p>

    <?php if ( has_post_thumbnail() ) {?>
        <div class="row">
            <div class="col-md-4">
                <?php   the_post_thumbnail('thumbnail'); ?>
            </div>
            <div class="col-md-6">
                <?php the_excerpt(); ?>
            </div>
        </div>
    <?php } else { ?>
        <?php the_excerpt(); ?>
    <?php } ?>

</div><!-- /.blog-post -->

1 个答案:

答案 0 :(得分:0)

好的, page.php 我改变了这个

x = soup.body.findAll(text=re.compile('fixed text')).parent

AttributeError: 'ResultSet' object has no attribute 'parent'

到这个

<?php get_header(); ?>

<div class="row">
    <div class="col-sm-12">

        <?php
        if ( have_posts() ) : while ( have_posts() ) : the_post();

            get_template_part( 'content', get_post_format() );

        endwhile; endif;
        ?>

    </div> <!-- /.col -->
</div> <!-- /.row -->