The MU forums have moved to WordPress.org

Integrating WPMU with existing site (11 posts)

  1. wclark
    Member
    Posted 13 years ago #

    Hi All,

    I have WPMU set up for subdirectories.

    All seems to work great.

    My sites are all vhosts using domain name translation.
    I see my main php site at http://www.mydomain.com
    I see my subdomain sites at site1.mydomain.com and site2.mydomain.com

    I see my main blog at blogs.mydomain.com
    I see my subdomain blogs at blogs.mydomain.com/site1 and blogs.mydomain.com/site2

    Now I want to add a code block to site1 to show the latest 3 posts. So I added the following to the top of the index page for site1:

    <?php
    require('/home/wordpress-mu/htdocs/wp-blog-header.php');
    ?>

    And this code inside a <div> further down the page:

    <?php query_posts('showposts=3'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a><br />
    <?php endwhile;?>

    When I go to site1.mydomain.com I expect to see my index page and the last 3 posts inside my div. But instead, I get redirected to blogs.mydomain.com/

    This happens before the page ever gets to the query_posts function.

    Any ideas or suggestions would be greatly appreciated.

    thanks!
    Bill

  2. wclark
    Member
    Posted 13 years ago #

    Hi All,

    I did a fresh install of WP3.0 and I get the exact same problem. I bet I am missing something basic. Can someone point me in the right direction?

    thanks!
    Bill

  3. andrea_r
    Moderator
    Posted 13 years ago #

    @wclark - the OP is making custom queries to pull posts.

  4. wclark
    Member
    Posted 13 years ago #

    Hi andrea_r,

    The page is not getting to the code in the div. Somewhere inside the require wp-blog-header line, the page is re-directed to blogs.mydomain.com

    If you want real urls:
    This all works:

    php sites at http://www.mobilitysales.com (this will re-direct to a sub-site based on geographic location)
    sub-sites are like rapid-city-sd.mobilitysales.com

    main blog at blogs.mobilitysales.com
    sub-blogs at blogs.mobilitysales.com/rapid-city-sd

    When I go to rapid-city-sd.mobilitysales.com then that index page loads.

    Here is what does not work:

    When I add

    <?php define('WP_USE_THEMES', false);
    require('/home/wordpress/wp-blog-header.php');
    ?>

    to the top of rapid-city-sd.mobilitysales.com/index.php, then the page redirects to blogs.mobilitysales.com instead of displaying rapid-city-sd.com/index.php.

    I hope that makes my problem clear.

    Any help is very greatly appreciated.
    Bill

  5. andrea_r
    Moderator
    Posted 13 years ago #

    gah, I read your second post as a different user. sorry.

    you've got a lot going on with domains, subdomains and subfolders. Which one is the actual home of the WPMU site?

    And what problem are you trying to solve? I suspect there's an easier way to do what you want than what you're doing.

  6. wclark
    Member
    Posted 13 years ago #

    The home of the WPMU site is blogs.mobilitysales.com.

    My existing main website is http://www.mobilitysales.com.

    The other 200 minor sites are like rapid-city-sd.mobilitysales.com

    I want the main site to have its own blog.
    I want each of the 200 sites to have their own blog.
    I believe that this part is working.

    For instance, Go to blogs.mobilitysales.com to see the main blog. Go to blogs.mobilitysales.com/rapid-city-sd to see one of the minor blogs.

    Here is what I want to do:

    Display the latest 3 blog posts for each minor blog somewhere on it's existing index page.

    Display an aggregate of all minor blog posts on the main site index page.

    That's it!

    Thanks for taking another look.

    best regards,
    Bill

  7. andrea_r
    Moderator
    Posted 13 years ago #

    Display the latest 3 blog posts for each minor blog somewhere on it's existing index page.

    Okay, this one is easy, as it's the exact same process as it would be in single WP. And you have choices.

    Set the posts-per-page option to 3. (Settings -> Reading)
    or
    change the theme template to a custom query. (there's a codex page on this)

    Display an aggregate of all minor blog posts on the main site index page.

    Get the plugin I am constantly recommending for this.
    http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/

    Set up a tags blog, pull that feed to display where you want.

    Or, use this:
    http://1uthavi.adadaa.com/ada-wpmu-sitewide-feed-plugin/

    And all you'll need is code in your other page to parse an RSS feed.
    (not WP specific)

  8. wclark
    Member
    Posted 13 years ago #

    Hi andrea_r,

    My index page is not done with WordPress. It is an existing php website. How can I just insert the last 3 posts inside a <div> on my existing index page?

    I will look into the plug-in to get the aggregate listing...

  9. andrea_r
    Moderator
    Posted 13 years ago #

    My index page is not done with WordPress. It is an existing php website. How can I just insert the last 3 posts inside a <div> on my existing index page?

    and I said

    all you'll need is code in your other page to parse an RSS feed.
    (not WP specific)

  10. wclark
    Member
    Posted 13 years ago #

    Thanks for the reply.

    I thought that the RSS Feed was to be used to display the aggregate listing.

    What I wonder is how to display the last 3 posts inside a <div> on my existing (non-wordpress) php index page.

    confused,
    Bill

  11. andrea_r
    Moderator
    Posted 13 years ago #

    You could do it in the same way if it's outside WP.

About this Topic