为WordPress主题中的每个标题生成ID或类

时间:2016-08-31 20:27:14

标签: php css wordpress themes id-generation

所以我在WordPress中为我的网站提供了以下代码。在它下面显示当前页面的标题,例如,我的是#34; Baby"(黑色)。所以我希望每个标题都有一个唯一的类或ID(所以我可以为每个标题使用不同的颜色而不是所有的黑色)但是因为它们是由PHP生成的,所以我不知道要实现这一点。如果它是一个纯HTML,我可以给它一个类并设计它,但现在我没有任何独特的类。

<?php get_header(); ?>

   <div class="primary-content">

          <?php 
       // display taxonomy info

 themedsgn_biancca_taxonomy_info();

// initiate the blogroll type
$blogroll_type = get_theme_mod( 'themedsgn_setting_archive_layout', 'grid' );

if( have_posts() ) {

    echo '<div class="blogroll blogroll-' . $blogroll_type . ' cf">';

    while( have_posts() ) {
        the_post();
        get_template_part( 'content', $blogroll_type );
    }

    echo '</div>';

    // pagination
    themedsgn_biancca_post_pagination();

} else {
    get_template_part( 'content', 'none' );
}
?>
</div>

<?php get_sidebar(); ?>
 <?php get_footer(); ?>

1 个答案:

答案 0 :(得分:-1)

查看Appearance / Editor,然后查找名为archive.php的文件。然后搜索存档标题。它应该在那里。