WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Understanding File & Folder Structure (18 posts)

  1. coreymj78
    Member
    Posted 2 years ago #

    I don't get it. I installed WordPress Multi site and I'm now working on designing the first client sub domain site using Headway, etc. But this is what I don't understand:

    Even though I have a site at http://www.subdomain.domain.com
    and the main root site at http://www.domain.com

    I don't understand how to access individual site pages. Like how would I access the index.php file of the sub domain site as opposed to the root site?

    Also, I eventually may need to be able to copy / export an entire client sub domain site. Is that only possible through the WordPress Admin area? Because I am not seeing a sub folder with the sub domain site inside of it.

    How does this work?

  2. coreymj78
    Member
    Posted 2 years ago #

    Ok, I just read that the sub folders in a multi site install are basically virtual, meaning that a multi site install is simply a single installation of WordPress with multi site functionality (which is what I had originally thought) but then I kept asking myself, well then how would one go about adding custom php to a single page on one of the sub domain sites for example? If one never has actual physical access to separate php files for each sub domain site, then wouldn't this be impossible? If so, then how would one go about doing this?

    What I need to do for example, is tell WordPress to show breadcrumbs on the home page. I have designed a cool CSS breadcrumbs bar and it shows up on other pages, but need it to show up on the home page, but the method I looked up said I needed to add a php call to show breadcrumbs on the home page, but that it needed to be added to the actual home page, which in a multi site intall, I suppose I don't have physical access to.

    Any advice? Thanks.

  3. They're not basically virtual, they are virtual :) The only folders that exist are the ones in blogs.dir.

    Adding files like that just to ONE site is much harder on MultiSite.

    Can you make your breadcrumbs bar into a plugin or a part of the theme?

  4. coreymj78
    Member
    Posted 2 years ago #

    I suppose what you are suggesting is to simply add the same CSS for the breadcrumbs bar to the homepage (using the CSS class and page ID to single the home page out), even though it's not the actual breadcrumbs function showing up? Or maybe I could use Headway to add a little horizontal leaf under the navigation that would contain the same CSS bar to make it look like the other pages. It would be a lot simpler if there was a way to simply tell the breadcrumbs to appear on the home page.

    Is there no way to tell them to show up? How in multi site could I use a hook? Is there no way to edit individual pages of a sub domain site's pages in multi site?

  5. darichardson
    Member
    Posted 2 years ago #

    Corey, I'm not really much of a PHP developer, but you'll probably need to use some built-in WordPress hooks like is_frontpage().

    Maybe something like:

    global $blog_id;
    if( is_frontpage() && ($blog_id == 2) ) {
    //insert special CSS/HTML here
    }
    else {
    //insert CSS/HTML for regular pages here
    }

    Someone else can probably take that code a little further, but that's the gist. You would change the number of after blog_id == to whatever it should be. This would need to go somewhere in the template that you are using.

  6. It would be a lot simpler if there was a way to simply tell the breadcrumbs to appear on the home page.

    They do on my theme, which is on a MultiSite install. Which makes me think this is actually a THEME problem. The theme itself should be edited to show breadcrumbs, but you may have to ask Headway how to do that. They're supposed to be dynamically generated by the page, or rather they are when I've seen them, so you just ... turn it on and edit the theme to show them on the front page (which tends not to show breadcrumbs as it's the start of the trail).

  7. darichardson
    Member
    Posted 2 years ago #

    Which makes me think this is actually a THEME problem. The theme itself should be edited to show breadcrumbs, but you may have to ask Headway how to do that.

    Exactly. You need to edit the theme (or have someone do it for you) as it was probably designed this way intentionally. The code I provided above would be something that you could replace on the current theme, probably in something like body.php or page.php (or maybe header.php, depending on how the theme was set up) wherever the breadcrumbs code currently is.

    If you're using a separate theme than the one from your main domain, you shouldn't need to worry about the code above even, you'd probably just need to remove some code so that the breadcrumbs display on every page.

    You can edit your themes in wp-content/themes.

    If you can't find it, this might need to be moved to a theme/design forum because that's clearly the issue.

  8. coreymj78
    Member
    Posted 2 years ago #

    Yeah, even before I came back and read these responses, I saw that Headway is the platform which controls the breadcrumbs (although I'm still confused as to whether Headway is simply using a native WP function or whether it is completely related to Headway. You can tell a post in the WP admin to turn off breadcrumbs for a particular post. Not sure if this means much.

    Anyway, I found the option in the Headway visual editor to turn on/off breadcrumbs, but I also see the they are turned on when I am viewing the home page, meaning that I'm going to have to ask the guys over at Headway how to do it with coding.

    Thanks.

  9. It's a headway function. There's no WP breadcrumb function.

  10. coreymj78
    Member
    Posted 2 years ago #

    There must be a WP breadcrumbs function for individual posts though. Otherwise why would there be the "turn off breadcrumbs" feature at the bottom of every edit post page?

  11. darichardson
    Member
    Posted 2 years ago #

    Nope. That option doesn't exist in default WordPress. It probably has to do with a plugin that came with your theme/framework.

    Again, this is definitely a template issue. Headway essentially contains some version of the code that I posted above, only it probably doesn't have that option built-in for the homepage. It probably has a plugin that displays the option for breadcrumbs on each post, but again this is not a native WP thing.

    Other than finding and editing that code yourself, your best bet is to contact the folks over at Headway or ask in their forums.

  12. coreymj78
    Member
    Posted 2 years ago #

    Strange. I guess it was added with Headway. I posted this question over on Headway forums and all he said was "it can be done with a bit of code and an easy hook" but didn't go on to tell me what that code would be or what the easy hook was. lol *facepalm* then he gave me a link to a tutorial page which did me no good (the word "bread" didn't even appear on the page once) as it described nothing having to do with breadcrumbs. Sheesh.

  13. darichardson
    Member
    Posted 2 years ago #

    Corey,

    The hook was the code that I posted above. As I said, you'd need to go into your template files and find the area where the breadcrumbs appear. I don't know what the code looks like, so I can't tell you exactly what it would need to be changed to, but you can definitely manually do this.

    Breadcrumbs is arbitrary. You're worrying too much about that specific term. The code I posted above could be used for anything. Say if you wanted to post some text in the footer but only on the frontpage and on your subdomain.

    Question: Will you be exporting the entire WordPress multisite for a client or just the subdomain?

  14. coreymj78
    Member
    Posted 2 years ago #

    Ok, I would have used your code, the problem is the template files with Headway. (and i just want to say thanks for even helping me with a non WP related issue) To edit the template files via the WP admin you have to go to the Network Admin area to see them, which to me means that they can only be customized network wide (no individual sub domain site customizations). Here are the template files I see in Network Admin > Themes > Editor:

    TEMPLATES:

    Comments
    (comments.php)

    Footer
    (footer.php)

    Header
    (header.php)

    Main Index Template
    (index.php)

    Theme Functions
    (functions.php)

    custom_functions.php
    (custom_functions.php)

    network_custom.php
    (network_custom.php)

    STYLES:

    Stylesheet
    (style.css)

    custom.css
    (custom.css)

    So if these can only be edited network-wide, wouldn't any changes I make affect every site?

  15. darichardson
    Member
    Posted 2 years ago #

    Are you using the same theme for every site? In either case it shouldn't matter with the code above as it checks to make sure that you're on the correct site (thus the $blog_id bit).

    The reason I asked about whether you'll be exporting your entire site for a client or just the subdomain has to do with that bit. That'll change if you export just the subdomain but won't change if you export the entire site.

    Also, I generally don't advise editing files within WordPress like that. Use an FTP client and download some sort of editor. I really like Komodo Edit. Much easier to edit code in that. An FTP client also makes it WAY easier to understand file structure.

    So two questions for you.

    1) Sharing the same theme for every domain or are they different?
    2) Will you be exporting the entire site or just the one subdomain?

  16. coreymj78
    Member
    Posted 2 years ago #

    Nevermind, I got it now. But there is a problem. Ok, I was told to use this code in an "after navigation" easy hook in Headway:

    <?php if(is_front_page() ) { ?>
    
    <div id="breadcrumbs"><p>You Are Here:   <a href="http://yourdomain.com">Home</a>
    </p></div>

    That gave me an "unexpected end" syntax error on line 4, on my homepage. So I did some research on basic PHP and came up with this statement:

    <?php if(is_front_page) echo '<div id="breadcrumbs"><p><a href="http://flooringlifemagazine.com">Home</a>
    </p></div>';

    BUT now on all other pages I get double breadcrumbs. Grrr. How can I change this code so that other pages don't show them in double?

    Thanks!

  17. darichardson
    Member
    Posted 2 years ago #

    Your code is just a little bit off.

    <?php if( is_front_page() ) { ?>
    <div id="breadcrumbs"><p><a href="http://flooringlifemagazine.com">Home</a>
    </p></div>
    <?php }  ?>

    The reason your first example didn't work is because there was no closing bracket for the IF statement. Also, I wouldn't recommend using ECHO in this case. Just include the html between the PHP, as I have above.

  18. coreymj78
    Member
    Posted 2 years ago #

    Sweet! Thanks! This is exactly what the other guy said too.

Topic Closed

This topic has been closed to new replies.

About this Topic