Support » Fixing WordPress » "the_meta" call – changes in v3.0.1??

  • i’ve just upgraded a site from 2.9x to 3.0.1 and all’s fine except for a bit of custom code which should display a custom field value as a title in a sidebar (this is via a PHP widget)

    the code is

    <div class="sidebar-title">
    if(is_home()) { $sbtitle=get_post_meta(19, 'sidebar_title'); echo '<h1>'.$sbtitle[0].'</h1>';} else echo the_meta();?>

    the title is still working on the ‘home’ page but not on all other pages (i.e. it seems to no longer like the call to ‘echo the_meta()’. nothing else has changed. any suggestions of how to get this working again? there’s no error message, just nothing displaying. i’ve tried get_post_meta($post_id, ‘sidebar_title’) instead but no luck here either. it only seems to work if specifying the post id directly (as in the ’19’ example above).

Viewing 1 replies (of 1 total)
  • ah, this worked

    global $post;
    echo get_post_meta($post->ID, 'sidebar_title', true);

    seems the ‘global $post’ bit is crucial and possibly a new version 3

Viewing 1 replies (of 1 total)
  • The topic ‘"the_meta" call – changes in v3.0.1??’ is closed to new replies.