WordPress.org

Ready to get started?Download WordPress

Forums

Linking between sites (11 posts)

  1. winmadden
    Member
    Posted 3 years ago #

    Disclaimer: This is my first post and I am very new to web development in general, let alone WordPress/Multisite development.

    I have a home page(run on WP) and 3 separate blogs linked to this page using multisite to create a small network. I understand that(through multisite) only one install of WP runs natively and the other 3 are running virtually. I have two questions...

    I notice that all the blogs share the same php template files. I would like to have different pages display different links in the main nav menu. For my main site I created pages and linked them using the inlcude() function. In my sub-sites the pageIDs from my main site are not recognized, so this method does not work. I'm not sure how to link to these pages and have it correctly displayed/styled in my main navigation menu.

    Short Version: How can I link pages between the few blogs I have created through multisite and have it displayed properly in my nav menu?

    Second question: Should I be using Multisite to run only 4 blogs?

    I will be managing the main blog as well as two others and the remaining blog will be managed by a friend. I want to keep this as simple as possible. Incase I have been unclear; all I want to do is run a small site with a few separate blogs managed individually, mainly by myself... multisite or simpler, smaller scale solution?

  2. theotherlebowski
    Member
    Posted 3 years ago #

    my best suggestions would be to install the same theme on all of the blogs in your network then in each blog create a menu in the appearance section of your admin dashboard and create a series of absolute links (http:// type links) that link back to the main site (this will take visitors back to the main site to view the page though).

    or your other option is to copy and create the same pages in all of the blogs so you have access to them in any blog. i'm sure there's a more elegant code hack to get it done and while i know some php it's way beyond me...

    if i were running a few blogs then i'd go multisite just to cut down on the number of times and places you have to upgrade things. it's a very good way of streamlining your work flow.

  3. It's a very simple code hack, actually.

    Make a menu in blog #1 called mainmenu or such, and then you call it in your theme like so:

    <?php switch_to_blog(1); ?>
    <?php wp_nav_menu( array( 'menu' => 'mainmenu' )); ?>
    <?php restore_current_blog(); ?>

    As for question two, I use multisite to run three (and on another site 6) separate blogs, where I WANT them separate :) So ... if you wanna, sure.

  4. theotherlebowski
    Member
    Posted 3 years ago #

    i knew there was a php way to do it :D i wish i was more logical and then i could actually understand web programming! design coding i can do, the business logic is where i fall over on my face...

  5. It just takes practice and knowing what docs to read :) Don't worry, we all start with 'Okay, I want to pull Foo from X. How do I do that?' You work your way to psudeo code:

    Go to Blog 1
    Get menu
    Print on Blog 2-n

    And then you start googling how to get to blog 1 for ONE line of code and it all comes together.

  6. theotherlebowski
    Member
    Posted 3 years ago #

    when i've got more free time i'll get back into it. even though it was frustrating and tricky it was fun :D

  7. winmadden
    Member
    Posted 3 years ago #

    Hey, thank you both for your input! I will play with these solutions and report back. Again thanks for taking the time here.

  8. winmadden
    Member
    Posted 3 years ago #

    Okay, I have been able to integrate the code ipstenu suggested and both of your feedback has helped me to better understand this linking process. However, I am still having a hard time wrapping my head around the use of pages through multisite. If either of you guys could find time to help me out that would be awesome.

    How is this process of sharing page templates through my various sites actually working? I know I am missing something major in understanding how this works because I don't get how I am supposed to edit one blogs structure without affecting the others in my network. This seems anti-intuitive to me as I assume most people using multisite WANT to have completely different sites.

    Is there a better/more efficient solution(maybe through php?) than creating page templates for every different page throughout my various blogs?

  9. How is this process of sharing page templates through my various sites actually working?

    They are physically using the same exact files. And of the php calls within those files looks up the specific blog info in the database.

    Why are you creating different page *templates*? You only need to type in different content within the admin area to show what you want on a page.

  10. Also a link to your sites & page you're making would help.

  11. winmadden
    Member
    Posted 3 years ago #

    I was thinking of creating alternate page templates as a solution to displaying each blog a bit differently.

    As a hypothetical example, I want one index page to have a side bar and the index page of another blog(I realize they are using the same "physical" index file) to exclude the side-bar. If I remove the <?php get_sidebar(); ?> from the index.php file all blogs are affected rather than just the one(s) I want.

    I realize I may be over complicating things, but I appreciate the help!

    Here's the site, very rough, still just trying to get a skeleton in place with all pages and navigation set up correctly.

  12. winmadden
    Member
    Posted 3 years ago #

    I was thinking of creating alternate page templates as a solution to displaying each blog a bit differently.

    As a hypothetical example, I want one index page to have a side bar and the index page of another blog(I realize they are using the same "physical" index file) to exclude the side-bar. If I remove the <?php get_sidebar(); ?> from the index.php file all blogs are affected rather than just the one(s) I want.

    I realize I may be over complicating things, but I appreciate the help!

    Here's the site, very rough, still just trying to get a skeleton in place with all pages and navigation set up correctly.

Topic Closed

This topic has been closed to new replies.

About this Topic