【问题标题】:Generate ID or class for each title in WordPress theme为 WordPress 主题中的每个标题生成 ID 或类
【发布时间】:2017-01-08 13:34:58
【问题描述】:

所以我在 WordPress 中为我的网站提供了以下代码。例如,在它显示当前页面的标题下,我的是“宝贝”(黑色)。所以我想为每个标题有一个唯一的类或 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(); ?>

【问题讨论】:

  • 你的标题是用themedsgn_biancca_taxonomy_info()生成的;正确的?我认为你应该发布那段代码
  • 是的..我真的不知道从哪里得到它

标签: php css wordpress themes id-generation


【解决方案1】:

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

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-05-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-09-13
  • 2018-04-08
相关资源
最近更新 更多