The value of $meta is an array. To find out what it contains add var_dump( $meta ); before the echo and you will get the contents of the array.
@chris Nice! Now how can I strip out everything that var_dump($meta); returns and only echo the text?
Post the result of the var_dump. It it’s indexed it will be something like echo $meta[0]; Where 0 is the index of the text.
<?php
$meta = $custom_metabox->the_meta('description', TRUE);
if (!empty($meta)):
var_dump($meta);
echo '<p class="description">'.$meta.'</p>'; ?>
<?php endif; ?>
Returns:
<pre class='xdebug-var-dump' dir='ltr'>
<b>array</b> <i>(size=1)</i>
'description' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'This upright formal script was inspired by the 1960's and <a href="http://doyaldyoung.com">Doyald Young</a>.'</font> <i>(length=108)</i>
</pre>
My Goal Output:
<p class="description">This upright formal script was inspired by the 1960's and <a href="http://doyaldyoung.com">Doyald Young</a></p>
Changing the echo line to:
echo '<p class="description">'.$meta['description'].'</p>'; ?>
Should work.
To get a better understanding how Arrays work see: http://php.net/manual/en/language.types.array.php
Thanks, Chris. I appreciate your time and thanks for the link as well.
I removed var_dump() and it seemed to work.
Final Code:
<?php
$meta = $custom_metabox->the_meta('description', TRUE);
if (!empty($meta)):
echo '<p class="description">'.$meta['description'].'</p>'; ?>
<?php endif; ?>