Weblog Archive

Links Update on Plain Vanilla

Tue, 29 Mar 2005 at 23:09 • Filed under Themes

I couldn’t sleep over it, since so many of you asked how to get your links working if you have more than one category. So, here’s the code. Replace the old code from sidebar.php with this:

<!-- start links -->
<?php /* If this is the frontpage */ if ( is_home()
|| is_page() ) { ?>                   

 <?php
 $link_cats = $wpdb->get_results("SELECT cat_id,
cat_name FROM $wpdb->linkcategories");
 foreach ($link_cats as $link_cat) {
 ?>
  <h3><?php echo $link_cat->cat_name; ?></h3>
   <ul>
     <?php wp_get_links($link_cat->cat_id); ?>
   </ul>
   <?php } ?>

<!-- end links -->

Still better, download the theme again, if you like.

[ Ads ]

Related posts

Following list is auto-generated, based on this post's context as possibly related. You may, however, occasionally find some in this list unrelated, but nevertheless, we sincerely hope that you'll enjoy them too.

11 responses to “Links Update on Plain Vanilla”

  1. Jax said:

    It would be nice if you can add those extra templates like about, links, archives, and contact form. A complete theme set a la kubrick would be great. Maybe in a Plain Vanilla version 2.0, we might get to see it ;-)

  2. Peti said:

    That should be standard on every Theme :P

    J/K but that would be pretty decent, the whole overview or abridgement or compendium (Übersicht in german) would be better. Makes the editing easier. :)

  3. David Collantes said:

    I am going to adapt your vanilla (very nice) theme to use it on a book website I am going to be working on. The extra templates that Jax refers to would be nice to have.

    I will probably add shades to top and bottom, just like my website has, and an elegant error detection on the comments submission (empty fields and what not).

    Thanks for such wornderful theme and… think about the extra templates inclussion ;-)

  4. Chetan said:

    Jax, Peti: All in good time, guys =)

    David: coming from you is a huge compliment. Thanks! Yes, I’ll eventually make this a sort of complete theme, it’s just that it’s not happening immediately because of too little time I have for this.

  5. Linkback: Chetan’s monologue » Theme bliss
  6. Blastkist said:

    Me again. Was wondering why you call the “sidebar.php” from the footer instead of the index?

  7. Blastkist said:

    The thing is, what I want for my page is only the other pages in sidebar and nothing more. I don’t want the links and blog sections in the sidebar and trying to figure that out right now. Any tips? When I tried to create a new one, and call the new sidebar (named as pagesidebar) with the calls commented out that I don’t want…it returned an error and said call toundefined function–so not sure what that’s about. Maybe I have to use an includes function instead?

  8. Blastkist said:

    I’m using your theme on my site. Thank you, by the way! Also, the links issue I had noticed, it doesn’t give the proper category of links heading.
    So I tried pasting this new code into that and it gets an “unexpected T_string” error. So for now, I’ll have to leave it as is. Any idea what that’s about?

    Also, you didn’t include a page.php template. Although I can build one myself, it’s a nice default to work with.

    Many thanks for this great theme!

  9. Blastkist said:

    Ok, good stuff, I see that it’s just to replace the part with the necessary php code to alter the titles.
    Great! Fixed…thanks.

  10. Chetan said:

    Blastkist: For page.php, just make a copy of index.php and remove the comment related code from the file.

  11. Chetan said:

    Commenting php calls should have not only the html comment like &lt!– –> but within the function using double slashes. See below:

    &lt!– <?php // somefunction (); –>