PHP beginner here.

I purchased the Fluent-Framework plugin, which allows me to easily crease Post Types, Meta Boxes, and Option Pages within my theme. I am having trouble echoing the Meta Boxes, however.

Here are the official documents. My Post Type Name: front_page


<button> <pre><?php print_r ( get_post_meta( $post->ID, 'test', true) ); ?></pre> </button>

The HTML Output:

    <pre>Array ( [text] => This Is A Test ) </pre> 

My Meta (Fluent-Framework):

// $meta
$meta = array();

// $meta $args
$meta['text'] = array(
    'dash_icon' => 'list-view',
    'title' =>  __('Section Options', 'fluent'),
    'description' => __('This allows you to change the general settings for your new Section.','fluent'),
    'context' => 'normal',
    'priority' => 'high',
    'caps' => array(),
    'fields' => array(
        'text' => array(
            'type' => 'text',
            'title' => __('Section Style', 'fluent'),
            'sub_title' => __('Set to small, white, grey, dark, darker, black, or parallax one-four.', 'fluent'),
            'required' => true,
            'description' => __('This is just a text field.', 'fluent'),
            'default' => 'dark',
            'option_name' => 'test',
            'seperate' => true

I need it to return the value of the meta input. Can anyone help me? I'm really lost.

EDIT: Sorry for the 3rd party plugin question... just found out that kind of thing isn't allowed here. :)


  • do this. <button><?php echo get_post_meta( $post->ID, 'test', true); ?></button> – Robert hue Oct 28 '14 at 17:19
  • This echoes "Array" as a string. Close - at least I'm echoing something! Mind helping me further? :) – FlannelBeard Oct 28 '14 at 17:22
  • Try this also. <button><?php echo get_post_meta( $post_id, 'test', true); ?></button>. Where are you using it? Inside or outside the loop. If it returns a array then your post meta contains array. – Robert hue Oct 28 '14 at 17:25
  • Returns blank, unfortunately. It is running inside of my loop. – FlannelBeard Oct 28 '14 at 17:26
  • Okay, it's an array. use this and add output in your question. <pre><?php print_r ( get_post_meta( $post->ID, 'test', true) ); ?></pre> – Robert hue Oct 28 '14 at 17:29

Okay as you added output of array. You can use the following to get the result. This will print the value of test meta key.

<button><?php $my_meta = get_post_meta( $post->ID, 'test', true ); echo $my_meta["test"]; ?></button>

if your meta key is custom-name then you can get it like this.

<?php $my_meta = get_post_meta( $post->ID, 'custom-name', true ); echo $my_meta["custom-name"]; ?>
  • Nope, returns blank. :( I linked the guide but I cannot make sense of it to output what I need. I am following along though, I understand it so far. – FlannelBeard Oct 28 '14 at 17:40
  • I updated my answer, please use this echo $my_meta[test]; – Robert hue Oct 28 '14 at 17:48
  • No echo. I'm trying things and experimenting as you're helping me, but no dice. I really appreciate you helping me, I think we're really close so far. The developer hasn't written me all day, so I'm stuck until we can figure this out. – FlannelBeard Oct 28 '14 at 17:56
  • Although it should work but try adding double quote. <button><?php $my_meta = get_post_meta( $post->ID, 'test', true ); echo $my_meta["test"]; ?></button>. – Robert hue Oct 28 '14 at 18:00
  • 1
    Oh... I had no idea that was not allowed. Whoops! Well, thank you anyway for taking the time. It truly is appreciated. Cheers! – FlannelBeard Oct 28 '14 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.