[英]How can I insert a shortcode into a php code in WORDPRESS?
I would like to add a shortcode into a php code in wordpress. 我想在wordpress中将一个简码添加到php代码中。 My code looks like this:
我的代码如下所示:
<h1 class="nd_booking_margin_top_50_responsive">'.__('Make Your Payment
Here','nd-booking').' :</h1>
<div class="nd_booking_section nd_booking_height_30"></div>
<?php echo do_shortcode(“[pff-paystack id="1597"]”); ?>
I tried but the code is not showing on page. 我试过了,但是代码没有显示在页面上。
you should try this : 你应该试试这个:
<?php echo do_shortcode('[pff-paystack id="1597"]'); ?>
if you're using custom shortcode then you need to pass argument for id like this : 如果您使用的是自定义简码,则需要为id传递参数,如下所示:
function section_case_study($atts){
ob_start();
global $selected_id;
$selected_id = $atts['id'];
get_template_part( 'template-parts/section-case-study');
return ob_get_clean();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.