ThemeShaper Forums » Thematic

Customising a page to display posts from sub-blog in WPMU

(3 posts)
  • Started 11 years ago by dylancoyne
  • Latest reply from dylancoyne
  • This topic is not resolved
  1. Hi,

    I have just started using Thematic and I have to say I am quite impressed. I think I will try to update my existing portfolio site using this theme in the near future.

    The Problem:
    I am used to editing the default WP php files to gain a customised look for my pages etc. However, I have been tasked recently with building a WPMU site which pulls in posts from different sub-blogs on my main blog.

    Each sub-blog has a page setup on the main blog which uses thematic. Now whilst I have got this working by using the following code ( I copied index.php and renamed it as work.php) I wondered if there was a smarter way of achieving the same end using your in-built functions?

    Template Name: work

    global $options;
    foreach ($options as $value) {
    if (get_option( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; }
    else { $$value['id'] = get_option( $value['id'] ); }
    <?php get_header() ?>

    <div id="container">
    <div id="content">

    <?php thematic_navigation_above();?>

    <?php switch_to_blog(2); ?>
    <?php if(have_posts()) :
    $recent = new WP_Query("showposts=8");
    while($recent->have_posts()) : $recent->the_post(); ?>
    <h2 class="entry-title">" title="<?php the_title(); ?>"><?php the_title() ?>
    <div class="entry-meta">
    <span class="meta-prep meta-prep-author">By</span> <span class="author vcard"><?php the_author_link() ?></span><span class="meta-sep meta-sep-entry-date"> | </span> <span class="meta-prep meta-prep-entry-date">Published:</span> <span class="entry-date"><?php the_time('F jS, Y') ?></span>

    <div class="entry-content">
    <?php the_content(); ?>
    <div class="entry-utility">
    Posted in <?php the_category(', '); ?><?php the_tags(); ?><?php wp_list_comments(); ?>

    <?php endwhile; else: ?>
    <h2>No matching results</h2>
    <?php endif; ?>
    <?php restore_current_blog(); ?>

    <?php thematic_navigation_below();?>

    </div><!-- #content -->
    </div><!-- #container -->

    <?php thematic_sidebar() ?>
    <?php get_footer() ?>

    As you can see I am adding a new loop between thematic_navigation_above and ()thematic_navigation_below()

    PS I am using a child theme so would be best to add something to the function.php in there?



    Posted 11 years ago #
  2. Hey there,

    You can filter the index loop in functions.php. See here:

    I'm guessing you'll have to do an is_page check in your function to determine what page you're on, but I think it can be done.

    Of course, having separate page templates works just as well too.

    Posted 11 years ago #
  3. Cool. I will try that tomorrow and let you know how I got on.

    Posted 11 years ago #

RSS feed for this topic


You must log in to post.