I'm having this situation:
In a Wordpress blog I have my main navigation persisting of categories. The navigation is being created with wp_list_categories().
Now I'd like to mingle just one link to a page at a certain position within this navigation built of only categories.
Any ideas how I could accomplish this?
Thanks a lot!
sprain
Use http://codex.wordpress.org/Function_Reference/wp_list_pages and exclude the pages you don't want in the menu:
<php wp_list_pages(title_li&exclude=X;);?>
where 'X' is the id number of the page you want to exclude. Or use a plugin like Exclude Pages.
Do the same with http://codex.wordpress.org/Template_Tags/wp_list_categories to split the category listings and put the page listings within the category menu.
Use Reveal IDs for WP Admin « WordPress Plugins to find page IDs.
Related
There is an issue with wordpress menu, I'll be very grateful if you help me.
See please screenshot.
Menu item "Destinations" is a category. "Elbrus 5642", "Baikal lake", is sub categories for 'Destinations'. And in every sub category I need to show posts for that sub category.
I thought to do it manually in code, e.g. call posts in sub category "Elbrus 5642" with query posts. But that way I need to every time change my code when I add or remove sub categories. Is there any method, which allow to automate this process, e.g. I adding some sub category in menu admin panel, creating some posts for that sub category and they are automatically added in menu?
Thanks for any advice.
Try this plugin, I think it's what you need.
On a Wordpress website where you configure the navigation bar and you can show categories, and put child categories underneath the parents, is there a way to make it so that when someone hovers over the top level category that the drop down that pops up shows the individual posts within that category? And then you can click the post and go to that single post page?
This plugin sounds like what you need.
http://wordpress.org/plugins/category-posts-in-custom-menu/
I have a Wordpress site comprised mostly of pages, but there is one page (news section) that contains posts and categories like a blog would. I'm generating my nav using wp_nav_menu() with only the top-level pages displayed. I have styles set for the current link and the current link's parent that use the .current-menu-item and .current-page-ancestor classes that wp_nav_menu() automatically adds.
However, when you're viewing a post within the news section, no classes are added to the nav to indicate that you're in that section, and there's no way to style the "news" link to show that it's the section of the site the user is in.
Is there a way for WP to "know" that posts belong to that page? It's not a category because since no other sections of the site contain posts, the categories field is open and the editors can add whatever categories they want.
Do you have your "News" page set as your blog page, in the "Reading" settings? If so, it should add the class "current-menu-parent" and "current-post-parent" to the "News" <li> when you are viewing a post.
According to Wordpress template hierarchy (and specifically this diagram) a single post is being displayed by a file called single.php (or single-<post_type>.php. A set of posts from a category will be displayed by category-<post_type>.php template file.
Now, if you abide to this hierarchy, you'll have two more templates - news list and news detail page. Having two pages with these templates will make them automatically listed by Wordpress menu-generating function.
If that's not enough for you, you should use WP_Query to manually list your pages. If you decide to do it this way, one or two if statements should do the job.
I would like to create a nav menu that displays all the pages of a wordpress site, its layout similar to what you would see in a footer sitemap layout, approx 5 columns with all the pages shown. Each page will be a project. I want to use wordpress category checkboxes (like you have for posts) to allow selection of one relevant category for each project page. Each page will then show a category caption below the project's description text, this I will style with CSS so each category has a different background colour.
Because Wordpress doesn't provide categories for pages, I have found a plugin to add this category feature to pages called ninja-page-categories-and-tags: http://wordpress.org/extend/plugins/ninja-page-categories-and-tags/
It's possible to edit the plugin php code under basic-functions.php to return a 'class' for the category displayed using get_slug and then applying css for each.
My problem is that on the menu, which will be a secondary menu in Thirty Ten displaying the pages, I want to be able to colour the background of each link to match the category that has previously been assigned to each page using the ninja plugin. Because the menu works with pages and the categories are not directly linked to the menu items (firebug will not show category details in the html of each link to reference with the css) I am wondering how I can colour each link based on category? Any ideas?
Ultimately what I would like to achieve is a grid of page links that are all coloured based on their category, a colour coded menu.
The plugin uses the standard wordpress category functionality but I just can't think how to connect these category details to the menu items to allow me to style them with css, any help would be really appreciated, even if just a point in the right direction.
Thanks
It's difficult to understand exactly what you're after, but essentially if you want to add extra classes to menu items (which will allow styling), you need to create a custom walker function.
Have a look at a tutorial like this: http://wp.tutsplus.com/tutorials/creative-coding/understanding-the-walker-class/
I am trying to achieve a custom URL structure with Wordpress. Basically, my site functions as my blog and my portfolio. I want to have an "Articles" section and a "Portfolio" section. I want the articles to display on the Articles page, and the portfolio on the Portfolio page. Should be easy, except on top of that I want custom URLs...
I want the URLs setup like this:
Articles page:
http://mydomain.com/discusses
Specific article:
http://mydomain.com/discussed/%postname%
Portfolio page:
http://mydomain.com/does
Specific design:
http://mydomain.com/designed/%postname%
I can figure out how to do only one rewrite of this type, but WP doesn't have built in functionality to do both. I'm just wondering where I should start or what I should do...
The problem also becomes, I want to retain category functionality in both areas, so maybe it needs to be achieved with Custom Fields? and add a new rewrite rule based on the custom field of a post? I have idea where to start...
Thanks for any help you can give.
This actually isn't that hard to do. I'll go down, page by page, what you would need to do to achieve this.
Articles Page
Create a new template in your theme folder (/wp-content/themes/your-theme/) called discusses.php and just add the following content:
<?php
/*
Template Name: Discusses Template
*/
?>
You don't need any more content. Go into the Pages section of WordPress Admin and create a new page called Articles page and set the URL to be /discusses/. Set the template of this page to be Discusses Template. Now, go into the Settings → Reading section in Admin and set the Posts page to Articles page. Now all your blog posts will appear under the URL /discusses/
Specific Article
The easiest way to have all your articles appearing as /discussed/title is to rename the default category (in Posts → Categories) to discussed. Then set your permalinks to be:
/%category%/%postname%/
This will render the links you need for each post.
Portfolio Page & Specific Design Page
Assuming this will be some kind of custom design, the easiest thing to do would be to create a custom template and Page in the pages section, as you did for the articles page, and throw your custom HTML and CSS into that. I would then set each specific design page to be a child page of that in the pages section. You can use the WPdb classs to make custom queries to populate the Portfolio page.