这可能吗?我正在尝试为我的内容使用预定义的模板。为此,我使用以下方法:
add_filter( \'default_content\', \'custom_editor_content\' );
function custom_editor_content( $content ) {
$args = array(
\'posts_per_page\'=> 15,
\'orderby\' => array(
\'ID\' => \'DESC\' ,
),
);
$query = new WP_Query( $args );
$query_contents=Array();
while ( $query->have_posts() ) {
$query->the_post();
array_push($query_contents,Array(
"id"=>get_the_ID(),
"title"=>get_the_title(),
"url"=>get_permalink(),
));
}
$content = \'
\'.get_the_title( $id ).\'
\';
return $content;
}
但不知怎么的,我没能得到这个职位。有人知道怎么做吗?如果我将while语句放入$content中,它会在编辑器中显示整个查询,这当然不是我想要的。
All I want to do is to fetch the post title and show it in the content editor (after posting or before, that wouldn\'t matter)
有人能帮帮我吗?