Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php wordpress,使归档页类别特定_Php_Wordpress - Fatal编程技术网

Php wordpress,使归档页类别特定

Php wordpress,使归档页类别特定,php,wordpress,Php,Wordpress,我编辑了标准wordpress日历,以根据类别突出显示日期的颜色,日历功能使用get\u day\u link()加载当天的所有帖子,但我想将其限制为特定类别。下面是制作日期可点击链接的代码,这是对general-template.php文件的编辑,函数是get\u calendar() if(in_数组($day,$daywithevent)&&in_数组($day,$daywithtraining))//今天是否同时发生事件和培训? $calendar_输出='”; elseif(在数组中(

我编辑了标准wordpress日历,以根据类别突出显示日期的颜色,日历功能使用
get\u day\u link()
加载当天的所有帖子,但我想将其限制为特定类别。下面是制作日期可点击链接的代码,这是对general-template.php文件的编辑,函数是
get\u calendar()

if(in_数组($day,$daywithevent)&&in_数组($day,$daywithtraining))//今天是否同时发生事件和培训?
$calendar_输出='”;
elseif(在数组中($day,$daywithtraining))//只进行培训怎么样?
$calendar_输出='”;
elseif(在数组中($day,$daywithevent))//仅事件如何?
$calendar_输出='”;
其他的
$calendar_输出=''.$day;
$calendar_输出='';
有什么我可以添加到url中的吗?比如查询以使这3个链接特定于类别?似乎没有什么可以添加到
get\u day\u link

谢谢

我还没有检查您正在做什么,但您可以做的一件事是创建一个与您的类别相同的date.php文件并像

<?php
$query = new WP_Query(array('post_type' => 'post','category__in' => array( 2, 6 ), 'year'=>get_the_date('Y'),'monthnum'=>get_the_date('m'),'day'=>  get_the_date('d')));

 if ($query->have_posts() ) : while ($query->have_posts() ) : $query->the_post();
?>
post details goes here

<?php endwhile; endif; wp_reset_query();?>

这里有详细的帖子

我没有检查您正在做什么,但您可以做的一件事是创建一个与您的类别相同的date.php文件,并像

<?php
$query = new WP_Query(array('post_type' => 'post','category__in' => array( 2, 6 ), 'year'=>get_the_date('Y'),'monthnum'=>get_the_date('m'),'day'=>  get_the_date('d')));

 if ($query->have_posts() ) : while ($query->have_posts() ) : $query->the_post();
?>
post details goes here

<?php endwhile; endif; wp_reset_query();?>

这里有详细的帖子

谢谢,但问题是查询必须基于上面代码中的变量指定日期,但也许我可以尝试在我的代码中的某个地方实现该循环。哦,是的,我离开了dat,请参阅我编辑了我的答案。这可能会帮到你:)谢谢,但问题是如何使该循环成为指向新页面的可点击url,因为我的代码使用
get_day\u link
生成存档url。我现在没有时间检查,但是如果你生成的url是什么。然后它将打开date.php,你可以在那里进行自定义编码。请检查wordpress层次结构中的date。为此,你可以在你的主题中创建date.php。啊,我明白了,现在我明白了da的意思感谢您的帮助。谢谢,但问题是查询必须基于上面代码中的变量指定日期,但也许我可以尝试在我的代码中的某个地方实现该循环。哦,是的,我离开了dat,请参阅我编辑了我的答案。这可以帮到您:)谢谢,但问题是如何使该循环成为clickable url指向一个新页面,因为我的代码使用
get_day\u link
生成存档url。我现在没有时间检查生成的url是否正确。然后它将打开date.php,您可以在其中进行自定义编码。请检查wordpress层次结构中的日期。为此,您可以在主题中创建date.php。啊,我明白了,没有我明白日期的意义了。谢谢你的帮助。