ThemeShaper Forums » Thematic


different sidebar on each page

(4 posts)
  • Started 11 years ago by dv1961
  • Latest reply from dv1961
  • This topic is not resolved
  1. dv1961

    Hi there,
    I’m trying to use wordpress and thematic as a CMS in which the blog page would be used as a news page. Most of the site will be static pages.

    Problems is, I’d like to have different images in the sidebar on most pages, can this be done?

    I reasonable good with css but a novice with php. Any ideas?
    Thanks John

    Posted 11 years ago #
  2. @dv1961: I think there are probably multiple ways to approach this, but one way I think you could consider is to either create a custom sidebar (and the code sample below?) or use e.g. PHP Code Widget and the same code sample below to Showing Attachments for the Post

    Sort of copy/paste from Codex

    global $post;
    $args = array(
    	'post_type' => 'attachment',
    	'numberposts' => -1,
    	'post_status' => null,
    	'post_parent' => $post->ID
    $attachments = get_posts($args);
    if ($attachments) {
    	foreach ($attachments as $attachment) {
    		echo the_attachment_link($attachment->ID, false);

    This seems to display the attached content in the sidebar very easily but will need to be modified further to display more images etc.

    Am sure there will be other suggestions! :)

    p/s: A few other reference sites for further development

    Posted 11 years ago #
  3. This is a bit of a rambling post...

    On further experimentation, you could consider using the inbuilt [gallery] shortcode to help with displaying post images:

    Add to child theme functions.php

    //This adds Post-Thumbnail support
    if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
    	add_theme_support( 'post-thumbnails');
    // This allows shortcodes to work in widgets
    add_filter('widget_text', 'do_shortcode');

    And in a typical text widget add:


    Then you would upload images as normal when writing a post (so that it becomes attached as a Gallery) and it will display all the attached images in the sidebar. The default shortcode isn't very customisable so you could consider using another plugin that extends the functionality.

    One issue occurs when trying to use the same image in different posts; I only found out just now that a 'feature' (or liability?) of native WP media handling is that once an image is attached to a post, it can't be attached to another post, unless you upload that same image again or detach it.

    There seem to be at least two plugins built to get around this: Media Library Plus plugin and (currently-alpha-beta) File Gallery.

    Posted 11 years ago #
  4. dv1961

    Thanks for getting back to me. As I said, I'm something of a novice with php so give me a few days to digest all this and I'll let you know how I get on

    Posted 11 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.