nSaqib
nSaqib

Reputation: 31

what is "do_shortcode" in wordpress and how it works?

I'm currently learning wordpress theme development and for better understanding I have downloaded couple of wordpress theme and seeing their code. But a line of code I can't understand. here it is-->

<?php echo do_shortcode(sq_option( 'footer_text ' ' ')); ?>

maybe its for footer but how this works and how i can use this function when I will create my own.

Upvotes: 2

Views: 6162

Answers (2)

saadeez
saadeez

Reputation: 1688

Generally do_shortcode(); is use to get data from shortcode or its attribute to your PHP code or to filter any shortcode returning data. Shortcode can be provided by any plugin.

Not sure about it but in your theme's code sq_option("footer_text"); could be a function which is filtering some text from footer.

The code could be as:

<?php echo do_shortcode( '[contact-form-7 id="91" title="quote"]' ); ?>

Reference Link

Upvotes: 2

Anoxy
Anoxy

Reputation: 953

do_shortcode is a function you have to use if you want to execute a shortcode inside a custom theme template page see more info on the function here: https://developer.wordpress.org/reference/functions/do_shortcode/

Upvotes: 1

Related Questions