The MU forums have moved to

Looking for setup advice (15 posts)

  1. JMF
    Posted 16 years ago #

    I've been reading posts here and on the regular WordPress forums about channeling post categories to Pages, etc. and it seems like there are a variety of methods and solutions. I think I'm more confused than when I started! I'm also realizing, since this is my first foray into MU, that most of what I'd like to do needs to be plugin-driven rather than hacked in, if I want my users to be able to use themes. (And I do!)

    Here's what I'm trying to accomplish, if anyone's willing to slog through it and give me some advice on the best way to proceed:

    I'm setting up a system for teachers I work with, so that they can have nice, somewhat localized web sites without having to become semi-expert HTML-slingers themselves.

    Rather than just handing them a blog, though, I'd like to be able to give them detailed instructions for setting up what would be a useful site for a typical teacher.

    So: let's assume a teacher with two preps/class-types (as a base). I'm envisioning a blog setup where that teacher could categorize posts as 'Announcements', 'Class 1', and 'Class 2' -- the 'Announcements' category would show up on the front or main page, and Class 1 and Class 2 posts would be funneled off to separate pages.

    After that, they could, of course, have as many static pages as they wanted, etc. It is important to me, though, that whatever I do, the new additions be treated as Pages, so that they show up automatically in nav bars, navigation link lists, etc, around their sites.

    I'm not opposed to having things set up so that they MUST use certain category ID's for their pages (i.e. due to a plugin that I'd have to hardcode to siphon posts with certain IDs away), but I'd like things to be as flexible as they possibly can.

    I've started poking around at this, but I don't have the luxury of a lot of time to experiment, unfortunately. Would anyone be willing to suggest a BEST way to accomplish this? (I'm more looking for a <i>method</i> rather than specific coding instructions. I <i>think</i> I can handle that myself. ;)


  2. andrea_r
    Posted 16 years ago #

    I think you're making it more complicated than it is, really.

    Pages are just that - seperate static pages.

    Something like this, "a blog setup where that teacher could categorize posts as 'Announcements', 'Class 1', and 'Class 2' -- the 'Announcements' category would show up on the front or main page, and Class 1 and Class 2 posts would be funneled off to separate pages."

    is more a template issue and having the right tags in the right place, even across all themes if need be. The categories don't go off onto a seperate Pages (note large P) but a category-based archive system. Easy peasy.

  3. JMF
    Posted 16 years ago #

    Thanks for the reply a_r; and I forgot to be careful with my capitals. Forgive me if I'm being dense; I probably am. I've hardly messed with template tags at all...

    So what I'm trying to get my head around is a way they start with a default set-up (dynamic page + 'About' Page), and then make a Page for 'Class 1,' 'Class 2,' 'Class 3,' etc., so they would automagically show up in their nav bars.

    Then, if they assigned those Pages to a (let's say) 'Class Log' Page template, their posts in 'Class 1' or whatever category would not display on the default dynamic page, but instead show up on the 'Class 1' Page.

    That, to me, seems to be the most logical way for my actual users to think about it: "I make a new 'page' for my class, set the template to 'Class Log,' and then assign the posts I want on there to the matching category."

    I'd like them to have access to a bunch of themes, so for simplicity's sake, I'd like to avoid making changes to each individual theme if I don't have to.

    I <i>really</i> apologise if this post deserves a reply of, "I <i>know</i>, dummy, that's what I <i>said</i>! I'm just really having problems getting a conceptual grip on this, for some reason.

    (Thanks for not kicking me, if a kicking is indeed in order...)

  4. andrea_r
    Posted 16 years ago #

    How about just change the nav bar so it spews out the category list instead of pages? The only thing special about a nav bar is that it is styled to go horizontal. The Pages tag can spew out a list, too.

    So for example, teachers can make a *category* for Class One, have all the posts show up automagically on that category archives page. (note small p. ;) )

    many templates have the category listing already in the sidebar, it's just a personal preference if you want it horizontal. I can't see an advantage to making it all show up on a Page. If it is just to keep all related class posts in one area - that's what the category archive sis for. :)

    Also, plugins exist for excluding categories off the main page.

    I think you're going at it backwards, thinking about how you want the end product to look and *function*, instead of thinking about how it already functions and getting it to display how you want.

  5. demonicume
    Posted 16 years ago #

    if you want your teachers to be able to post as per normal, then assign a category to a post (class_1) which determines which area in the page - or even WHAT page the post ends up on - then youre looking to do the 'multiple loop' thing. i've been kicking around with this idea for a month now. my site is a sports site, so when people post about football (dont ask how i'll get the posts to the front page and tagged, i aint got there yet) - an excerpt about football is posted on the front page in the FB section, and the actual article sits on another page that i've hacked several mini-loops into. i plan to have my basketball blogs posted in the BBall section and on a BBall page.

    if this is what you want, then you need multiple loops that pull and exclude from different categories. i've found a number of ways to do this.

    first try this: WordpressDoc multiple Loops

    then for your menus, read up on the template tags and the wp_list_page. i didnt realize how simple it was to get static pages included in the page menu.

    look into Filosofo Home-Page Control. i believe something like this is already a part of MU, though.

    read up on the using multiple loops on this site (perishable press.)

    more multiple loop goodness.

    then check out the Apathy theme and the plugins that come with it. the'r pretty useful even if you dont want to use multiple loops. Apathy has a triple-loop thats pretty cool to kick around.

    i only intend for my front page to have this functionality. i dont know how i would offer this to all of my bloggers.

    whew. i hope some of this helps you.

  6. JMF
    Posted 16 years ago #

    Ok. That gives me something to chew on -- thanks, both of you! I think my problem has always been with the concept of pages, for some reason. (No explanation necessary, I mean, I get the difference, it's just that my brain freaks out when putting everything into actual practice. ;)

    I'll give that schema a try, and cry some more once I hit a brick wall. :)

  7. JMF
    Posted 16 years ago #

    Ok. I think I'm getting close -- I'm just worried that I may be hacking too many files to get what I want, and of the future ramifications... maybe somebody can tell me if there's a better way, or if 'new theme hacking and adjustment' is just a standard pasttime for WPMU admins. ;) (I'm not opposed to tweaking new themes before they're added; just don't want to if I don't HAVE to!)

    Here's my test page, with my default theme: (RIP testguys 1-5. ;)

    Stuff I've done:
    > Changed the name of 'Home' (cat=1) to 'News' (hack to index.php - any way to do this via a plugin that I may be missing?)

    > Modified the nav bar so that it runs through


    ('exclude' added to avoid listing 'News' twice -- once as the default 'Home' and again as a category...)


    to catch any pages a user may have added. (hack to header.php)

    > Changed the default page so that it only displays posts from the 'News' category with an

    if (is_home()) {query_posts("cat=1");}

    before the loop (hack to index.php)

    In general, that's what I was trying for, I suppose. I keep having to remind myself that this is meant to be a template system, and therefore doesn't necessarily provide *unlimited* flexibility for users... It's a start, at least.

    Drawbacks: Category listings can't have their order rearranged like Pages, so there's some advanced planning involved in setting up a site, and 'News' or whatever has to be in cat_ID 1 or else everything is messed up. But with a controlled group of users, I doubt that's a problem.

    I COULD use some help with this, if anybody's up to it -- since I'm listing categories and pages in the nav bar, I'm not sure how to get the 'current page' highlighting to work. (If I can get it for this theme, I'm sure I can figure it out for others...)

    The code in this theme is written like this:

    <ul class="menu">
    <li class="<?php if ( is_home() or is_archive() or is_single() or is_paged() or is_search() or is_category() or (function_exists('is_tag') and is_tag()) ) { ?>current_page_item<?php }
    else { ?>page_item<?php } ?>">
    <?php _e('News'); ?>
    <?php wp_list_categories('sort_column=id&depth=1&title_li=&exclude=1'); ?>
    <?php wp_list_pages('sort_column=id&depth=1&title_li='); ?>
    <?php wp_register('
    '); ?>

    I added the 'or is_category()' into the <li class=" code chunk, to see if that would do the trick -- it didn't. I'm thinking for that to work, it's going to have to be able to 'read' WHICH category page it's on, to be able to highlight the appropriate one. Any way to do that?

    Thanks for all your help!

    [Manual breaks made - drmike

  8. JMF
    Posted 16 years ago #

    Nevermind, I think I got it... I was missing the fact that wp_list_categories() adds a 'current item' marker to the css, just like wp_list_pages(). Some extra tweaking to my css file, and it looks like I'm in business. :)

  9. dsader
    Posted 16 years ago #

    Oh, you'll hack your home theme, will you ever. Keep it in a safe place. Be careful with it when you upgrade. Make yourself a handy reference card for tweaking themes. There is no other way. Start with farms theme packs at and note your own special tweaks.

    Do not be tempted to edit core files. Make careful notes if you do.

    I updated 3 times in March(1.1.1,1.2,1.2.1), and it ain't over yet.

  10. JMF
    Posted 16 years ago #

    Thanks, that makes me feel better (?!) -- I've already started (in retrospect, unfortunately) a list of core file hacks I've made (as few as possible, granted, and just minor things); I started this thing with 1.1.1, so soon I guess I'll cross my fingers and upgrade.

    It's a painful thing to launch into a project like this and then find out you've done something the hard way all along!

  11. demonicume
    Posted 16 years ago #

    your idea with categories may actually help me with my site.i was gonna create page templates splashed with mini loops that displayed posts according to categories. i was gonna use the excerpt plugin from perishable press to handle the looks of it all. i think your ingenuity set me back a whole month!

    please post some of your core hacks.


  12. JMF
    Posted 16 years ago #

    The good news, no core hacks necessary (for that, at least) -- I did check into the multiple loop idea, and it lost me somewhere, so I ended up doing it this way instead. Like I said above, it might suffer from some flexibility issues in the future, I guess I'll have to wait and see, though. Here's the complete run-down of what I did:

    1. My nav bar code in header.php now looks like this:

    <div id="navbar">
    <ul class="menu">
    <li class="<?php if ( is_home()  ) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a>"><?php _e('Home'); ?></a>
    <!-- This is what I added; a list of categories to the navbar. the if() statement is there to stop a 'No Categories' item from showing up in the menubar on new blogs without any categories to display; it may still need some fine-tuning, though... -->
    <?php if(count(get_all_category_ids())<3) {
    } else {
    <!-- Here endeth my addition -->
    <?php wp_list_pages('sort_column=id&depth=1&title_li='); ?>
    <?php wp_register('<li>','</li>'); ?>
    <div class="searchbar">
    <?php include (TEMPLATEPATH . '/searchform.php'); ?>

    2. For my default page (index.php) I added

    if (is_home()) {query_posts("cat=1");}

    before the loop, so only posts from Category 1 show up on the 'Home' page... OK, I lied ;) I *am* going to change line 1251 in includes/wpmu-functions.php to this:

    $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_count, category_description) VALUES ('0', '".addslashes(__('Home'))."', '".sanitize_title(__('Home'))."', 1, '')");

    so that the initial, default category will display as 'Home' instead of 'Uncategorized' -- I think that will be less confusing for users; posts marked as 'Home' will show up on the 'Home' page.

    3. My default theme has a 'current page' marker that changes the nav bar block to show the active section; in style.css, the selectors for Pages looked like this:
 li.current_page_item a:link

    In order to get the new category names in the menu bar to highlight as well, I had to add these selectors into the mix:
 li.current-cat a:link

    That's it, I think...not too bad, and it shouldn't be too difficult to tweak newer themes in the future to be compatible with this scheme. Users can make new categories which will show up in the menu bar, and static pages as well.

    > What happens if a user's categories+Pages stretch too far across the nav bar? Ugliness, that's what. For *my* users, I'm not expecting that, but there's no way to control which categories hit the nav bar, and which don't.

    > Along those lines, what happens to children categories? I haven't looked yet...

    > How about static content on the Home page? I know the 'Front page displays -> A static page' option in Options -> Reading works, but it's not too smooth. It's a redirect, I guess, so you hit the Home page and bounce immediately to the About page or whatever, with the navbar markers reflecting that. No real problem, except for the possibility of readers clicking Home over and over trying to get it to 'stick' in the nav bar. A nice way to pass the time, maybe? ;) I'll have to experiment with some sticky post plugins or something.

    For now, though, this looks like it will work for me; hope all that's helpful!

  13. JMF
    Posted 16 years ago #

    Heh. There's a glitch already -- in the nav bar code, the switch leaves out a 'No Categories' marker if there are no other categories besides 'Home' -- but if you make a new category WITHOUT any posts, 'No Categories' shows up in the nav bar.

    Once a post is added, though, everything's fine. Here's an example -- brand new blog:
    nav bar= Home - About

    Add a category, 'Class'
    nav bar = Home - No Categories - About

    Add a category, 'Another Class'
    nav bar = Home - No Categories - About

    Add a POST to category 'Another Class'
    nav bar = Home - Another Class - About
    {The empty 'Class' category nicely absent now.}

    I know why my switch is kicking out a 'No Categories' once I add an empty category, but does anybody know something ELSE I could switch off of, to keep this from showing up when new categories are empty?

    I guess I need something that says IF there are categories present with an ID higher than 3 AND ANY ONE of those categories has some content, THEN print what you got.

    I don't know how to say that last bit in WordPress-speak! :(

  14. demonicume
    Posted 16 years ago #

    BTW thats a pretty cool theme. how did you do the 'page' 'email' buttons?

  15. JMF
    Posted 16 years ago #

    With the names on the main index page? I'm not sure what you mean, exactly: the graphics are famfamfam's silk icons, of course, and the links are all (laboriously) hardcoded, because the numbers (fortunately!) won't be changing much... Is that what you meant?

About this Topic