我想要什么
<div class=\'article-content\'>
在前端显示为文本,而不是调出原始文章标题
add_filter( \'the_content\', \'prefix_insert_post_ads\' );
function prefix_insert_post_ads( $content ) {
$posts = get_field(\'show_post_in_content_part\',$postID); if( $posts ):
$category_detail=get_the_category($postID);
foreach($category_detail as $cd){
$cat=$cd->cat_name;
}
foreach( $posts as $post): setup_postdata($post);
$img = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
$link=get_the_permalink($post->ID);
$cn = $post->post_excerpt;
$contenta=implode(\' \', array_slice(explode(\' \', $cn), 0, 32));
$contentm=implode(\' \', array_slice(explode(\' \', $cn), 0, 15));
$ad_code = "<div class=\'article-block cf\'>
<div class=\'triangle-02\'>
<!--<img src=\'".$img."\' alt=\'\'>-->
</div>
<div class=\'article-content\'>
<h3><div class= \'article-title\'></h3>
<p class=\'desktop_view\'>".$contenta."</p>
<p class=\'mobile\'>".$contentm."</p>
<p><a href=\'".$link."\' class=\'readmore\'>read more..</a></p>
</div>
<div class=\'article-img\'>
<div class=\'img\'>
<img src=\'".$img."\'>
<div class=\'caption\'>".$cat."</div>
</div>
</div>
</div>";
endforeach; wp_reset_postdata(); endif;
if ( is_single() && ! is_admin() ) {
return prefix_insert_after_paragraph( $ad_code, 2, $content );
}
return $content;
}