麻烦造型p类

时间:2012-06-05 18:46:29

标签: css

我在设置样式<p class="wp-caption-text">时遇到了问题。

我已尝试过.detail p.wp-caption-text.detail .wp-caption-text.wp-caption-text等等。似乎没什么用。我错过了什么?

的index.php

<?php get_header(); ?>
<!-- #content -->
<div id="content">
    <!-- start of .post -->
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post<?php if(!has_post_thumbnail()) echo " no-featured"; ?>">
        <?php if(has_post_thumbnail()): ?>
        <div class="featured">
            <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(700,9999)); ?></a>

        <div class="credit"></div>
        </div>
        <?php endif; ?>
        <div class="detail">
            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
            <?php if (the_post_thumbnail_caption()) { echo '<p class="wp-caption-text">' . the_post_thumbnail_caption() . '<p>'; }?>
            <div class="meta">
                <div class="top"></div>
                <p><?php _e('by'); ?> <strong><?php the_author(); ?></strong></p>
                <p><?php _e('posted'); ?>  <strong><?php echo get_the_date(); ?></strong></p>
                <p><?php _e('category'); ?>  <?php the_category(', '); ?></p>
                <div class="bottom"></div>
            </div>
            <div class="excerpt">
                <?php the_excerpt(); ?>
            </div>

            <?php 
                $args = array(
                    'post_type' => 'attachment',
                    'numberposts' => -1,
                    'post_status' => null,
                    'post_parent' => $post->ID
                    ); 
                $attachments = get_posts($args);
                if(count($attachments) > 1): 
            ?>
            <div class="pic-excerpt">
                <div class="top"></div>
                <div class="outer">
                    <h3><?php _e('Pictures In This Set'); ?></h3>
                    <div class="pic">
                        <?php the_image_excerpt(wpop_get_option('pic_excerpt')); ?>
                    </div>
                </div>
                <div class="bottom"></div>
            </div> <!-- pic-excerpt -->
            <?php endif; ?>

        </div>
    </div>

    <?php endwhile;?>
    <div class="paging">
        <div class="alignleft"><?php next_posts_link('&laquo; Older Entries', 0); ?></div>
        <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;', 0); ?></div>
        <div class="clear"></div>
    </div>
    <?php endif;?>
    <!-- end of .post -->

Live site.

2 个答案:

答案 0 :(得分:7)

你没有在这一行关闭你的段落标记 -

   <?php if (the_post_thumbnail_caption()) { echo '<p class="wp-caption-text">' . the_post_thumbnail_caption() . '<p>'; }?

这是一个修复

 <?php if (the_post_thumbnail_caption()) { echo '<p class="wp-caption-text">' . the_post_thumbnail_caption() . '</p>'; }?

答案 1 :(得分:0)

我将php包装在

中并将css更改为.detail p,这使得它全部工作。谢谢你的帮助。