Add custom field to post

Posted in: Newspaper
Post count: 14

I have added 2 custom fields to posts. I added <?php the_field(‘Country’);?> on single.php to display the fields on top of the post. But it does not show

Post count: 35449

Hi,

If you refer at this custom fields -> https://www.screencast.com/t/ErHccG9IP then you can be used to add extra metadata to a post not to add extra fields on the post.
Here is the WordPress documentation for Custom Fields -> https://codex.wordpress.org/Using_Custom_Fields

Thank you for your understating!

Post count: 14

I added 2 fields with advanced custom fields. I know this is the php to show the field. I just need the correct file to edit so that the field shows when the user views the post

Post count: 35449

Hi,

So I add 2 elements in custom fields -> https://www.screencast.com/t/y44OJzJfV7KE I have set post template 1 on this post -> https://www.screencast.com/t/1xTy1WPeXx3 so I need to add the code in loop-single-1.php -> https://www.screencast.com/t/n5oPBeQZkX4 the path is wp-content/themes/Newspaper/loop-single-1.php the results https://www.screencast.com/t/V1Rp7ifzZw

So you need to edit the loop specific to your post template form that post.

Hope this will help you!
Thanks.

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.