1. Go to “Video Gallery => Settings => Advanced (tab) => Page Settings (sub menu)” from your “WordPress Admin Dashboard”.
2. Locate the “Search Page” option.
3. Select your custom search page from the select list.
4. Save the changes and check now.
Hope this solved your issue!
Thread Starter
lknoke
(@lknoke)
Hi,
thanks for the quick reply but this setting was already made. The page and the search is working (elementor with shortcode [aiovg_search]) but the header with “Showing results for “%s…” is not showing. Is this only working with the default search page?
Link for what I need
-
This reply was modified 5 years, 5 months ago by
lknoke.
-
This reply was modified 5 years, 5 months ago by
lknoke.
The header “Showing results for %s” works only if the page uses the WordPress core function the_title() to print the page title. Your custom elementor page should not be using this function.
Solution:
Kindly try adding the following code to the bottom of your theme’s functions.php file.
function aiovg_custom_search_title( $output, $tag ) {
if ( 'aiovg_search' == $tag ) {
$queries = array();
if ( ! empty( $_GET['vi'] ) ) {
$queries[] = sanitize_text_field( $_GET['vi'] );
}
if ( ! empty( $_GET['ca'] ) ) {
$term = get_term_by( 'id', (int) $_GET['ca'], 'aiovg_categories' );
$queries[] = $term->name;
}
if ( ! empty( $_GET['ta'] ) ) {
$tags = array_map( 'intval', $_GET['ta'] );
foreach ( $tags as $tag ) {
$term = get_term_by( 'id', $tag, 'aiovg_tags' );
$queries[] = $term->name;
}
}
if ( ! empty( $queries ) ) {
$title = '<h3>' . sprintf( __( 'Showing results for "%s"', 'all-in-one-video-gallery' ), implode( ', ', $queries ) ) . '</h3>';
return $title . $output;
}
}
return $output;
}
add_filter( 'do_shortcode_tag', 'aiovg_custom_search_title', 10, 2 );
Hope this solved your issue!