This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Add Compact search box to specific page whith out Widget

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Add Compact search box to specific page whith out Widget Reply To: Add Compact search box to specific page whith out Widget

#32497
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Well, if there is no widgetized area, nor any other way to place the shortcode manually, then probably using a custom code is the only option.

Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

add_action('wp_footer', 'asp_add_shortcode_footer');
function asp_add_shortcode_footer() {
	// Page IDs where the plugin should be displayed
	$show_on_page_ids = array(1, 2, 3, 4);
	
	if ( in_array(get_queried_object_id(), $show_on_page_ids) ) {
		echo do_shortcode('[wd_asp id=1]');
	}
}

So this code will print the plugin shortcode on pages within the $show_on_page_ids array.