简体   繁体   中英

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. 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 :

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();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM