这可能很容易做到,但不幸的是我不太擅长编码。尽管我诚实地尝试着学习。如何让wordpress中的第一个帖子更大
我在wordpress中有一个主题,使帖子标记为“聚光灯”,其余的大小是其两倍。我想改变它,以便它自动成为这个尺寸的第一篇文章。我希望这是有道理的。
的代码片段,我有:
// Get blog layout setting
$blog_layout = get_theme_mod('blog_layout_setting', 'three-columns');
$portfolio_layout = get_theme_mod('portfolio_layout_setting', 'four-columns');
if (is_tax('ct_portfolio') || is_page_template('templates/template-portfolio.php')) :
if ('four-columns' == $portfolio_layout) {
if (has_tag('spotlight')) {
$classes[] = 'col-lg-6 col-md-8 col-sm-12';
} else {
$classes[] = 'col-lg-3 col-md-4 col-sm-6';
}
} else {
if (has_tag('spotlight')) {
$classes[] = 'col-md-8 col-sm-12';
} else {
$classes[] = 'col-md-4 col-sm-6';
}
}
我敢肯定,它只是改变了 “如果(has_tag( '聚光灯')” 的东西我++或i = 1,或者类似的东西我可能也是完全错误的,我觉得答案是盯着我,但我无法把握,我试过四处寻找,但没有找到一个好的答案。我真的很高兴有任何帮助,我真的从中学习到这点。
在此先感谢。
我不认为这是足以做到这一点的第一个标签。你需要找到第一个post元素得到的是什么'class'或'id'。然后使用CSS或PHP或其他类似的东西来定位'class'或'id',并以这种方式放大它。 – Aidin
也许你可以使用'$ loop-> current_post =='0''这里提到http://wordpress.stackexchange.com/questions/173171/how-to-target-thumbnails-of-the-first-post-在环 – RST