Jump to content
Sign in to follow this  
jgbr

Menu System - the second line

Recommended Posts

jgbr

Im trying to customize my menu system so that when someone clicks a main menu (IE top bar) menu the secondary menu designs the categories within. A prime example: http://www.telegraph.co.uk/comment/ , you click comment and the cats of that comment go into the secondary bar? I dont want the drop down. Thanks

Share this post


Link to post
Share on other sites
catrina

Use a Custom Menu to create a menu with parent links that have categories as child pages and then go to PlatformPro Settings > Blog And Posts > enable Use Child Pages for Secondary Nav.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jgbr

Hi Can't get this to work, can it conflict with something?

Share this post


Link to post
Share on other sites
jgbr

This only workds on pages? id like it to work on categorys too

Share this post


Link to post
Share on other sites
jgbr

and when its clikced not all the time IE: when i click news , the second nav changes to news categorys but then i click parent, research, all the 2nd nav is changed to all catgeoris under research

Share this post


Link to post
Share on other sites
kastelic

In order to get them on category pages, you have to copy the html of the submenu and insert it via a hook using the is_category() conditional tag.

Share this post


Link to post
Share on other sites
jgbr

OK and how would i do that? Can custom CSS code be provided for that please?

Share this post


Link to post
Share on other sites
jgbr

HI All of them! can someone give me a step by step? thanks

Share this post


Link to post
Share on other sites
catrina

I just went over the basics of a hook here: http://www.pagelines.com/forum/discussion/comment/66866#Comment_66866 Please refer to it and if you still don't understand, I can explain in further detail.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jgbr

what would be the line of code/hook and where in what file do i need to place it? it must used the 2nd navigation columm to display posts or pages related to whatever is clicked in the main menuu and display it in the second.

Share this post


Link to post
Share on other sites
catrina

By second navigation column, you mean the secondary navigation row directly below the main navigation, yes?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jgbr

That's correct Im trying to get it so that when someone clicks something ont he top navigation, the secondary navigation changes to all posts & categories under that parent.

Share this post


Link to post
Share on other sites
catrina

First we'll need to implement the hook. In your case, the name of the hook you can try is brandnav_after_nav. This will determine where the second line navigation goes. The function name is the name you give to make it easy for you to identify. For example, you can use add_custom_secondary (so you know that you're adding the custom secondary menu). As a result, the hook will look something like this:

// add_action('hook_name','function name');
	add_action('brandnav_after_nav', 'add_custom_secondary');
	
	// function name
	function add_custom_secondary(){


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jgbr

ok so i had that right my problem is where exactly do i place that code, where and in what file?

Share this post


Link to post
Share on other sites
catrina

Okay, good. All hooks MUST go in the functions.php file in the child theme, PlatformBase. It must not go into any other file. Do you have PlatformBase enabled? (This is important because any changes you make in the child theme files cannot be overwritten when you upgrade the theme)


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jgbr

my code looks like this: // ABOUT HOOKS --------// // Hooks are a way to easily add custom functions and content to the Platform theme. There are hooks placed strategically throughout the theme // so that you insert code and content with ease. // HOOKS EXAMPLE --------// // Below is an example of how you would add a social media icon to the icons in header (branding section) // We have placed a hook at the end of the icon set specifically add new icons without modifying code or having to worry about your edits // getting thrown out during the upgrade process. The way to use hooks goes a little like this: // add_action('hook_name','function name'); // ---> uncomment to load //add_action('pagelines_branding_icons_end', 'add_icons_to_branding'); // function name function add_icons_to_branding(){ // This hook adds a stumbleupon icon to the header of your theme. The class referenced in the link can be seen in the style.css // and is the image from the CSS is placed in the images folder ?> add_action('brandnav_after_nav', 'add_custom_secondary'); function add_custom_secondary(){ <?php } // end function // ABOUT FILTERS ----------//

Share this post


Link to post
Share on other sites
jgbr

I've just had a thought: The code already exists, you can tell the system to use a child nav. The problem with this, it does not: A) allow the drop down to work in conjunction with child nav on. B) Allow categories (and only pages) is it not easier to modify the existing code to allow the drop down to work and to call the menu system of what is selected as childen of that menu from that menu system? if not, fair enough, but i still havnt cracked the above. This is what we are trying to achieve - whereas the secondary nav pulls data from the menu system dependent on what pages or categories are set as children in the menu system, 8SVpk.gif

Share this post


Link to post
Share on other sites
jgbr

You can get drop down and child nav pages working together. If only it now would include categories and alike the above picture (using the menu system)

Share this post


Link to post
Share on other sites
kastelic

This is just a way I've done it and it worked for me, there may be better ways. For the static html route i mentioned, your code is good but make sure to add a closing php tag before inserting the html. as well as a conditional to specify the category, like this:

	add_action('brandnav_after_nav', 'add_custom_secondary');
	function add_custom_secondary(){
	if ( is_category('news') ) {
	?>
	YOUR HTML GOES HERE
	<?php
	}
	}
	
Make sure you change the category id or name to the one you need. Now, to get the HTML. Using Google Chrome, navigate to a page that does have the secondary navigation that you want. If necessary, after creating the secondary menu in Appearance -> Menus, assign it to a page so that you copy it. Now right click on that menu and click "inspect element". The inspector will pop up at the bottom of your browser. Click to highlight the outermost unique element of that secondary menu. It should say something like

Now right click on this element and select "copy HTML". Paste this html into your function where it says YOUR HTML GOES HERE. If you followed every step you should now see the secondary menu on the category that you specified with the category id. Heres' the page to Wordpress conditionals if you need clarification on that: http://codex.wordpress.org/Conditional_Tags#A_Category_Page Good luck.

	

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×