Forums › Forums › Search & Filter Pro › Customize result.php with table
Tagged: change look result table php
- This topic has 40 replies, 2 voices, and was last updated 8 years, 3 months ago by Trevor.
-
Trevor(Private) August 10, 2016 at 1:16 pm #54101
as I haven’t heard back from you I hope all is OK? This results.php below works in Divi. The user wanted the results in a column that was 75% of the page width, the search form was in a sidebar in the other 25%.
The pavigation and post titles are full width, and the content is thumb to the left and excerpt to the right, taking up 1/3 and 2/3 of the 75% column width:
<?php /** * Search & Filter Pro * * Sample Results Template * * @package Search_Filter * @author Ross Morsali * @link http://www.designsandcode.com/ * @copyright 2015 Designs & Code * * Note: these templates are not full page templates, rather * just an encaspulation of the your results loop which should * be inserted in to other pages by using a shortcode - think * of it as a template part * * This template is an absolute base example showing you what * you can do, for more customisation see the WordPress docs * and using template tags - * * http://codex.wordpress.org/Template_Tags * */ if ( $query->have_posts() ) { ?> <div class="et_pb_text et_pb_module et_pb_bg_layout_light et_pb_text_align_center"> <?php echo $query->found_posts; ?> gefundene Ergebnisse<br /> Seite <?php echo $query->query['paged']; ?> von <?php echo $query->max_num_pages; ?><br /> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Seite zurück', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Seite vor' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> </div> <?php while ($query->have_posts()) { $query->the_post(); ?> <div> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <div class="et_pb_row_inner et_pb_row_1-4_1-2"> <div class="et_pb_column et_pb_column_1_4 et_pb_column_inner"> <div class="et_pb_text et_pb_module et_pb_bg_layout_light et_pb_text_align_left"> <?php if ( has_post_thumbnail() ) { echo '<a href="'; the_permalink(); echo '">'; the_post_thumbnail("small"); echo '</a>'; } ?> </div> </div> <div class="et_pb_column et_pb_column_1_2 et_pb_column_inner"> <div class="et_pb_text et_pb_module et_pb_bg_layout_light et_pb_text_align_left"> <p><br /><?php the_excerpt(); ?><p> <p><?php the_category(); ?></p> <p><?php the_tags(); ?></p> <p><small><?php the_date(); ?></small></p> </div> </div> </div> </div> <hr /> <?php } ?> <div class="et_pb_text et_pb_module et_pb_bg_layout_light et_pb_text_align_center"> Seite <?php echo $query->query['paged']; ?> von <?php echo $query->max_num_pages; ?><br /> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Seite zurück', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Seite vor' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> </div> <?php } else { echo "No Results Found"; } ?>
Anonymous(Private) August 19, 2016 at 11:55 am #55023Hey Trevor!
Sorry for not responding as that fast.
I really want to say thank you! Your solution fits perfect!I allready added a few things, and everything looks very good!
If you need to know, how to add the taxonomy to each searchresult, wich they are assigned to, just let me know. I could post my solution here!
Greats and once more, Thank you!
Anonymous(Private) August 19, 2016 at 12:18 pm #55029<?php $sep = " "; ?> <?php $terms = get_the_terms( $post->ID , 'sparte' ); if ( $terms != null ){ foreach( $terms as $term ) { print $sep; print $term->name; //unset($term); } } ?>
<?php $sep = " "; ?>
Sets the seperator seeting!Sparte is my custom taxonomy!
Just change this to your taxonomy.Hope it helps!
Greats
-
AuthorPosts