ThemeShaper Forums » Thematic

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

(3 posts)
  • Started 10 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?

    <?php
    /*
    Template Name: work
    */
    ?>

    <?php
    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() ?>
    </h2>
    <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>

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

    <?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?

    thanks

    d

    Posted 10 years ago #
  2. Hey there,

    You can filter the index loop in functions.php. See here: http://forums.themeshaper.com/topic/can-i-replace-the-loop-with-a-filter#post-4970

    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 10 years ago #
  3. Cool. I will try that tomorrow and let you know how I got on.

    Posted 10 years ago #

RSS feed for this topic

Reply

You must log in to post.