ThemeShaper Forums » Power Blog

[closed]

Adding Link to Power Blog Categories Menu

(9 posts)
  1. I am trying to add a link to the Power Blog categories menu. I know I can do this with pages by adding a filter to the wp_page_menu function by using this function:

    // Adds a home link to your menu
    // http://codex.wordpress.org/Template_Tags/wp_page_menu
    function childtheme_menu_args($args) {
        $args = array(
            'show_home' => 'Home',
            'sort_column' => 'menu_order',
            'menu_class' => 'menu',
            'echo' => true
        );
        return $args;
    }
    add_filter('wp_page_menu_args','childtheme_menu_args');

    However, I do not find a similar function for categories in the Codex. Does anyone know what I could do? I would guess that there is a wp_categories_menu function, but I've searched and cannot find any documentation on it. I went ahead and tried a filter anyway, but it didn't work:

    // ADAM - Adding links to the categories menu
    function childtheme_category_menu_args($args) {
        $args = array(
            'show_home' => 'Adam',
            'sort_column' => 'menu_order',
            'menu_class' => 'menu',
            'echo' => true
        );
        return $args;
    }
    add_filter('wp_category_menu_args','childtheme_category_menu_args');

    I am trying to add in external links to my categories menu. I am currently doing this easily with my page menu using the "Page Links To" plugin, but unfortunately the feature for adding manual links to categories hasn't made it's way into the plugin yet.

    Anyone know how to add links to the categories menu?

    Posted 9 years ago #
  2. awarner-

    I dont have a copy of the power blog child theme but I bet you can look in the functions.php and find what you're looking for. Search your functions.php for "category" . The wordpress function most likely used to create the category nav would be wp_list_categories

    -Gene

    Posted 9 years ago #
  3. Hi Gene,

    Yes, that's what I've found, but what I'm trying isn't working. It's probably just due to my lack of exact coding knowledge.

    Here's the categories menu code:

    // Add a drop down category menu
    function childtheme_category_menu() { if(!is_page()) { ?>
        <div id="category-access">
            <div id="category-menu" class="menu">
                <div class="menu-title"><?php _e('Categories:', 'thematic'); ?></div>
                <ul id="category-nav" class="sf-menu">
                    <?php wp_list_categories('title_li='); ?>
                </ul>
            </div>
        </div>
    <?php } }
    add_action('thematic_belowheader','childtheme_category_menu', 5);

    ...and here's my attempt at adding a link (by looking at the example of adding a "Home" link to the page menu...

    // ADAM - Adding links to the categories menu
    function childtheme_category_menu_args($args) {
        $args = array(
            'show_home' => 'Adam',
            'sort_column' => 'menu_order',
            'menu_class' => 'menu',
            'echo' => true
        );
        return $args;
    }
    add_filter('wp_list_categories_args','childtheme_category_menu_args');

    Am I on the right track? I am expecting the above function to add an "Adam" link in the category menu, but it's not. By the way, it's not breaking my theme either.

    Posted 9 years ago #
  4. Hi Adam,

    it's not there 'cause 'normally' it doesn't make any sense :)

    .. and you're comparing two different levels .. wp_list_categories() can be compared to wp_list_pages() but not to wp_page_menu().

    Do you need the external links to be somewhere in the list or could these links be appended or prepended?

    Chris

    Posted 9 years ago #
  5. Hi Chris,

    I have the Power Blog child theme installed on the main blog of a WPMU site. There are many subdomain sites now, http://subject2.mysite.com, http://subject3.mysite.com, etc. I'm trying to link directly to these subdomain sites from within the Power Blog category menu. The desired behavior is for me to place these "external" links anywhere I'd like, in any order I'd like.

    If there is not a simple way to achieve this, I can re-think my methods.

    1. I could create the standard categories on the main blog and just use category page templates to point to (and pull in) content from a particular subdomain. This would mean creating and editing content somewhat manually if I needed to change the template content in the future. No big deal I suppose, I could always link to the subdomain blog on the top and then pull in some post excerpts also.

    2. I could just use the normal Pages menu + Page Links To, to link a page to a subdomain blog. I would just use the pages to specify my "categories".

    I suppose I have options:) Aside from these options though, I would be interested in knowing if there is another option.

    Posted 9 years ago #
  6. Hey guys-

    It'll take a little code wrangling but this function may help to get you headed in the right direction. get_blog_list() documentation here: http://codex.wordpress.org/WPMU_Functions/get_blog_list

    -Gene

    Posted 9 years ago #
  7. Adam-

    Did you ever get this sorted? I was interested in hearing about the solution if you wouldn't mind sharing it.

    -Gene

    Posted 9 years ago #
  8. Hi Gene, sorry for the late reply. I had to put this on hold:(

    Posted 9 years ago #
  9. No worries drop me a line if you come back to it.

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.