您的位置:首页 > 新闻 > 会展 > 建筑施工合同模板_一人之下王也_google免费入口_seo综合查询爱站

建筑施工合同模板_一人之下王也_google免费入口_seo综合查询爱站

2025/3/1 8:59:13 来源:https://blog.csdn.net/jianzhanyes/article/details/145937759  浏览:    关键词:建筑施工合同模板_一人之下王也_google免费入口_seo综合查询爱站
建筑施工合同模板_一人之下王也_google免费入口_seo综合查询爱站

专为导航而生,在wordpress模板制作过程中常常会在做breadcrumbs导航时会用到,子分类调用父分类的名称和链接,下面这段简洁的代码,可以完美解决这个问题。

<?php echo get_category_parents( $cat, true, ' &raquo; ' ); ?>

下面这种方法也可以,不过代码不够简洁。

<?php
if ( is_category() ) {// Get the current category term id.$query_obj = get_queried_object();$term_id   = $query_obj->term_id;echo get_term_parents_list( $term_id, 'category' );
}
?>

第三种方法,调用分类目录名称和链接,作为导航。

<?php
if ( ( is_tax() || is_category() || is_tag() ) ) {$trail     = '';$home      = '/<a href="' . get_home_url() . '">Home</a>';$query_obj = get_queried_object();$term_id   = $query_obj->term_id;$taxonomy  = get_taxonomy( $query_obj->taxonomy );if ( $term_id && $taxonomy ) {// Add taxonomy label name to the trail.// $trail .=  '/' . $taxonomy->labels->menu_name;// Add term parents to the trail.$trail .= '/' . get_term_parents_list( $term_id, $taxonomy->name, array( 'inclusive' => false ) );}// Print trail and add current term name at the end.echo '<p class="breadcrumb-trail">' . $home . $trail . $query_obj->name . '</p>';
}
?>

 原文

http://www.chudafu.com/jianzhan/4409.html

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com