Community Forums › Forums › Archived Forums › General Discussion › Search Custom Genesis
Tagged: genesis, search custom, search.php
- This topic has 4 replies, 2 voices, and was last updated 6 years, 7 months ago by James84.
-
AuthorPosts
-
January 25, 2018 at 4:23 am #215721James84Member
Good morning, I'm trying to do a custom search by editing the search.php file in the root of the Genesis child theme.
I detect an error in pagination, (1, 2, 3) if I click on 2, open the page with url http://www.miosito.it/page/2/?s=keyword, return 404, why? does it depend on Genesis?global $wp_query, $paged; $parola_chiave = get_search_query(); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; //print_r($paged); //$s = isset( $_GET["s"] ); $s = isset( $_GET["s"] ) ? $_GET["s"] : ""; $args = (array( 's' => $s, 'posts_per_page' => 3, 'paged' => $paged, //'page' => $paged )); $wp_query = new WP_Query( $args ); //print_r($wp_query); ?> <div class="container-search"> <?php if ( $wp_query->have_posts() ) { $startpost=1; $startpost=3*($paged - 1)+1; $endpost = (3*$paged < $wp_query->found_posts ? 3*$paged : $wp_query->found_posts); ?> <div class="result"> <h2>You searched for: <?php echo $s ?></h2> <p>Displayed results: from <strong><?php echo $startpost; ?></strong> to <strong><?php echo $endpost; ?></strong> of <strong><?php echo $wp_query->found_posts; ?></strong> total</p> </div> <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?> <article class="search"> <h3><?php echo get_the_title(); ?></h3> <span class="url"><a href="<?php the_permalink(); ?>"><?php the_permalink(); ?></a></span> <p><?php echo get_the_excerpt(); ?></p> </article> <?php endwhile; $big = 999999999; echo paginate_links(array( 'base' => preg_replace('/\?.*/', '', get_pagenum_link(1)) . '%_%', 'format' => 'page/%#%', 'current' => $paged, 'total' => $wp_query->max_num_pages, 'prev_text' => __('«'), 'next_text' => __('»') )); wp_reset_postdata(); } else { $startpost=0; $startpost=3*($paged - 1)+0; $endpost = (3*$paged < $wp_query->found_posts ? 3*$paged : $wp_query->found_posts); ?> <div class="displayResult"> <h2>You searched for: <?php echo $s ?></h2> <p>Displayed results: from <strong><?php echo $startpost; ?></strong> to <strong><?php echo $endpost; ?></strong> of <strong><?php echo $wp_query->found_posts; ?></strong> total</p> </div> <?php echo '<p>No result</p>'; }
January 25, 2018 at 5:58 am #215722Victor FontModeratorThe site you are linking to is not a Genesis site. We can't help you since your site isn't Genesis based.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?January 25, 2018 at 6:18 am #215724James84MemberThe posted link is an example link, not the official link. I assure you that I am using Genesis Theme, I have been using it for some time.
January 25, 2018 at 11:50 am #215733Victor FontModeratorWe still can't help you without access to the site. We'd only be guessing as to what's wrong. Did you resave permalinks?
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?January 26, 2018 at 5:37 am #215752James84MemberGood morning,
I created a test area, I reproduced an error in the search.
Pass the mouse on the search icon in the menu, insert text "lorem ipsum". See the results and bottom pagination. -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.