Get custom fields for pages


To get values of custom fields from a post we use get_post_meta() but it doesn’t work for pages. get_metadata function has to be used for that purpose. It will bring custom fields meta data for pages. I used it to get some demo urls for anchors from specific page using this function. Screenshot is given below.

<a class="view-demo" target="_blank" href="<?php get_metadata('post', $post->ID, 'demo_var_url_one' true); ?>" >View Demo</a>


Have fun! 🙂

You may also like

LEAVE A COMMENT

@Asad_Umar یہ ملک خباستدانوں سے بھرا پڑا ہے۔ مجھے اُمیدہے آپ کی پارٹی کچھ اصل سیاستدان اس ملک کودےسکےگی جومحمدعلی جناح سے مجت کرنیوالے ہوں۔

Ways to Lazy Load Images to Speed Up Your WordPress Site https://t.co/hUfKWM0P2x

@Asad_Umar بے شک

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Categories