我希望能够为Jetpack特色内容模块调用用户选择的标记ID,但我找不到保存该值的函数或对象。
我基本上试图用这些参数来过滤WP_Query中的特色帖子:
$args = array(
'ignore_sticky_posts' => 1,
'posts_per_page' => $recent_posts_count,
'tag__not_in' => array(
[HERE IS WHERE I WANT PHP TO TELL ME THE TAG ID]
),
'post_type' => array(
'post'
)
);
答案 0 :(得分:0)
检查这个
<?php
global $post;
$tags = get_tags($post->ID);
$tagids = array();
foreach($tags as $tag) $tagids[] = $tag->term_id;
$args = array(
'ignore_sticky_posts' => 1,
'posts_per_page' => $recent_posts_count,
'tag__not_in' => $tagids,
'post_type' => array(
'post'
)
);
?>
由于
答案 1 :(得分:0)
我知道这已经很晚了,但我在寻找同样的事情时发现了这篇文章,甚至发布在WordPress支持论坛上,但终于弄明白了:
$featured_options = get_option( 'featured-content' );
$featured_name = $featured_options[ 'tag-name' ];