Custom fields howto? Any help?

Posted in: Newspaper
Post count: 25

Hi, we would like to add a “Address” and “Phone” field in our category “Hotels” … So when we add a new item we can simple fill in this fields instead of typing it in the editor (description field)
These fields need than to be shown underneath the description field content on the item view…

Can someone explain how we can achieve that?

Post count: 20688

Hi,

You could use custom fields to display that information in the post page. Like in this example
https://www.screencast.com/t/7wBdSz3a9
Edit the post template file used like this (in the example I used post template 12->loop-single-12.php)
https://www.screencast.com/t/sF9iwk36Tr

<p>Adress:<?php echo get_post_meta($post->ID, 'Adress', true); ?></p>
<p>Phone:<?php echo get_post_meta($post->ID, 'Phone', true); ?></p>

The result is like this – https://www.screencast.com/t/rHHtpD5c3a
More about it here – http://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/

Thanks

Post count: 25

Hi @Simion C. Great that works… However i use Advanced Custom Fields, can you give me an example how the link should be formated than? I tried
<p>Adress:<?php echo get_field, ‘Adress’, true); ?></p>

But that is not working,
Many thanks! 🙂

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