Free Directory, Listing & Classifieds WordPress Plugin Support Themes ListingHive Changing layout of search results, without affecting other pages.

Changing layout of search results, without affecting other pages.

  • Author
    Posts
  • Blauweogen

    Hi, ihor. I have tried to find the solution without bothering you, but, no luck.
    I have changed the layout of the listings and listings category pages to 3 columns with the sidebar full width above it, using a snippet and css (see below). When I filter the listings by attribute, the results show in 3 columns with the sidebar on left. ?s=&_sort=&post_type=hp_listing&_category=315&business_type=325
    If I try to apply css, it also changes the sidebar on the single listing page.
    Is there a way I can change only the sorted view without affecting any other pages?

    .tax-hp_listing_category .hp-page__sidebar {flex-basis:100%; max-width:100%}
    .tax-hp_listing_category .hp-page__content {flex-basis:100%; max-width:100%}
    .listings_view_page .hp-page__sidebar {flex-basis:100%; max-width:100%}
    .listings_view_page .hp-page__content {flex-basis:100%; max-width:100%}
    add_filter(
    	'hivepress/v1/templates/listings_view_page',
    	function( $template ) {
    		return hivepress()->helper->merge_trees(
    			$template,
    			[
    				'blocks' => [
    					'listings' => [
    						'columns' => 3,
    					],
    				],
    			]
    		);
    	}
    );
    ihordeveloper

    You can prepend custom CSS rules with this class:

    .hp-template--listings-view-page

    Instead of “.tax-hp_listing_category” and “.listings_view_page”.

    Blauweogen

    Wow, simple. I knew I was overlooking something. Thanks! Works like a charm. I’ll get the hang of sooner or later. If only I had a brain. 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Subscribe

Sign In

Don't have an account? Register

Forgot password?

Register

Already have an account? Sign In

Forgot password?

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.

Cyber Monday is here! Get 25% off with MONDAY2020 coupon code until Monday, December 7.