How Do I Delete WordPress Posts Older Than 400 Days, From A WordPress Category

Addition note and warning: always always always take backups before doing anything in your database. It’s very easy to do something you didn’t mean to and lose tons of data, especially when dealing with DELETE statements. Also, if your database is using InnoDB for the database engine, you can use transactions via BEGIN, ROLLBACK, and … Read more

How to modify the “View all posts in category” title attribute

Found something that works fine: add_filter( ‘the_category’, ‘remove_category_link_prefix’ ); add_filter( ‘wp_list_categories’, ‘remove_category_link_prefix’ ); function remove_category_link_prefix($output) { $replace = array( ‘View all posts in’, ‘View all posts filed under’ ); return str_replace( $replace, ‘Text you want to show up’, $output); } found here: http://kaspars.net/blog/wordpress/remove-view-all-posts-filed-under-category-widget

WordPress monthly archive category specific

There is no child_of argument for wp_get_archives(). How, or why, did you expect that to work? You are attempting to use arguments that don’t exist. That, I suppose, is the answer to the question. The function is ignoring child_of because the argument doesn’t exist. There are a number of filters in wp_get_archives() such as getarchives_where … Read more

I need to exclude from a query a category and a few custom taxonomies

Change ‘relation’ => ‘OR’ to ‘relation’ => ‘AND’ to apply both exclusions to all posts returned. It may seem counterintuitive, but a post that satisfies one of the exclusions will be included even if it doesn’t satisfy the other. EDIT From the code linked in your comment below, this is the query being generated: SELECT … Read more

Custom css per category and per single post belong in each category

Category archive pages can be styled using the body class as per your example – WordPress does this out of the box. But for single pages, you need to add this to functions.php: function add_category_name($classes=””) { if(is_single()) { $category = get_the_category(); $classes[] = ‘category-‘.$category[0]->slug; } return $classes; } add_filter(‘body_class’,’add_category_name’); This will add the body class … Read more

Theme modification for custom category menus

As indicated above, I discovered the answer to my own question. You do not need single quotes or brackets around the variable. The fact that the variable is a string itself is sufficient. The correct code is below: <?php $cat = get_the_category(); $catSlug = $cat[0]->slug; $catMenu = $catSlug . “-nav-menu”; $options = array( ‘container’=>’nav’, ‘container_class’=>’menu-header’, … Read more

Multiple category posts on one page

I first want to jump in and say this, you should not be using query_posts, my emphasis, and stated in the codex as well, and I quote Note: This function isn’t meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is … Read more