Home › Forums › General Issues › Shortcode to include label and value › Reply To: Shortcode to include label and value
Sorted this myself.
For the record I have created a shortcode.php file and called it from functions.php
It was quite easy once I understood. This is the type of code I used
function cultivar_name() {
if(get_field(‘cultivar’)){
$field_name = “cultivar”;
$field = get_field_object($field_name);
echo ‘‘, $field[‘label’],’‘ . ‘: ‘ . ‘<div class=”headlinename”>’, $field[‘value’],'</div>’,'</br>’;}
}
add_shortcode( ‘cultivar’, ‘cultivar_name’ );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.