• 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

Conditional Statement Not Working to Change Site Title on Blog Page

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 › Design Tips and Tricks › Conditional Statement Not Working to Change Site Title on Blog Page

This topic is: resolved

Tagged: conditional statement, site title

  • This topic has 5 replies, 2 voices, and was last updated 10 years, 10 months ago by Brad West.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • March 11, 2015 at 3:22 am #143979
    Brad West
    Member

    I'm trying to change the site-title text for my blog page. Any ideas why the below isn't working?

    add_action( 'genesis_site_title', 'lifechange_blog_title' );
    function lifechange_blog_title() {
      if ( is_page( 'blog' ) ) {
        add_filter( 'genesis_seo_title', 'custom_genesis_seo_title', 10, 1 );
        function custom_genesis_seo_title( $title ) {
          $title = '<h1 itemprop="headline" class="site-title">The Life Change Blog</h1>';
          return $title;
        }
      }
    }
    http://www.thelifechangepeople.com/blog/
    March 11, 2015 at 4:50 am #143988
    Brad Dalton
    Participant

    You could create a custom blog page template and use code in it as the conditional may not always work on the blog page template.

    Rather than filter it, you can then simply remove the default and add back a new one.

    Otherwise, try the filter in your functions file and play around with the conditional:

     
    add_filter( 'genesis_seo_title', 'custom_genesis_seo_title', 10, 1 );
    function custom_genesis_seo_title( $title ) {
    if ( is_your_conditional() ) {
          $title = '<h1 itemprop="headline" class="site-title">The Life Change Blog</h1>';
          return $title;
        }
      }
    

    Tutorials for StudioPress Themes.

    March 11, 2015 at 8:57 pm #144117
    Brad West
    Member

    I've tried creating a blog template, but I couldn't get it to work. First it doesn't change the title, but worse it doesn't display any blog posts. Do you know of any tutorials for this?

    As for the conditional, the one above is in the functions file, but I can't get it to work. I tried is_page( 'blog' ), is_page( 'The Life Change Blog' ), is_page( 27 ), is_singular( 'blog' ), is_singular( 'The Life Change Blog' ) and is_singular( 27 ). None of these work. I've also tried hooking it in different places: add_action( 'genesis_site_title', 'lifechange_blog_title' );, add_action( 'genesis_seo_title', 'lifechange_blog_title' ); and add_action( 'genesis_header', 'lifechange_blog_title' );. None of this makes any difference either.

    March 11, 2015 at 9:47 pm #144119
    Brad Dalton
    Participant

    I do have several tutorials on these topics for members only http://wpsites.net/web-design/add-content-before-posts-blog-page-only/


    Tutorials for StudioPress Themes.

    March 11, 2015 at 10:29 pm #144121
    Brad West
    Member

    I found some discussion on StackExchange that was helpful. I decided to try again with the Blog Template, and used the below. It's working for me.

    <?php
    
    /**
      Template Name: Life Change Blog
    */
    
    //* Replace Site Title text
    add_filter( 'genesis_seo_title', 'custom_genesis_seo_title', 10, 1 );
    function custom_genesis_seo_title( $title ) {
    	$title = "<h1 itemprop='headline' class='site-title'>The Life Change Blog</h1>";
    	return $title;
    }
    
    //* Replace the loop.
    remove_action( 'genesis_loop',  'genesis_do_loop' );
    add_action( 'genesis_loop',  'genesis_custom_loop' );
    
    //* Change the content archive and loop args.
    add_action( 'genesis_pre_get_option_content_archive', 'child_post_content_archive' );
    add_filter( 'genesis_custom_loop_args', 'child_loop_args' );
    
    genesis();
    
    //* Change default content to excerpts on this page.
    function child_post_content_archive() {
        return 'excerpts';
    }
    
    /**
     * Use WP_Query args.
     *
     * @link {http://codex.wordpress.org/Function_Reference/WP_Query}
     */
    function child_loop_args() {
    
        return array(
            posts_per_page => 5,
        );
    }
    March 11, 2015 at 10:30 pm #144122
    Brad West
    Member

    Although, if someone can explain why that conditional in the original post isn't working, I'd love to know.

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Conditional Statement Not Working to Change Site Title on Blog Page’ is closed to new 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