• 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

get_theme_mod vs get_theme_mods

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 › get_theme_mod vs get_theme_mods

This topic is: resolved

Tagged: customizer, get_theme_mods

  • This topic has 2 replies, 2 voices, and was last updated 5 years, 11 months ago by johnnya23.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • February 8, 2020 at 11:02 am #496568
    johnnya23
    Member

    It seems that using get_theme_mods and pulling from the array would make sense if you had a lot of mod entries you wanted to incorporate, but values drawn with get_theme_mods do not update in the customizer. though they do work as expected on the live site.

    This doesn't make a lot of sense since get_theme_mod uses get_theme_mods

    
    $css = array(
        array(
            'selector' => 'h1,h2,h3,h4,h5,h6',
            'color' => get_theme_mod('jma_gbs_site_title_color')
        ),
        array(
            'selector' => 'body',
            'color' => $mods['jma_gbs_site_font_color'],
            'font-size' => $mods['jma_gbs_site_font_size']
        )
    );
    

    the above is css.php the title color changes in customizer, but the body color does not (neither does the size).

    this code is called here:

    
    function jma_gbs_header_css()
    {
        $mods = get_theme_mods();
        require_once(JMA_GBS_BASE_DIRECTORY . 'jma-css/css.php');
        echo jma_gbs_process_css_array($css);
    }
    add_action('wp_head', 'jma_gbs_header_css');
    

    obviously both are processd identically.

    February 8, 2020 at 9:33 pm #496573
    Brad Dalton
    Participant

    Which theme is this for?


    Tutorials for StudioPress Themes.

    February 10, 2020 at 4:22 pm #496626
    johnnya23
    Member

    It's a custom child theme. I don't think the issue is really Genesis related, I have tried the same code in both a theme and a plugin with the same results...

    get_theme_mod updates in the customizer, get_theme_mods (then using the value from the resulting array) does not. But get_theme_mods code does implement the change as expected on the live site.

    Since I plan to have a reasonably high number of calls to get_theme_mod and each call results in a db hit it seems much more efficient to use get_theme_mods and get all the data from the db at once. Make sense?

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘get_theme_mod vs get_theme_mods’ 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