Wordpress - How to get Custom Fields value in theme

0

Speak up!

I'm a beginner on Wordpress and I came across a problem.

I'm trying to get the value of a Custom Field that has in wp-admin called Client Link, there in the site plugin in the metaboxes declaration, it is declared as follows:

$metaboxes[] = array(

            'id'            => 'detalhesMetaboxCliente',
            'title'         => 'Detalhe do cliente',
            'pages'         => array( 'cliente' ),
            'context'       => 'normal',
            'priority'      => 'high',
            'autosave'      => false,
            'fields'        => array(

                array(
                    'name'  => 'Link do cliente: ',
                    'id'    => "{$prefix}cliente_link",
                    'desc'  => '',
                    'type'  => 'text'
                ),

            ),

        );

And do not worry, to find the registered Client, you are like this:

$clientePost = new WP_Query( array( 'post_type' => 'cliente', 'orderby' => 'id', 'order' => 'asc', 'posts_per_page' => 0 ) );

while ( $clientePost->have_posts() ) : $clientePost->the_post();
   // pega a foto do cliente
   $foto = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );
   $foto = $foto[0];
   // pega o link
   $link = get_post_meta($post->ID, 'Maiacliente_link', true);
   echo $link;
endwhile; wp_reset_query();

The problem is that I can not get the link, the value is coming empty. What am I doing wrong?

    
asked by anonymous 24.06.2017 / 22:18

0 answers