0

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.

1
  • 2
    The quotations you used “ ” are not valid syntax, try this: <?php echo do_shortcode( '[pff-paystack id="1597"]' ); ?> Commented Oct 19, 2018 at 9:57

1 Answer 1

1

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();
}
Sign up to request clarification or add additional context in comments.

3 Comments

The error i get. Parse error: syntax error, unexpected 'id' (T_STRING), expecting ']' in /data/4/5/82/84/5245736/user/6293749/htdocs/wp-content/plugins/nd-booking/inc/shortcodes/include/thankyou/nd_booking_thankyou_right_content.php on line 7
<h1 class="nd_booking_margin_top_50_responsive">'.__('Make Payment Here','nd-booking').' :</h1> function section_case_study($atts){ ob_start(); global $selected_id; $selected_id = $atts['1597']; get_template_part( 'template-parts/section-case-study'); return ob_get_clean(); } <?php echo do_shortcode("[pff-paystack id="1597"]"); ?> <div class="nd_booking_section nd_booking_height_30"></div>
Please do not post large chunks of code in comments where it cannot be properly formatted. Edit your original question to show updates to your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.