11.11.14 Custom Fields
11.11.14 Custom Fields
http://wpsites.net/web-design/list-of-genesis-hooks/
http://genesistutorials.com/visual-hook-guide/
Here’s some code you can modify to displays the output of your custom fields simply by changing the hook position and conditional tag http://wpsites.net/web-design/how-to-create-a-custom-field/
The field name will need to match what you use in the ACF plugin settings.
add_action( 'genesis_entry_header', 'custom_field_before_content', 15 );
/**
* @author Brad Dalton
* @example http://wpsites.net/
* @copyright 2014 WP Sites
*/
function custom_field_before_content() {
if ( is_singular(array( 'post', 'page')) && genesis_get_custom_field(‘field-name') ) :
echo '<div class=“field-name>'. genesis_get_custom_field('field-name') .'</div>';
endif;
}
* * * * * * * CODE EXAMPLES * * * * * * * * * *
http://sridharkatakam.com/page-specific-html-header-right-widget-area-genesis-using-advanced-custom-fields/
* * * * * * *
For example if you're using a hook and you want to put it in your header, you could do something like:
add_action('genesis_header', 'add_content_to_header');
function add_content_to_header() {
echo get_field('my_textarea_field');';
}
* * * * * * *
http://kevinshoffner.com/wordpress/genesis/displaying-custom-fields-for-genesis/
/* Custom Fields
*/ by: kevin shoffner
*/
add_action('genesis_post_content', 'field-name');
function field-name() {
if ( is_single() && genesis_get_custom_field('field-name') )
echo '<hr /><div id="field-name">Title: '. genesis_get_custom_field('field-name') .'</div>';
}