0

我在造型上遇到了麻烦<p class="wp-caption-text">

我试过.detail p.wp-caption-text, .detail .wp-caption-text, .wp-caption-text, 等等。似乎没有任何效果。我错过了什么?

索引.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 -->

现场直播。

4

2 回答 2

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>'; }?
于 2012-06-05T18:49:09.567 回答
0

我把php包裹在里面

并将 css 更改为 .detail p ,这使它一切正常。谢谢你的帮助。

于 2012-06-05T19:22:14.753 回答