WordPress.org

Ready to get started?Download WordPress

Forums

Oxygen
Using Categories for the Side Menu (4 posts)

  1. RobDYoung
    Member
    Posted 1 year ago #

    I've done some heavy editing (a.k.a. amateur hack-and-slash) on the code, and you can see the current version of the site here:

    My Site

    (There are plenty of extra things I've done and want to do, but for now I'm just looking to resolve one issue.)

    What I want to do is simple enough. Rather than having the menu pull information from the set menus, I just want it to pull from all the categories in the parent category "Writing." Now, I've figured out how to reference that information (just using the category ID), but the formatting breaks and I can't figure out how to mend it.

    Here was my last attempt:

    <div id="sidebar-primary" class="sidebar">
    <php wp_list_categories('child_of=299'); ?>
    </div>
    
    if ( is_active_sidebar( 'primary' ) ) : ?>
    
    	<?php do_atomic( 'before_sidebar_primary' ); // oxygen_before_sidebar_primary ?>
    
    	<div id="sidebar-primary" class="sidebar">
    
    		<?php do_atomic( 'open_sidebar_primary' ); // oxygen_open_sidebar_primary ?>
    
    		<?php dynamic_sidebar( 'primary' ); ?>
    
    		<?php do_atomic( 'close_sidebar_primary' ); // oxygen_close_sidebar_primary ?>
    
    	</div><!-- #sidebar-primary .aside -->
    
    	<?php do_atomic( 'after_sidebar_primary' ); // oxygen_after_sidebar_primary ?>
    
    <?php endif; ?>

    Well, obviously it didn't work, and I feel like I'm way off base for finding a fix. Only I don't even know where to start looking to find a solution. Anyone have a pointer for me?

  2. Jana
    Member
    Posted 1 year ago #

    Have you tried using "custom menu" as a widget, then pulling in that category to the custom menu?

  3. RobDYoung
    Member
    Posted 1 year ago #

    I'm not quite sure what you're referring to there. "Custom menu" isn't a widget option that I see. Though "categories" is an option for widgets, I can't see any way to import that data into the custom menu.

    I've been trying to find where the actual menu data is stored, since I could just replace that with the category ID code---but I can't seem to locate it anywhere on the server.

    Any other thoughts?

  4. Mark
    Member
    Posted 1 year ago #

    You seem to want to replace the primary menu (which isn't so much "located on the server" as edited and set via the "Menus" settings page) by a automatically generated list of categories.

    Probably the easiest way is to use a function like wp_list_categories() to generate a list of categories, which you can then style like the secondary menu by copying the css for the menu from the Oxygen theme and adjusting it to your needs.

    You would place this function in a child theme in a copy of the the menu-primary.php template file.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags