Why would in_category only return one post in a specific category?
it should be in_category(7) integer, not string. but a better way to do this is: query_posts(‘cat=7’); if ( have_posts() ) : while ( have_posts() ) : the_post(); endwhile; endif;
it should be in_category(7) integer, not string. but a better way to do this is: query_posts(‘cat=7’); if ( have_posts() ) : while ( have_posts() ) : the_post(); endwhile; endif;
I would suggest using category slugs instead of ids. Please try something like this: if ( ! in_category( array( ‘bunnies’, ‘tacos’, ‘banana-pirates’ ) ) ) { comments_template(); }
you can use a walker like this, class Walker_Recent_Post_Category extends Walker_Category { function start_el(&$output, $category, $depth, $args) { extract($args); $cat_name = esc_attr( $category->name); $cat_name = apply_filters( ‘list_cats’, $cat_name, $category ); $list_recent_cat_post=”<ul class=”show-hide”>”; $args = array( ‘numberposts’ => 5, ‘category_name’ => $category->name ); $myposts = get_posts( $args ); foreach( $myposts as $mypost ) : $list_recent_cat_post .= … Read more
By using wp_update_post(), found in wp-includes/post.php: // Update post 42 $post = array(); $post[‘ID’] = 42; $post[‘post_category’] = array( … ); $post[‘post_content’ ] = ‘This is the updated content.’; $post[‘post_title’ ] = ‘This is the updated title.’; // Update the post into the database wp_update_post( $post );
You don’t need a plugin for that. You have at least two options: Take advantage of the Category/Tag description field, to create content to output either on a category.php/tag.php template file, or else in archive.php or index.php inside an if ( is_category() )/if ( is_tag() ) conditional. If you really need to customize your “introductory” … Read more
Unless you have added the functionality with a plugin or custom code, Pages are not placed in Categories. Pages are organized with Parent Pages and Children Pages. This is why (I suspect) in_category() does not work in page.php The following code in functions.php will add categories to Pages. /** * Add categories to Pages. * … Read more
try and add <?php wp_reset_query(); ?> at the end of your template. http://codex.wordpress.org/Function_Reference/wp_reset_query
Basically a duplicate of this question. It comes up a lot, and the remove category base functionality probably should be an option in WordPress to be honest. Here was my answer from there: No Category Base plugin to remove the /category/ bit from the URL. 🙂 If you have a page with the same name … Read more
Something like this looks ot be what you are after http://wordpress.org/extend/plugins/rich-text-tags/
add ‘rewrite’ => array(‘slug’ => ‘portfolio-categories’), but be sure to remove (not sure why that’s there, it tries hides the slug yet tries to rename it to “products” at the same time?): ‘rewrite’ => array( ‘with_front’ => false, ‘slug’ => ‘products’ ), So it looks like this: function mysite_post_types() { register_post_type(‘portfolio’, array( ‘labels’ => array( … Read more