Skip to:
Content
Pages
Categories
Search
Top
Bottom

Displaying Custom Fields in Home Widgets

  • @coolgates

    Participant

    Is there a way to echo custom fields (those found within posts) in the home widgets (located in bp-blogs-widgets.php)?

    e.g. how can I make this work?

    <?php echo get_post_meta( $post->ID,”screenshot_url”, $single=true ) ; ?>

    Any help or leads would be greatly appreciated.

Viewing 1 replies (of 1 total)
  • @burtadsit

    Participant

    The recent blog posts widget displays posts from all public blogs which means if you just do get_post_meta() you’ll get the meta from the current blog. Not exactly what you are interested in. There’s a bp template tag to get just about everything else but the meta data. So you have to temporarily:

    switch_to_blog( $post->blog_id );

    $post_meta = get_post_meta(<your params>);

    restore_current_blog();

    Then do whatever you want with the $post_meta value you just retrieved.

Viewing 1 replies (of 1 total)
  • The topic ‘Displaying Custom Fields in Home Widgets’ is closed to new replies.
Skip to toolbar