• 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

Display Search Term and Result Count

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 › Display Search Term and Result Count

This topic is: not resolved

Tagged: search result, search result count

  • This topic has 1 reply, 2 voices, and was last updated 9 years, 1 month ago by Susan.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • April 28, 2016 at 10:24 am #184622
    juso
    Participant

    Hi, how to display Search term with result count??

    My search.php file:
    <?php
    /**
    * Genesis Framework.
    *
    * WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
    * Please do all modifications in the form of a child theme.
    *
    * @package Genesis\Templates
    * @author StudioPress
    * @license GPL-2.0+
    * @link http://my.studiopress.com/themes/genesis/
    */

    add_action( 'genesis_before_loop', 'genesis_do_search_title' );
    /**
    * Echo the title with the search term.
    *
    * @since 1.9.0
    */
    function genesis_do_search_title() {

    $title = sprintf( '<div class="archive-description"><h1 class="archive-title">%s %s</h1></div>', apply_filters( 'genesis_search_title_text', __( 'Search Results for:', 'genesis' ) ), get_search_query() );

    echo apply_filters( 'genesis_search_title_output', $title ) . "\n";

    }

    genesis();

    I've tried adding

    global $wp_query;
    echo $wp_query->found_posts.' results found.';

    but I don't know how to display count into <h1 class="archive-title">

    The expected result would be: 'Search result for XXXXXX: NN articles'

    Thanks in advance

    October 14, 2016 at 11:18 am #194742
    Susan
    Moderator

    As you posted this a while ago, I hope you were able to get your issue resolved.

    If you ever don't get a response here in the forum, you might want to try posting in the Genesis Slack Group.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 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

© 2025 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