【发布时间】:2016-05-11 07:01:22
【问题描述】:
我有一个简单的函数(在我的主题中的 functions.php 中),它将类添加到导航链接
add_filter('next_posts_link_attributes', 'posts_link_attributes');
add_filter('previous_posts_link_attributes', 'posts_link_attributes');
function posts_link_attributes() {
if (is_home() || is_front_page()) {
if (current_filter() == 'previous_posts_link_attributes') {
return 'class="prevlink ajax"';
}
elseif (current_filter() == 'next_posts_link_attributes') {
return 'class="nextlink ajax"';
}
}
}
我只需要在我的主页上使用它,但它不起作用。 谁能帮帮我?
【问题讨论】: