在PHP中使用Shortcodes

时间:2014-08-14 16:37:35

标签: php html wordpress

我试图插入短代码[acf field =" my_map"]和[acf field =" links"]代替the_field(' my_map' )和the_field(' links')位于下面代码中显示的$ html字符串中。我显然没有足够的PHP能够让它发挥作用。请帮忙吗?

<?php
if ( function_exists( 'wpmudev_ppw_html' ) ) {
$html = '<div class="row top-spacer"><div class="col-md-8"><img class="img-responsive img-thumbnail" src="'.the_field('macro_map').'" /></div><div class="col-md-4"><h5><?php the_title(); ?>Resource Links</h5>'.the_field('symbol_news_links').'</div></div>'; // html code to be protected (required)
$id = 1; // An optional unique id if you are using the function more than once on a single page
$description = 'video'; // Optional description of the protected content
$price = '1.50'; // Optional price for a single view. If not set, price set in the post will be applied. If that is not set either, Unit Price in the Global Settings will be used.
echo wpmudev_ppw_html( $html, $id, $description, $price );
}
?>

1 个答案:

答案 0 :(得分:1)

<?php the_title(); ?>替换为'.the_title().'

相关问题