WordPress.org

Ready to get started?Download WordPress

Forums

How to link to category list in a different directory (4 posts)

  1. kappaluppa
    Member
    Posted 8 years ago #

    In order to create a totally password protected section of my website, I created a blog within a blog. However in the "inner blog", the members only section, I want to have the sidebar of the "wrapper blog".

    I created a database for the outside blog - db1 - and another database for the inside blog - db2.

    I am using <?php wp_list_cats('list=1'); ?> to list the categories. How do I pull the list from the outside database (db1)?

    I want to be able to switch from blog to blog seamlessly.

    Thanks for your suggestions!
    Kathy

  2. Lorelle
    Member
    Posted 8 years ago #

    How about manually? Just type in the link to wherever you want it.

    <a href="/wordpress/index.php?cat=42">Category Name</a>

    You can learn more about manual linking on Linking Posts, Pages and Categories on the Codex.

  3. kappaluppa
    Member
    Posted 8 years ago #

    For now that is how I am doing it, but I don't want to have to hard code everytime a cat is added.

    Thanks!

  4. kappaluppa
    Member
    Posted 8 years ago #

    This is the very round about way I did it, for now...

    1) I created a php page with the code to list the cats & pages:
    <?php wp_list_cats('sort_column=name'); ?>
    <?php wp_list_pages('exclude=2,12,14,15&title_li='); ?>

    2) Make it a template page called sidebarmenu by adding this to the top:
    <?php
    /*
    Template Name: sidebarmenu
    */
    ?>

    3) Create a page in WP. In page template options choose the sidebarmenu template

    4) Include that page in the side bar using the full url to the page

    Here are some hints:
    * you have to have the include_page and the run_php plugins for it to work.
    * if you have an specific pages to include or exclude remember to update the template page

    Wow, it took a lot longer to figure it out that those few lines suggest! But now it sort of does a "triple update" -
    the categories update, which updates the page with php which updates the menu of sidebar on the nested blog.

Topic Closed

This topic has been closed to new replies.

About this Topic