Custom Fields: Not showing up on the site page!

0

I have a page with custom fields, so far so good, but when saved on the site does not appear the field, which would be a BLOCK.

Iusedthecode<?phpthe_meta();?>anditappearedso,messy:

I do not know what to do! This site was developed by another professional, I'm trying to make a change, which in my view was simple ... :(

In the home page of the site, the same content appears in blocks, side by side.

I have already looked at the PHP file, I have already looked at everything, and I can not make the content load with the correct formatting.

    
asked by anonymous 13.04.2016 / 23:16

1 answer

1

Friends use this function, put it anywhere in functions.php

function pegar_campo( $field_name, $post_id = false ) {

$value = get_post_meta($post_id, $field_name);

if( is_array($value) )
{
    $value = @implode(', ',$value);
}

return $value; }

This makes it easier to recover from the post, put:

<?php echo pegar_campo('campo', $post->ID); ?>

I use this function in my themes, give it a try

    
13.04.2016 / 23:18