Yes, i put in theme file – under this line:
<?php the_title( ‘<h1 class=”entry-title” ‘ . hybrid_get_attr( ‘entry-title’ ) . ‘>’, ‘</h1>’ ); ?>
….. put your code here….
now for your below comment:
“From what it looks like you put the code into the “Content” WYSIWYG editor for the page. PHP code cannot be edited there. This is why I gave you the link to the shortcode documentation for ACF.”
Your understanding is wrong.
now let me tell you what i did.
****
1. Install ACF
2. Create Group – check screenshot.
3. Put your code in single-content.php under the same line that you are talking.
4. Create new post – new post has option to put the value for subtitle.
5. I put “This is testing subtitle”
6. Published the post.
Now, post has the code as subtitle instead of what i put in subtitle field.
Please give me correct code, so that i have put on subtitle field that value in the post.
I am lost what you are talking about.
i thought below command which you gave – will work as variable.
if (get_field(‘subtitle’)) {
?><h2><?php the_field(‘subtitle’); ?></h2>
}
?>
In previous screen – i put subtitle as “This is subtitle” on subtitle field when creating a post, but when i visit the post – post has code above screenshot code instead of “This is subtitle”
It meant which code you gave is not calling ‘subtitle’ field to display in front-end?
it didn’t call correctly
Please check attachment:
I have completed it on ACF, now i need few lines to put on function.php to make it work on UI.
Please help
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.