hkonno
Forum Replies Created
-
Forum: Hacks
In reply to: Exclude a post category from the Older Posts count.I don’t know if you managed to find a solution to this. Also I’m not sure what you mean by Older Posts widget, but if you meant the default Archives widget, adding a filter to
getarchives_whereshould work.function my_arc_widget_exclude_category($x) { global $wpdb; $excl_cat = get_cat_id('category_to_be_excluded'); $where_cond = !empty($x) ? $x . ' AND ' : 'WHERE '; $where_cond = $where_cond . "$wpdb->posts.ID NOT IN (SELECT p.ID FROM $wpdb->posts AS p " . " INNER JOIN $wpdb->term_relationships AS r ON (p.ID = r.object_id)" . " INNER JOIN $wpdb->term_taxonomy AS t ON (r.term_taxonomy_id = t.term_taxonomy_id)" . " WHERE t.taxonomy = 'category' AND t.term_id IN ($excl_cat))"; return $where_cond; } add_filter( 'getarchives_where', 'my_arc_widget_exclude_category' );Replace
category_to_be_excludedwith the category you want to exclude and place the above code in yourfunction.php. You might experience performance issue if you have many posts.Forum: Fixing WordPress
In reply to: menu-item-home class missing from wp_nav_menu() resultAfter further experiment, it appears that “menu-item-home” class is added when the Custom Link to the home URL is used but not for the page that is specified as the static front page despite the fact that the menu link is rendered to the same URL.
I’m not sure how I saw the class on the server that had an older version but it disappeared after the upgrade, since the code relating to adding the class does not have been changed. So, I guess I was mistaken…
On the other hand, I think the description
This class is added to menu items that correspond to the site front page
given for “.menu-item-home” in Function Reference for
wp nav menu()is misleading since it sounds as though the class will be added for the menu item for the page that is specified as “Site Front Page”.Forum: Fixing WordPress
In reply to: Plugins/Themes Editor Function Documentation Look Up ProblemNoticed that it’s been fixed sometime between 3.9.2 and 4.2.2.
Forum: Fixing WordPress
In reply to: Plugins/Themes Editor Function Documentation Look Up ProblemThe same problem exists with version 3.9.2 as well.
Forum: Fixing WordPress
In reply to: Plugins/Themes Editor Function Documentation Look Up ProblemThanks for the reply.
Since it’s not only me, I guess there’s some problems with what API returns rather than configuration problem.
I guess it is not a “bug” many prople are concerned very much since there are many alternatives to get the information. Still, it’s a pitty that a function provided within WordPress is not working as it should be.