WordPress.org

Support

Support » Plugins and Hacks » Gallery - Gmedia Photo Gallery. Music Player, Video Gallery, Media Library » Using custom fields to display gallery in sidebar as a widget

Using custom fields to display gallery in sidebar as a widget

  • I have a wordpress site, which im building to show off a few real estate properties. Each property is given its own page. I would like to utilize the sidebar to put page-specific galleries on each of the property pages.

    I have tried using NextGen gallery…but all that happens is the actual shortcode displays (ex: [gallery id=1]) in the sidebar, rather than the gallery. I have tried adding code to my functions.php, page.php, and sidebar.php files. Nothing has worked.

    To be honest, NextGen support has been non existent, which is beyond frustrating. I really want to try something different. Hopefully you can be of assistance, and will tell me that Gmedia Gallery (or another product you develop) is the right choice for me.

    Thanks so much.

    http://wordpress.org/extend/plugins/grand-media/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Rattus

    @pasyuk

    How to use shortcodes within a WordPress Text widget:
    At the end of theme’s “functions.php” file, add the following code:

    add_filter( 'widget_text', 'shortcode_unautop');
    add_filter( 'widget_text', 'do_shortcode');

    Now you can add shortcode to your Text widget and it should work.

    Another way to add shortcode right in theme’s sidebar.php:

    <?php $shortcode = '[shortcode here]';
    echo do_shortcode($shortcode); ?>

    If you know PHP you can use post’s custom field to make sidebar shows different gallery on different pages.

    I’m by no means a php guru, but I do feel comfortable adding code here and there. Based on the code you provided above, I can add shortcode to the text widget, however I still cannot show different galleries on different pages. I was really hoping to use the WordPress Custom Fields to do this.

    Please see my screen shot : here

    When I create the Custom Field “gallery”, I can then add a Custom Field Widget and call it “gallery”. It will then display a page specific gallery on each page (well thats what I want at least…)

    I’m not quite sure how I can tweak the code you provided above to get this to work :-/

    By the way, thanks so much for the quick response

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using custom fields to display gallery in sidebar as a widget’ is closed to new replies.
Skip to toolbar