对于我的WordPress主题,我需要专家的帮助。这是我的nav-list html
示例:
//Here is my WP code:
<li>
<?php
$category_men = get_the_category_by_id($catmen['content-cat-one']);
$content_one =new WP_Query(array(
'post_type' => 'post',
'posts_per_page' => 1,
'category_name' => $category_men
));
while($content_one->have_posts()) : $content_one->the_post(); ?>
<a href="<?php echo get_category_link( $catmen['content-cat-one'] ); ?>#<?php echo get_cat_ID($category_men); ?>" >Men Category</a>
<?php endwhile; ?>
</li>
&#13;
<ul class="nav nav-tabs">
<li><a href="#men">Men Category</a></li>
</ul>
<div class="tab-pane active" id="men">
</div>
<div class="tab-pane active" id="<?php echo get_cat_ID($category_men); ?>">
&#13;
结果出来了://localhost/my-themes/category/featured/#5
我不想要上面的结果,我想要//localhost/my-themes/category/featured/
如何克服这些问题?
答案 0 :(得分:0)
替换此代码,
<a href="<?php echo get_category_link( $catmen['content-cat-one'] ); ?>#<?php echo get_cat_ID($category_men); ?>" >Men Category</a>
使用下面的代码段。
<a href="<?php echo get_category_link( $catmen['content-cat-one'] ); ?>">Men Category</a>