【发布时间】:2021-09-14 21:45:10
【问题描述】:
我在页面中有一个sub-menus 列表,它将获得每篇文章的标题。
但我希望列表样式在具体文章页面时与其他样式有所不同。
现在<a>标签只有一个名为“list-group-item”的类,我希望文章中的<a>标签中再添加一个“活动”类。
希望有人能帮我解决这个问题...提前谢谢你。
这是我的代码:
<div class="list-group">
<?php global $post;
global $all_post_titles;
$all_post_titles = array();
$args = array('post_type' => 'service','orderby' => 'ID','order' => 'ASC',);
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post);?>
<a href="<?php the_permalink(); ?>" class="list-group-item"><?php the_title();?> <span class="fa fa-angle-right"></span></a>
<?php endforeach; ?>
<?php wp_reset_postdata();?>
【问题讨论】:
标签: wordpress wordpress-theming custom-wordpress-pages wp-nav-menu-item