How can i retrive a text from a custom field

I’m not certain what an empty get_field returns, as it’s from a plugin. However, assuming it provides FALSE or an empty string: <?php $data = get_field( ‘data_nasterii’ ); echo ( $data ? date( “d/m/Y”, strtotime( $data ) ) : ‘N/A’ ); ?>

Get post meta retrieving wrong value

Please take some time to read the Codex. the_ID echos content. That means that the ID is never being passed to get_post_meta. It is just echoed in place. From the same Codex Page: Note: This function displays the ID of the post, to return the ID use get_the_ID(). So, use get_the_ID instead. Second problem… quote … Read more

Displaying custom filed content instead of post content

You just need to check for that custom field and return that instead of post content. function displayCustomContent() { if (!is_front_page()) return $content; // how to replace main post content with custom content ? global $post; $special_content = get_post_meta($post->ID,’page_builder’,true); if (!empty($special_content)) { // remove_all_filters(‘the_content’); return $special_content; } return $content; } The only other thing you … Read more