Awobotu Oluwatayo
Awobotu Oluwatayo

Reputation: 1

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.

Upvotes: 0

Views: 157

Answers (1)

Rishit Patel
Rishit Patel

Reputation: 96

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

Upvotes: 1

Related Questions