Accessing Custom Fields on Pages

Sometimes WordPress is criticized treating everything as a post. The matter of fact is, post type pages, post type post – both are actually Post in database. So no post will collide with any page ID. 🙂

So simply a get_post_meta() is enough.

But if you still want something specific to Pages, you can use:

if( is_page() ) get_post_meta(...);

Yes, you can use get_post_meta() outside the loop. But instead of passing the post_id using get_the_ID() you have to pass the post_id manually.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)