• Hi,

    I am trying to get a function from a template to correctly display in an exec php widget. Here is the example post:

    https://www.kosmograd.net/?p=48

    The idea is to display an image gallery in the widget instead of the body of the post. In the post, you can see the thumbnail grid below the text, and the widget thumbnails at right.

    The images show up. However, it looks like the thumbnail area is not formatting correctly. Firebug tells me that the thumbnail grid in the post area is using the following css values from the theme’s style.css:

    #content .entry-content .gallery
        clear: both;
        display: table;
        margin-bottom: 0;
        padding: 0
        width: 512px;
    }

    This is not showing up in the thumbnails bit in the widget. Now obviously 512px width won’t work in the widget, but I’d still like to be able to configure this.

    I have explicitly called the stylesheet in the plugin/widget code

    wp_register_style('style.css', get_template_directory_uri());
    wp_enqueue_style('style.css');

    I’m not sure it’s relevant, but the function is this:

    <?php global $post; echo do_shortcode('[flickrgallery setid="' . get_post_meta($post->ID, 'per_post_widget_content_value', true) . '"]'); ?>

    As you can see, the thumbnails are showing up in the widget, but not as a grid, as they should. I can’t control the widget or layout of the ul in the widget.

    Any ideas?

  • The topic ‘Code in exec php widget not picking up template stylesheet’ is closed to new replies.