• 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

Accessing 'Custom Document Title' field from Genesis theme

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 › Accessing 'Custom Document Title' field from Genesis theme

This topic is: not resolved

Tagged: seo, title, WooCommerce

  • This topic has 3 replies, 2 voices, and was last updated 12 years, 2 months ago by krystyn.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • March 2, 2014 at 8:04 pm #93115
    kaplunkiigirl
    Member

    I'm using Genesis with Dynamik Website Builder and WooCommerce.

    I have created a function in my custom functions.php file to modify the meta page titles in the shop (WooCommerce has its own function to set the titles, which overrides the Genesis function and I wasn't happy with it).

    I would like to check whether a product category archive has a 'Custom Document Title' in the Genesis SEO settings for that archive and use that preferentially if it is set. Otherwise, I will use my standard function to set the title.

    I don't know how to reference the value stored by the Genesis framework in the SEO settings for the (product) category.

    This is a cut-down version of my function to demonstrate the value I am trying to figure out how to access, represented by $genesis_seo_title

    
    add_filter( 'wp_title', 'yw_modify_page_titles', 20 );
    function yw_modify_page_titles( $title ) {
       if ( is_product_category() ){
          if( $product_category )
             if( $genesis_seo_title )
                return $genesis_seo_title;
             else
                return '<title>' . $product_category . ' | ' . 'Shop' . ' | ' . get_bloginfo('name') . '</title>'; 
       }
    }
    

    Can someone tell me what the syntax is that I need to use to access the value of the 'Custom Document Title' within the Genesis framework fields for a given category?

    $genesis_seo_title = ?? ($category_name);

    Thank you,

    Nikki

    http://local
    March 2, 2014 at 8:10 pm #93117
    kaplunkiigirl
    Member

    I can see that in the 'cpt-archive-settings.php' file in the Genesis theme, that the value for this field is accessed via:

    $this->get_field_value( 'doctitle' )

    but I can't get my head around how to access this value from outside the context of the object (ie in my custom functions.php file).

    Any pointers would be greatly appreciated.

    March 2, 2014 at 8:45 pm #93121
    kaplunkiigirl
    Member

    Ok, so I now have an answer to this.

    In the Genesis lib/structure/header.php file

    Custom post type archives:

    if ( is_post_type_archive() && genesis_has_post_type_archive_support() ) {
    $title = genesis_get_cpt_option( 'doctitle' ) ? genesis_get_cpt_option( 'doctitle' ) : $title;
    }

    Categories:

    if ( is_category() ) {
    $term = $wp_query->get_queried_object();
    $title = ! empty( $term->meta['doctitle'] ) ? $term->meta['doctitle'] : $title;
    }

    So in the context of my product category, I needed this:

       global $wp_query;
       $term = $wp_query->get_queried_object();
       $product_category_seo_title = $term->meta['doctitle'];

    to give me access to the 'Custom Document Title' value for that category.

    March 18, 2014 at 9:31 am #95495
    krystyn
    Participant

    @kaplunkiigirl

    I think I want to do the same thing. I have a category page, and on that category page, instead of using the post title , I'd like to use the Custom Document Title displaying on the image.

    This is what I'm using:

    add_action( 'genesis_entry_header', 'beautiful_category_grid');
    function beautiful_category_grid() {

    if ( $image = genesis_get_image( 'format=url&size=portfolio' ) ) {
    printf( '<div class="pcategory-featured-image">%s</div>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );

    }

    }

    Any hints as to how to swap that out so I can use the SEO title? I'm a little confused as to where you used your code.

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