【发布时间】:2021-02-09 21:30:04
【问题描述】:
我正在使用插件按年份创建自定义帖子类型日期档案:
<?php
$args = array(
'post_type' => 'unistused',
'type' => 'yearly',
'format' => 'anchor',
);
cptda_get_archives($args);
?>
我还为永久链接生成了自定义格式,以便在单击年度存档时锚定到正确的部分:
//
add_filter ('get_archives_link',
function ($link_html, $url, $text, $format, $before, $after) {
if ('anchor' == $format) {
$link_html = "<li class='year-archive'><a href='$url#dreams'>"
. "$text"
. '</a></li>';
}
return $link_html;
}, 10, 6);
不幸的是,当查看存档页面时,自定义结构“锚”不会将“活动”类添加到永久链接结构中,我无法实施解决方案或实验来实现这一点。任何帮助将不胜感激。
【问题讨论】:
标签: php wordpress filtering archive