WordPress.org

Ready to get started?Download WordPress

Forums

Showing New Posts and Updated Blogs Only on Home Page (6 posts)

  1. b-rad
    Member
    Posted 4 years ago #

    How can I display a list of the X most recent posts from any of the sites within a multisite network on only the main blog's homepage? I'd also like to be able to show a list of the X most recently updated blogs by blog name. I had asked a similar question a few weeks ago and Andrea gave me some code to list the names of updated blogs (http://wordpress.org/support/topic/multi-user-home-page-aggregation?replies=4) however when I add this code to my template it shows up on every blog and not just the main blog's home page. I thought the old version of wpmu had a special template for the main blog home page (home.php?) but when I tried to add this to my template the home.php file shows up for the main blog and every other subblog. Thanks.

  2. No, the home.php was not specific to mu. It's a template file is all. And yes, if all blogs are using the same theme and you add that file, all blogs will get it.

    If you want something on just the main blog, you can use that code as a widget.

  3. b-rad
    Member
    Posted 4 years ago #

    Thanks Andrea. Is there a tutorial on how to create a basic widget to use the code you had given me to display the names of recently updated blogs? Since my widgets are set to display in the sidebar, can a widget be setup to display the recently updated blog list in the main content area of the home page or will it end up in a sidebar with my other widgets? I guess I need a tag to tell me if the page being viewed is the "main" blog's home page.

    Can you tell me how to also display recent posts for all blogs in a multisite setup? Thanks.

  4. yep - http://wpmututorials.com/plugins/build-your-own-widget/

    , can a widget be setup to display the recently updated blog list in the main content area of the home page or will it end up in a sidebar with my other widgets?

    you'd need a widget area in the spot where you want that widget to show. they don't have to be sidebars.

    I guess I need a tag to tell me if the page being viewed is the "main" blog's home page.

    there isn't one.

    Alternatively, you can make a second copy of your theme. use one with the home.php and all the stuff you want on the main site;s home page. use the other one for the remaining blogs.

    Can you tell me how to also display recent posts for all blogs in a multisite setup?

    Depends. :) In a list or full posts, cuz there's two different answers. :)

  5. raskull
    Member
    Posted 4 years ago #

    Doesn't this work?

    <?php
    global $blog_id;
    if ($blog_id == 1) {
       // display this content
    }
    ?>

    Alternately you could create a page template and apply it only to the page you have designated as your front page (assuming you are not using the blog page [index.php] for your front page). Of course anyone using the theme could then apply this template to any of their pages, as Andrea_r indicated, but it would not be automatic.

    Copy the file you are using, hopefully page.php, and rename it myhomepage.php (name it anything BUT home.php). Put this near the top (after the theme info):
    <?php /* Template Name: My Home Page */ ?> (name it anything you like -- this is what will appear in admin in the template pulldown menu in the right column.

    Now you can do what ever you want in this file and it will only affect pages that have opted to use it as a template.

  6. Yeah that works too.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags