Post not found when filtered by category ID
Use post_per_page instead. Like this: query_posts( ‘cat=34&posts_per_page=5’ ); Read more about the query on: WordPress Codex
Use post_per_page instead. Like this: query_posts( ‘cat=34&posts_per_page=5’ ); Read more about the query on: WordPress Codex
You can use wp_insert_term to add terms to the wpsc_product_category taxonomy: <?php $args = array( ‘description’=> ‘term description.’, ‘slug’ => ‘my-term’ ); wp_insert_term( ‘My term’, ‘wpsc_product_category’, $args ); ?>
The problem is in the logic. A post may have several terms, not all of which will be child terms. For instance, consider the parent > child term relationships: a > b > c d > e f And let’s suppose that our post has the terms c,e and f attached to them. Now the … Read more
I’ve not tested this, but the following is the method you shoulduse. Don’t use query_posts. $cats_of_post= get_the_category(); if($cats_of_post){ $cat_id = (int) $cats_of_post[‘0’]->term_id; $related = get_posts(array( ‘numberposts’ => 5, ‘category’ => $cat_id, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘exclude’ => )); global $post; $temp_post = $post;?> <div class=”related-posts”> <?php if( $related ): ?> <ol> <?php foreach … Read more
Don’t call Nav Menus by menu_id. Rather, define an explicit theme_location for each place in your Theme template at which you want to include a Nav Menu, and then use that theme_location as the parameter passed to wp_nav_menu(). In this case, you’ve defined a header-menu Theme location, so change this: <?php wp_nav_menu( array( ‘container_class’ => … Read more
Here is plugin that will automatically link to tag / category pages if similar keyword is used in the post. — SEO Smart Links
i’m not sure what you are trying to achieve w/ the $paged variable. seems like you could simplify your query though $posts_per_page = is_paged() ? 5 : 2; $args=array( ‘post_type’=>’post’, ‘category_name’ => ‘featured-content’, ‘posts_per_page’ => $posts_per_page ); $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query($args); edit, adding an offset (and fixing syntax errors): $paged … Read more
the_category() only works for the “Category” taxonomy which doesn’t appear to be hooked to your custom post type. I see you’re registering a custom taxonomy. If you want to show the terms from that taxonomy that are assigned to the post, you’ll need to use the_terms() or get_the_terms(): the_terms( $post->ID, ‘fgaleri’, ”, ‘, ‘, ” … Read more
get_categories() is handy function to get list of categories with all information such as id & name of each category etc. This code might work. The $category->term_id will return the unique id for each category and $category->name will return the name to display to user. <?php $args=array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’ ); $categories=get_categories($args); … Read more
You’re using an old version of WordPress. Upgrade to 3.5 and you will no longer see that error. Here’s the function declaration for get_post in WP 3.4: function &get_post(&$post, $output = OBJECT, $filter=”raw”) Notice the ampersand in front of $post? That would mean the value is passed by reference. You can give the function a … Read more