- This topic has 13 replies, 4 voices, and was last updated 5 years, 11 months ago by Tom.
-
AuthorPosts
-
May 20, 2018 at 8:02 am #580125Henry Bowman
When a search for a store item is done, the results are always displayed in one column, it’s not very appealing to the eye. Is there a way to set up a display of search results that have 4-5 columns of the products so it’s easier to view?
May 20, 2018 at 9:28 am #580167LeoStaffCustomer SupportHi there,
Give this a shot:
https://docs.generatepress.com/article/using-columns-in-the-blog/#changing-the-number-of-columnsMay 22, 2018 at 7:14 am #581636Henry BowmanGreat, now just one question. DO I add this to my child theme via the edit page? Is it just plopped in or does it need to be entered a certain way. we don’t mess around with code very much, I just want to double check.
May 22, 2018 at 8:11 am #581780DavidStaffCustomer SupportHi Henry see here for the different options:
May 22, 2018 at 8:28 am #581810Henry BowmanWe added the code snip it to the generate press child theme function.php:
add_filter( ‘generate_blog_get_column_count’,’tu_search_column_count’ );
function tu_search_column_count( $count ) {
if ( is_search() ) {
return 33;
}return $count;
}But the search still yields everything in one column.
May 22, 2018 at 8:40 am #581822LeoStaffCustomer SupportI just tested the code and it worked for me.
Any caching plugins?
If not can you try the Code Snippet method?
Let me know π
May 22, 2018 at 8:46 am #581831Henry BowmanYes we use WP rocket, but we cleared it twice so that is not the issue. The new thing we noticed is that it only seems to be an issue with the top menu bar search. The other search boxes yield results with 4 columns. Go figure.
test it out on our site https://usanunchaku.com
May 22, 2018 at 8:56 am #581838LeoStaffCustomer SupportCan you give Code Snippets a shot just to test?
May 22, 2018 at 9:42 am #581894Henry BowmanI thought that is what we did by adding the above code to the fuctions.php file in the child theme. I don’t want to add a plugin that will basically do what I just did. That is one great way to have sites crash. π and that makes me sad. The onboard edit function of generate press kept crashing the functions.php file., wiping it clean, so we had to restore it and do the add on code from dreamweaver and upload manually via FTP.
May 22, 2018 at 11:01 am #581942LeoStaffCustomer SupportCan you use Code Snippets just to test? You can remove it afterwards.
I tested the code several times and it worked on my install using Code Snippets so I’m trying to debug it for you.
May 22, 2018 at 2:03 pm #582087Henry BowmanWe installed the code snip plug in, we added the code and hit save, but it through us a fatal error and told us to back up. sooo….we just backed out and un-installed the plug in.
I can’t risk the site getting all bunched up over this. It would seem that if it were to work, it would work as the add on to the child theme’s function.php that we already did. Like I said, all the searched work fine except the one located in the menu bar, for some reason that search only gives one column results. All the other search boxes produce four column, which is fine.I thank you for your help but I’ve been burned with malfunctioning plug-ins before. In WordPress they can be the thing that let’s the devil himself in your door.
May 22, 2018 at 7:04 pm #582215TomLead DeveloperLead DeveloperUsing a child theme should be fine.
You may need to turn columns on:
add_filter( 'option_generate_blog_settings', 'lh_search_columns' ); function lh_search_columns( $options ) { if ( is_search() ) { $options['column_layout'] = true; } return $options; }
You would add this function along with the other function.
May 27, 2018 at 6:31 am #585574Henry BowmanThat did the trick, perfectly. Thank you so much you guys rock, this is the best theme!
May 27, 2018 at 8:17 am #585693TomLead DeveloperLead DeveloperAwesome – glad I could help! π
-
AuthorPosts
- You must be logged in to reply to this topic.