Forum Replies Created
-
AuthorPosts
-
May 17, 2017 at 5:30 am in reply to: Problem displaying shortcodes on Genesis Custom Post Type Archive Pages #206590AleksandrMember
Thanks James, this works fine.
May 16, 2017 at 5:46 am in reply to: Add new options field to Genesis custom post type archives #206527AleksandrMemberA 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.
May 9, 2017 at 1:20 am in reply to: Add new options field to Genesis custom post type archives #206145AleksandrMemberHi 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 8, 2017 at 6:37 am in reply to: Add new options field to Genesis custom post type archives #206096AleksandrMemberHi 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.
AleksandrMemberThanks Victor and Brad. A shortcode is exactly what I need. It needs to output the custom field in a way similar to Brad's example.
Brad, I notice that in your example you use get_post_meta function, which is a WordPress function. I used the genesis_get_custom_field('field_name') function. Your way seems better because it is based on core functionality - am I correct in this?
In this case I need this output on a custom post type, so the get_post_meta did not work (I am guessing that was the reason). Do you know of the recommended WordPress way to get metadata for custom post types?
-
AuthorPosts