Site logo

Archived topic

list search results in more than one column

13 replies · Started by Henry Bowman on May 20, 2018

Viewing posts 1–14 of 14

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?

Great, 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.

We 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.

I just tested the code and it worked for me.

Any caching plugins?

If not can you try the Code Snippet method?

Let me know :)

Yes 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

Can you give Code Snippets a shot just to test?

I 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.

Can 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.

We 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.

Using 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.

That did the trick, perfectly. Thank you so much you guys rock, this is the best theme!

Awesome - glad I could help! :)

This archived topic is closed to new replies.