Working on a Wordpress site. I need to add a shortcode into one of the php files (replacing a search bar code that is hardcoded into the header php file). How do I add a shortcode to the header php file?
This is the code that I am looking at:
<?php if ( (is_front_page()) && (of_get_option('g_search_box_id') == 'yes') ) { ?>
<div class="search-form-wrap hidden-phone" data-motopress-type="static" data-motopress-static-file="static/static-search.php">
<?php get_template_part("static/static-search"); ?>
</div>
<?php } ?>
and I need to remove the search-form-wrap with a different shortcode search form (for mls).
To run short-code from a php file. We use do_shortcode function eg:
// Use shortcodes in form like Landing Page Template.
echo do_shortcode( '[contact-form-7 id="91" title="quote"]' );
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.