這可能很容易做到,但不幸的是我不太擅長編碼。儘管我誠實地嘗試着學習。如何讓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