Site logo

Archived topic

Custom result page and taxonomy

21 replies · Started by Cris on April 25, 2019

Viewing posts 16–22 of 22

Perfect. And what about the code isn't working? It says in there that masonry, columns etc.. are set to false, so what I'm seeing looks pretty consistent with what your function is defining.

Ok I'll explain:
Look at the "search results" and "taxonomy" options. They are the same but the result they give is different.
See here search Results with this code:
/*Resultados búsquedas*/

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'] = 'Ver más resultados';
	$options['masonry_loading'] = 'Cargando más resultados';
	$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'] = false;
	$options['masonry'] = false;
    }
  
    return $options;
}

See here taxonomy page work with this code:

add_filter( 'option_generate_blog_settings', 'lh_custom_taxonomy_page_settings' );
function lh_custom_taxonomy_page_settings( $options ) {
    if ( is_tax() ) {
	$options['read_more_button'] = false;
    $options['infinite_scroll'] = true;
	$options['infinite_scroll_button'] = true;
	$options['masonry_load_more'] = 'Ver más resultados';
	$options['masonry_loading'] = 'Cargando más resultados';
	$options['post_image'] = true;
	$options['post_image_position'] = 'post-image-above-header';
	$options['post_image_alignment'] = 'post-image-aligned-left';
	$options['column_layout'] = false;
	$options['featured_column'] = false;
	$options['masonry'] = false;
    }
  
    return $options;
}

In taxonomy if I change the options it do nothing. Only work this option: $options['post_image_alignment'] = 'post-image-aligned-left';
I need change the taxonomy page like/similar to the search result page.

Both functions have different values, which is why the pages don't look the same.

If you want them to look the same, perhaps just use one function?:

add_filter( 'option_generate_blog_settings', function( $options ) {
    if ( is_search() || is_tax() ) {
	$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'] = 'Ver más resultados';
	$options['masonry_loading'] = 'Cargando más resultados';
	$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'] = false;
	$options['masonry'] = false;
    }
  
    return $options;
} );

I use that but the result is not the same in both.
Taxonomy / Search results

Added both same CSS code:

/*Search-results and Tax-pais*/
.search-results, .tax-pais {background-color:#f4f4f4;}
.search .post-image, .tax-pais .post-image {float:left; height:200px; width:300px;overflow:hidden;object-fit:cover;margin:0 40px 50px 0;}
.search .entry-title, .tax-pais .entry-title {font-size:24px !important;}

There are no excerpts in the taxonomy. You might need to add a manual excerpt for it to show up, depending on how you've added the content. That's why there isn't a read more button either.

You can stop the images from overflowing with this CSS:

.tax-pais .entry-summary {
    min-height: 100px;
}

Other than that the two look the same for me.

Better now with your code! Thanks!
I don’t need excerpt here. My biggest problem was the overflowing.
Thank you very much!!

You're welcome :)

This archived topic is closed to new replies.