How to Structure Pages and Subpages

You could go about the actual structuring of the pages 2 ways: Create a Ministries page, leave it empty, and use it for only organizational purposes and set the rest as children…probably not the best method Create a Ministries Category, then create the pages (with no parents) The menu is gonna work the same way … Read more

Change div background acording to the selected category

If you use wp_list_categories (see Codex), it automatically adds the classes cat-item,cat-item-{ID} and (to the current category being viewed) current-cat. (It also adds current-cat-parent to the parent of the current category). This should be enough to style any particular category a certain way, and style the current category a particlar way. However, you can obtain … Read more

Adding an external link to wordpress menu

You’re _doing_it_wrong(). When you call wp_nav_menu(), you should be referencing theme_location, not menu. The way the custom navigation menu functionality is intended to work: The Theme registers locations for navigation menus to appear, via register_nav_menus( array( ‘location_slug’ => ‘Location Name’ ). Then the Theme instructs WordPress where to output those menus, via wp_nav_menu( array( ‘theme_location’ … Read more

exclude pages in custom menu

You probably want to explode your list of page ID’s using the explode function. Something like; <?php $exmenuitems = explode(“,”,get_option(‘exmenuitems’)); $recentPosts = new WP_Query(); $recentPosts->query (array ( ‘post__not_in’ => $exmenuitems, ‘post_type’ => ‘page’, ‘showposts’ => $menuitems )); I’d recommend using the WordPress Menu building functions and admin interface. Its much more intuitive for end users … Read more

Recent Posts widget missing current_menu_item class

The core Recent Posts Widget does not output any classes for the current post – probably because the Widget semantically is a list of posts, rather than a navigation menu, and therefore has no intended purpose to reflect current location. That said, with a bit of CSS/jQuery trickery, you could target the current post by … Read more

Edit the (automatic) HTML layout of nav menus

Update: The question was actually how to wrap the submenus, not the whole menu. Here are 2 options: using jQuery: <script type=”text/javascript”> // run this before the script that sets up the dropdowns: jQuery(document.ready(function($){ $(‘.sub-menu’).wrap(‘<div class=”dropdown”></div>’); }) </script> using PHP 5.3+ (slightly more complex option, but thought i’d post it): <?php $dom = DOMDocument::loadHTML(wp_nav_menu(array( ‘menu’ … Read more

add_filter for where statment issue

So first of all you’ll want to make sure that you want to and your WHERE clause in. posts_where will fire for (almost) every query so you want to be sure that you’re adding it to the right one. This can be done with the use of conditional tags. Note: The WHERE 1=1 is added … Read more