所以我想在一个“like lock”后面放一个帖子循环,该锁是由一个插件创建的,该插件使用短代码[to\\u like ID=“XX”]内容[[to\\u like]。但是我没有用插件阻止内容,而是得到了一个包含所有帖子永久链接的页面。
所以我想我要问的是,如何将页面内容(即,显示帖子的模板中的循环)放在短代码中,使其被插件隐藏?
这就是我现在得到的:
foreach ( $posts as $post ) :
setup_postdata( $post );
$content = \'<li><div itemscope itemtype="http://schema.org/LocalBusiness">\';
$content .= \'<span itemprop="name"><a href="\'.the_permalink().\'" tilte="\'.the_title().\'">\'.the_title().\'</a></span>\';
$content .= \'<span itemprop="description"></span>\';
$content .= \'<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">\';
$schemaStreet = get_post_meta( $post->ID, \'schemaStreet\', $single );
$schemaCity = get_post_meta( $post->ID, \'schemaCity\', $single );
$schemaState = get_post_meta( $post->ID, \'schemaState\', $single );
$content .= \'<span itemprop="streetAddress">\'.$schemaStreet[0].\'</span>\';
$content .= \'<br /><span itemprop="addressLocality">\'.$schemaCity[0].\'</span>, <span itemprop="addressRegion">\'.$schemaState[0].\'</span>\';
$content .= \'</div>\';
$content .= \'</div>\';
$content .= \'</li>\';
do_shortcode(\'[to_like id="1208"]\'.$content.\'[/to_like]\');
endforeach;
wp_reset_postdata();