Community Forums › Forums › Archived Forums › Design Tips and Tricks › Custom Layout in Search Result Page
Tagged: Bootstrap, Search Page
- This topic has 4 replies, 2 voices, and was last updated 9 years, 8 months ago by artmaug.
-
AuthorPosts
-
May 13, 2015 at 6:07 pm #152102artmaugMember
Hello, I would like some help if possible in the following question:
I use in my Genesis theme a bootstrap grid, and would like to display the search results using this grid.
I put the following code in the plugin Simple Hooks genesis_entry_content Hook:
<?php if(is_search()) { ?> <div class="container-fluid"> <div class="row"> <div class="col-md-3 col-sm-6 col-xs-12"> <div class="gr-infos-container-cliente"> <div class="gr-promo-do-cliente"><?php the_field('tipo_de_promo');?></div> <div class="gr-img-cliente"><a href="<?php the_permalink();?>" title="<?php the_title();?>"><img src="<?php echo get_field('foto_cliente_miniatura');?>" alt="" class="img-responsive center-block"></a></div> <div class="gr-nome-cliente"><a href="<?php the_permalink();?>" title="<?php the_title();?>"><?php the_title();?></a></div> <div class="gr-tagline-cliente"><?php the_field('tagline_do_anunciante');?></div> <div class="gr-bairro-do-cliente"><i class="cliente fa fa-map-marker"></i><?php the_field('bairro_do_cliente');?></div> </div> </div> </div> <!-- Row --> </div> <!-- Container --> <?php } ?>
But in the search result, the content is aligned one on top of another and not in the selected grid.
Any tips you can give me?
I am very grateful for any help!
May 13, 2015 at 6:48 pm #152110Brad DaltonParticipantYou will need to add all the CSS that works with the classes the PHP code you posted generates
And
You will also need to add the
genesis():
function at the very end of the file.
You can name the file search.php or load its using the is_search() conditional tag.
May 13, 2015 at 7:10 pm #152112artmaugMemberHello braddalton, thanks for the quick response, but i try here and does work.
I created a search.php with the following code:
<?php /** * Search Results Template File */ get_header(); ?> <header> <h1>Search Results: "<?php echo get_search_query(); ?>"</h1> <br> </header> <?php if ( have_posts() ) : // results found?> <?php while ( have_posts() ) : the_post(); ?> <div class="container-fluid"> <div class="row"> <div class="col-md-3 col-sm-6 col-xs-12"> <div class="gr-infos-container-cliente"> <div class="gr-promo-do-cliente"><?php the_field('tipo_de_promo');?></div> <div class="gr-img-cliente"><a href="<?php the_permalink();?>" title="<?php the_title();?>"><img src="<?php echo get_field('foto_cliente_miniatura');?>" alt="" class="img-responsive center-block"></a></div> <div class="gr-nome-cliente"><a href="<?php the_permalink();?>" title="<?php the_title();?>"><?php the_title();?></a></div> <div class="gr-tagline-cliente"><?php the_field('tagline_do_anunciante');?></div> <div class="gr-bairro-do-cliente"><i class="cliente fa fa-map-marker"></i><?php the_field('bairro_do_cliente');?></div> </div> </div> </div> <!-- Row --> </div> <!-- Container --> <?php endwhile; ?> <?php else : // no results?> <article> <h1>No Results Found.</h1> </article> <?php endif; ?> <?php get_footer(); ?> genesis();
Unfortunately the content remains on top of the other.
May 13, 2015 at 7:20 pm #152117Brad DaltonParticipantMay 13, 2015 at 7:36 pm #152119 -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.