Where do I insert advanced custom fields?

Posted in: Newspaper
Post count: 6

Sorry if this has already been covered – i’ve been searching the forums for hours and can’t find my answer.

I have some very simple advanced custom fields which I want to include in a post. In which filed do I put the following code so that it appears under the article content?

<?php $field = get_field($twitter); ?>

Post count: 9544

You would need to insert that into the template file for the module/layout for post page you happen to be using for your site. Look at the files in the root of the theme folder.

eg., if using single template 5 … well, guess which files that would be ? 😉

single_template_5.php
loop-single-5.php

so, if you look at loop-single.5 you might see this

<div class="td-post-text-content">
<?php echo $td_mod_single->get_content();?>
</div>

<div class="clearfix"></div>

<footer>
<?php echo $td_mod_single->get_post_pagination();?>
<?php echo $td_mod_single->get_review();?>
<?php echo $td_mod_single->get_source_and_via();?>
<?php echo $td_mod_single->get_social_sharing();?>
<?php echo $td_mod_single->get_social_like_tweet();?>
<?php echo $td_mod_single->get_next_prev_posts();?>
<?php echo $td_mod_single->get_author_box();?>

And so you might insert your code either in footer area above the post pagination, replace the social sharing element; or after author box … etc.

Often you can test by simply putting some text into a spot in above file, like

<p>Happy Sunday Everybody - this is a test.</p>

and see where that prints on your post page.

Hope that helped 🙂

Post count: 7909

Hi,

Please edit post template that you use an you want this field to appear after the content – http://screencast.com/t/OK8dOkKcVEZ

Thanks!

Post count: 31

Pls Delete this post. Wrong thread.

  • This reply was modified 9 years by Manoel.
  • This reply was modified 9 years by Manoel.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.