我有以下代码:
<div class="widget-title"><h2><?php echo esc_attr(of_get_option(\'carousel_post_title\'));?></h2></div>
所以在我的主页上。php我获取类别,如何在获取类别的同时,也获取self中类别的链接??
我的页面php代码是:
<div class="carousel_post_home_wrapper">
<div class="row carousel_post_home">
<div class="twelve columns carousel_header_wrapper">
<div class="widget-title"><h2><?php echo esc_attr(of_get_option(\'carousel_post_title\'));?></h2></div>
<div class="owl_carousel carousel_header">
<?php
$category_carousel_post="";
$number_of_carousel= of_get_option(\'number_carousel\');
$category_carousel= of_get_option(\'carousel_post\');
if (of_get_option(\'number_offset_carousel_post\')){$number_offset_carousel_post = of_get_option(\'number_offset_carousel_post\');}else{$number_offset_carousel_post = 0;}
if(!empty($category_carousel)) {
foreach($category_carousel as $key=>$value) { if($value == 1) { $category_carousel_post[] = $key; } }
}
$post_array_carousel = array(
\'showposts\' => $number_of_carousel,
\'category__in\' => $category_carousel_post,
\'ignore_sticky_posts\' => 1,
\'offset\' => $number_offset_carousel_post
);
$jellywp_widget_carousel = new WP_Query($post_array_carousel);
$i=0;
while ($jellywp_widget_carousel->have_posts()) {
$jellywp_widget_carousel->the_post();
$i++;
$post_id = get_the_ID();
//get all post categories
$categories = get_the_category(get_the_ID());
我的意思是,每次我有分类标题,我也希望这个标题有一个链接,并转到我的页面。com/类别/类别名称
对不起,我的英语不好,如果你需要进一步的解释,请告诉我。。