• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Search Custom Genesis

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Search Custom Genesis

This topic is: resolved

Tagged: genesis, search custom, search.php

  • This topic has 4 replies, 2 voices, and was last updated 8 years, 3 months ago by James84.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • January 25, 2018 at 4:23 am #215721
    James84
    Member

    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'       => __('&laquo;'),
            'next_text'       => __('&raquo;')
          ));
    
          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 #215722
    Victor Font
    Moderator

    The 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 #215724
    James84
    Member

    The 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 #215733
    Victor Font
    Moderator

    We 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 #215752
    James84
    Member

    Good 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.

    Visita sito

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble