NextGEN Gallery
[ SinglePic not found ] in Linkable Title Sidebar PHP widget (1 post)

  1. quantum0d0
    Posted 3 years ago #

    Hi! Let me be the first to say I may not know what I'm doing exactly - but I've been pulling my hair out for days over this and I can't find just the answer I need ANYWHERE. I'm hoping someone here can help.

    For certain reasons, the NextGEN Widget won't work for me. I want to show a Photo of the Day in the sidebar, and I want to include the ID of the photo in a post in the Photo of the Day category - so I can control what photo is used each day. Also so I can just change the custom field on that one post each day.

    So, I got myself the Linkable Title HTML and PHP widget and I put this in it:

    global $wp_query;
    global $post;
    $tempWPQuery = $wp_query;
    $wp_query = null;
    $wp_query = new WP_Query();
    $wp_query->query( "posts_per_page =-1, category_name=MCPics" );
    while ($wp_query->have_posts()):
    if ( get_post_meta($post->ID, 'potd_id', true) ) {
    $potd_id = get_post_meta($post->ID, 'potd_id', true);
    <div class="aligncenter" style="margin-right:auto; margin-left:auto; padding:0px;">
    $potd = '[singlepic id='. $potd_id .' w=250 h=250 float=center link=http://www.mamachills.com/category/mcpics]';
    $potd_parsed = do_shortcode($potd);
    echo $potd_parsed;
    $wp_query = null;
    $wp_query = $tempWPQuery;

    This $potd_parsed bit was a shortcut/workaround to using just echo do_shortcode.

    Either way, it works just fine on a page or category php file but in this widget it only gives me [SinglePic not found].

    Has anyone else used a NextGEN Gallery shortcode in a sidebar text widget? I already tried adding add_filter 'widget_text', 'do_shortcode' to my functions.php. That didn't work . . .

    Is this even going to be doable?

    I should mention that I am using an Artisteer theme AND the Templateer add-on.

    But I can get the shortcode to work in the widget if I just go ahead and give it the ID of the picture, which makes me think whatever is going wrong with using get_post_meta has nothing to do with the theme.

    Please help me? I have OCD and this is driving me NUTS!!


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • NextGEN Gallery
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic