Archived topic
custom search result page
15 replies · Started by Michael on May 1, 2019
Hi i tried to make a custom result page . i tried to add the function in
https://docs.generatepress.com/article/option_generate_blog_settings/
but it doesnt work, i trited to put it in function.php or using plugin code snipet.
neither does the job.
i am using generate press theme and plugin.
Hi there,
What are you trying to achieve?
Can you provide the code you used?
Make sure to highlight them and click the code button when posting here.
Let me know :)
im trying to make customize my search result page like post, remove widget and header etc
i am using the code from documentation example
add_filter( 'option_generate_blog_settings', 'lh_custom_search_results_page_settings' );
function lh_custom_search_results_page_settings( $options ) {
if ( is_search() ) {
$options['read_more_button'] = true;
$options['date'] = false;
$options['categories'] = false;
$options['tags'] = false;
$options['comments'] = false;
$options['infinite_scroll'] = true;
$options['infinite_scroll_button'] = true;
$options['masonry_load_more'] = 'More search results';
$options['post_image'] = true;
$options['post_image_position'] = 'post-image-above-header';
$options['post_image_alignment'] = 'post-image-aligned-center';
$options['column_layout'] = false;
$options['featured_column'] = true;
$options['masonry'] = false;
}
return $options;
}
im trying to put in code snipet and function.php but it didnt work
Hi there,
I'm not sure that function is what you're after.
Are you wanting your search results not to have a sidebar?
If so, you can:
1. Create a Layout Element: https://docs.generatepress.com/article/layout-element-overview/
2. Set the sidebar layout
3. Set the Display Rules to "Search Results"
Let me know :)
That is what i need, thank you tom.
i have get rid of sidebar and all elements that i dont need. but the search result layout is not very nice
is there a way to display search result like plugin wp_show_posts
thank you
It depends on how you're using WP Show Posts. You can set up columns etc.. using the Blog module in Customize > Layout > Blog.
Let me know :)
im trying to modify search result,
in Blog module in Customize > Layout > Blog.
theres only option for archive and single, no option for search result page?
Not in the customizer, but you can use a filter:
https://docs.generatepress.com/article/using-columns-in-the-blog/#changing-the-number-of-columns
Adding PHP: https://docs.generatepress.com/article/adding-php/
i have tried to use the code and put it in code snippet or function.php but it doesnt work
this code:
add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
function tu_search_column_count( $count ) {
if ( is_search() ) {
return 33;
}
return $count;
}
That code should work.
Have you tried clearing the caching plugin and disable it as we suggested in the start a new topic checklist?
What can I search to see the search result page? The site isn't in English.
Let me know :)
i have cleared the caching and disable it in plugin section
this is the link to the search result page
https://agenkutus.com/?s=si
Hmm the code should definitely work.
Are you currently adding it using Code Snippets?
Can you make sure the snippet is actually activated?
im using code snipet and its activated.
Is the columns option turned on in the Customizer?
If not, you may need to add this as well:
add_filter( 'generate_blog_columns', function( $columns ) {
if ( is_search() ) {
return true;
}
return $columns;
} );
it works now tom, thank you