Support » Fixing WordPress » Adding an entirely new Links Section

  • IS there a way to basically split my links admin into 2 panels? Like one would be called “Links” and the other would be called “Links Two”? This way I can keep safe for work links in it’s own world and NSFW link in it’s own dirty pig pen, and saves me from trying to nest em 3 times ( links>NSFW>SUBcategory)

Viewing 15 replies - 1 through 15 (of 28 total)
  • If you have a not safe for works category, my suggestion would be…don’t be on that blog at work in the first place, because somebody is going to follow your history there.

    ehhh, that’s besides the point, I was just using that as an easy example, I am my own boss and honestly don’t care who gets busted 😉

    *bump for the morning crew

    Looks like I’m part of the morning crew.

    Check out http://codex.wordpress.org/Template_Tags/wp_get_links

    The short bits:
    1. Create a new link category using the admin interface
    2. Assign relevant links to that category
    3. use wp_get_links(category_number) in your sidebar to only show that category.

    but that won’t give me the same structure as the “links” in the sidebar, ie:

    Links
    ——-
    Category
    >subcategory

    Links2

    Category
    >subcategory

    will it? guess I could just manually type in the name in the source.

    ok, I almost have it with this:
    <?php get_linksbyname(‘Funny Sites’ ); ?>

    except it won’t display the subcategory the link is in, can’t figure out how to tell it to do that, any ideas?

    Try:
    <?php _e('Funny Sites:'); ?>
    <ul>
    <?php wp_get_linksbyname('Funny Sites'); ?>
    </ul>

    As there’s no parent<>child relationship for link categories in WordPress, could you explain what you mean by “subcategory.”

    I meant display the category name before the categories links, like I have 3 link in category “funny links” so I want this:

    Funny links
    link 1
    link 2
    link3

    and right it only displays the links with that code

    basically my sidebar links will look like this:

    Safe for Work Links
    ————————-
    Humor links
    link 1
    link 2
    link 3

    News links
    link 1
    link 2
    link 3

    Finance Links
    link 1
    link 2
    link 3

    NOT Safe For work links
    ——————————
    dating links
    link 1
    link 2
    link 3

    gross links
    link 1
    link 2
    link 3

    Sex Links
    link 1
    link 2
    link 3

    See example 2 at:

    http://codex.wordpress.org/Template_Tags/wp_get_links

    That provides a similar display for your links. You could then add a PHP if statement to check for which link categories appear in what group:

    <?php
    $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
    foreach($link_cats as $link_cat) {
    if($link_cat->cat_name != 'dating links') && ($link_cat->cat_name != 'gross links') && ($link_cat->cat_name != 'Sex links')) { ?>
    <li id="linkcat-<?php echo $link_cat->cat_id; ?>"><h2><?php echo $link_cat->cat_name; ?></h2>
    <ul>
    <?php wp_get_links($link_cat->cat_id); ?>
    </ul>
    </li>
    <?php }} ?>

    Just set up a version of this for each grouping of links.

    I tried that and I get this error:
    Parse error: parse error,
    Unexpected T_BOOLEAN_AND
    in line 101

    which is the line with your PHP statement, and I don’t know php enough to troubleshoot it 🙁

    poop 🙁

    Just an oops on my part. Here’s a redo of it, made it easier to read:

    http://guff.szub.net/source/fragment-26440.php

    almost lol:

    Parse error: parse error, unexpected ‘:’ in sidebar.php on line 100

    which is this bit:

    ‘Sex links’)) : ?>

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘Adding an entirely new Links Section’ is closed to new replies.