Normally thesis theme navigation menu shown menu items in particular order like Home, pages, Categories, Links (it may be a post link or other link) and Rss feed link. Few of our readers have asked about how to change nav items order in thesis menu. Some of them asking about how to display categories before pages?. Reader comments ….
Thanks for the tutorial.
Do you know if there is a way to put all of the categories before the pages?
This is great! But do you have any idea how to make the category appear somewhere else in the menu, instead of as the last menu item only?
In this thesis theme customization video tutorial I am going to explain how to reorder our navigation menu items in thesis theme.
We know how to add links in navigation, for this we have option in wordpress admin dashboard. Goto thesis options under ‘thesis options’ in left sidebar of the dash board. Inside the thesis options we have navigation menu which has 5 options to add or remove items in navigation menu. Here we can add or remove pages, categories, links, homelink, and feedlink.
Display categories before pages in navigation menu.
To align categories before pages in navigation menu change the following code in nav_menu.php file. To achieve the above statement follow these steps.
- Login your ftp with cpanal user name and password.
- Open lib/ functions folder the path of this folder is Public_html/fourblogger.com/wp-content/themes/thesis_16/lib/functions.
- Inside the functions folder we have nav_menu.php file open this file inside we have the following codes. Swap the below code which is differentiated in different color.
The default code as follows
if ($thesis['nav']['pages']) { foreach ($thesis['nav']['pages'] as $id => $nav_page) { if ($nav_page['show']) { $nav_items[] = $id; $page_data[$id] = get_page($id); $parents[$id] = ($page_data[$id]->post_parent != 0) ? $page_data[$id]->post_parent : 0; } } if (is_array($nav_items)) { foreach ($nav_items as $id) { if (!$parents[$id]) $nav_array[] = thesis_nav_array($id, $nav_items, $current); } } if (is_array($nav_array)) thesis_output_nav($nav_array, $page_data); } if ($thesis['nav']['categories']) wp_list_categories('title_li=&include=' . $thesis['nav']['categories']);
The above code having two parts the first part is for pages second part is for categories. If you want your categories before header swap these two parts.
After swaping the above code it looks like below code.
if ($thesis['nav']['categories']) wp_list_categories('title_li=&include=' . $thesis['nav']['categories']); if ($thesis['nav']['pages']) { foreach ($thesis['nav']['pages'] as $id => $nav_page) { if ($nav_page['show']) { $nav_items[] = $id; $page_data[$id] = get_page($id); $parents[$id] = ($page_data[$id]->post_parent != 0) ? $page_data[$id]->post_parent : 0; } } if (is_array($nav_items)) { foreach ($nav_items as $id) { if (!$parents[$id]) $nav_array[] = thesis_nav_array($id, $nav_items, $current); } } if (is_array($nav_array)) thesis_output_nav($nav_array, $page_data); }
Now save your nav_menu.php file and refresh your site. Now you are got your categories before pages in navigation menu. The below image I am having featured, makemoney and testing categories before pages.
By the similar way nav_menu.php file having codes for home, pages, categories, link and feed link if you want you can change your order by re arranging the file with help of the above video. Share your experience in comment section. For more checkout our all Thesis theme tutorials..
Related Tutorials:
- How to Add Categories and Dropdown Categories in Thesis theme Navigation Menu
- Thesis Theme Customization For navigation Menu Round-Up
- How to Add Dropdown Navigation Menu in Thesis Theme
- How to add Background Image in Thesis Theme Navigation Menu
- How to Change Navigation Menu Color and Location in Thesis Theme





{ 13 comments… read them below or add one }
One more out of the box tip from your site. Great job done buddy.
Thanks Jaydip. I am happy about you continuously reading and
participating discussion here.
hi,how to add social network following banners like twitter,facebook and feedburner in header(you have placed it in sidebar here).
thanks. so how would you put LINKS that are used in the nav BEFORE a specific page? example: page1 | page2| link1 | page 3
By hacking thesis core files, you can do that. I think it can’t be done just through custom_funtions.php. The code changes done at thesis core files other than custom_functions.php will make problem when you upgrade your thesis next time.
so do you know what the code would be for use in the custom_functions.php file to make this happen?
sorry, didn’t read your reply correctly… now i see that it can’t be done with custom functions file… bummer.
for anyone who is interested, i figure this one out. create a custom page template with just this code: header(“Location: http://yourlink.com“);
Then add a new page to the blog and assign this page template.
Now just add the page to the navigation wherever you want…when you click it, you’re redirected to the link in the template file…
Works great.
Hi Paul,
have the same problem (want to put category tabs between home and About) but don’t get yet how you exactly did it.
1) you create a custom page template (any tips where I can find a tutorial on that?)
2) then you enter the code – but what exactly is the Location-URL? All I have so far is my categories …
Thanks!!
Johannes
Just a quick note on the article, even though this topic is somewhat old. Suresh mentions editing nav_menu.php and Pascal notes that the change would be lost upon upgrading.
I’d like to offer that instead of editing nav_menu.php, copy the code from the function thesis_nav_menu() and place it into a new function in custom_functions.php.
Then, place two more lines in custom_functions.php…
remove_action(‘thesis_hook_before_title’, ‘thesis_nav_menu’); // Remove Thesis Menu
add_action(‘thesis_hook_before_title’, ‘thesis_nav_menu_custom’); // Input Thesis menu in the header
You may need to use different values for the first argument, but that’s the gist.
This method gives the same functionality and leaves thesis core files intact.
Just thought I would mention it.
Hiya,
You’ve got a good article here, but what I need is a couple more steps further.
How can I order the categories in the main nav by ID? It is coming up alphabetical and I need more control on the order.
I’ve tried the ‘My Category Order’ plugin with no success.
Thanks!
hai jason,
To change the navigation menu category order use the below code..
http://pastebin.com/0yKb3kj7
you can add your style in custom.css file
Great tutorial. I am successfully done this.
Thnx 4 sharing..
{ 3 trackbacks }