Celebrating 7 Years! Get up to $30 off GeneratePress Premium!

[Resolved] list search results in more than one column

Home Forums Support [Resolved] list search results in more than one column

Home Forums Support list search results in more than one column

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #580125
    Henry 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?

    - h.k. Bowman

    GeneratePress 2.1.2
    #580167
    Leo
    Staff
    Customer Support
    #581636
    Henry Bowman

    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.

    - h.k. Bowman

    #581780
    David
    Staff
    Customer Support
    #581810
    Henry Bowman

    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.

    - h.k. Bowman

    #581822
    Leo
    Staff
    Customer Support

    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 πŸ™‚

    #581831
    Henry Bowman

    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

    - h.k. Bowman

    #581838
    Leo
    Staff
    Customer Support

    Can you give Code Snippets a shot just to test?

    #581894
    Henry Bowman

    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.

    - h.k. Bowman

    #581942
    Leo
    Staff
    Customer Support

    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.

    #582087
    Henry Bowman

    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.

    - h.k. Bowman

    #582215
    Tom
    Lead Developer
    Lead Developer

    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.

    #585574
    Henry Bowman

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

    - h.k. Bowman

    #585693
    Tom
    Lead Developer
    Lead Developer

    Awesome – glad I could help! πŸ™‚

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.