• 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

Add new options field to Genesis custom post type archives

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 › Add new options field to Genesis custom post type archives

This topic is: resolved

Tagged: CPT, CPT settings, Custom fields, Meta box, save_post

  • This topic has 7 replies, 3 voices, and was last updated 8 years, 11 months ago by Aleksandr.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • May 8, 2017 at 5:43 am #206090
    Aleksandr
    Member

    I am trying to add a new setting to the archive page for a specific custom post type. I have been able to add metaboxes to the correct archive page, but do not know how to save the settings values.

    To add metaboxes to the custom post archive page I used this tutorial:
    https://joshuadnelson.com/adding-genesis-cpt-archive-settings-metaboxes/

    I created a custom field using WordPress' built-in Custom Fields settings, but cannot read that field in the archive. I am guessing that this is because the field needs to be created specifically for the settings page.

    Does anyone know how to create a new archive setting?

    May 8, 2017 at 5:51 am #206092
    Victor Font
    Moderator

    If you added everything correctly, the saving should be automatic when you save the post. Examine the WordPress post_meta table for the saved values. The archive page won't display a custom field unless you customize the archive template with genesis_get_cpt_option.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    May 8, 2017 at 6:37 am #206096
    Aleksandr
    Member

    Hi Victor,

    I am still stuck. I definitely don't think that I added everything that's necessary. I only added the metaboxes to the CPT archive, but no saving routine yet. I cannot see the saving routine in the example that I posted and have not found any other references on how to do this.

    Are there references on how to add new settings fields to Genesis CPT archive pages?

    The genesis_get_cpt_option is what I hope to use in my theme. But, like I said, at this time there is no 'key' for it to get a setting value from and I do not understand how to create this key.

    May 8, 2017 at 7:05 am #206107
    Victor Font
    Moderator

    As I said earlier, saving is automatic. There is no saving routine to add. Check the post_meta table.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    May 8, 2017 at 2:44 pm #206131
    Brad Dalton
    Participant

    There's a few steps he's missed.

    I assume you've hooked in the HTML for the input form correctly and now you need to save the data so you can output somewhere. Whats the box for?

    You need to use save_post to save the input data.

    Genesis also uses its own function for different checks which is called genesis_save_custom_fields.

    Once you save the input data correctly, you can then call it anywhere in a custom function with hook or function call in template file.

    The only time you don't need to save the data is when using the custom field boxes native to WordPress as these already use save_post.

    Note : Genesis has updated the file structure for meta boxes and rewritten the code which now uses new functions so the code you linked to is now outdated.


    Tutorials for StudioPress Themes.

    May 9, 2017 at 1:20 am #206145
    Aleksandr
    Member

    Hi Brad and Victor,

    I have yet to figure this out, so any help is appreciated.

    To confirm, I am trying to add a new setting to the Custom Post Type Archive Settings Page.

    The setting will be for a eur_in_usd exchange rate that the user will manually set. This eur_in_usd value will be used to convert listing prices from Euros to USD for front-end display. The custom post type is for 'real-estate', and has an additional field for prices. The custom post type and the prices field work fine.

    Because the same value for eur_in_usd is relevant for all listings I thought that the best place to add it to is the real-estate archive page settings (genesis-cpt-archive-settings-real-estate).

    My confusion is around the way to add this setting. In the example I referenced I do not see any function that saves the output. I am guessing that it is done automatically as part of 'Save Changes' procedure on the Archive settings page. Although I have not been able to find any documentation on this.

    I am also unable to see any function that adds this option to the array.

    From my assumption, I guessed that the HTML form name determines which setting to update. Please confirm if anything else is necessary to add eur_in_usd to the settings array and to update it.

    The current form looks like:

    <label for="' . GENESIS_CPT_ARCHIVE_SETTINGS_FIELD_PREFIX . 'real-estate[eur_in_usd]">1 EUR in USD: </label>
    <input type="number" step="0.000001" name="' . GENESIS_CPT_ARCHIVE_SETTINGS_FIELD_PREFIX . 'real-estate[eur_in_usd]" value=""/>

    I have used the location of the settings ("' . GENESIS_CPT_ARCHIVE_SETTINGS_FIELD_PREFIX . 'real-estate") to echo currently existing settings with genesis_get_cpt_option (and genesis_get_option). Using phpMyAdmin I am able to see the current options for genesis-cpt-archive-settings-real-estate, and nothing that I have done so far added the eur_in_usd to the array.

    May 9, 2017 at 2:38 pm #206207
    Brad Dalton
    Participant

    Saving the data is not done automatically. In your case, the easiest solution is to use a plugin like ACF otherwise you require advanced coding skills.


    Tutorials for StudioPress Themes.

    May 16, 2017 at 5:46 am #206527
    Aleksandr
    Member

    A follow up on this post.

    I did figure out that the problem was to do with my naming convention for the post type. I called it real-estate. When I renamed the post type as well as anything that mentioned it the settings page started working flawlessly. My guess is that the - in the middle caused some problems.

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘Design Tips and Tricks’ 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