Articles of categories

WP_Query arguments to fetch custom post type posts which are in certain category?

I’ve played around for hours but still can’t wrap my head around the right arguments for a secondary WP_Query which shall fetch all posts of my_custom_post_type that are in the queried category. Scenario is a custom category.php template file (writing a custom theme) to render a category archive for custom post type posts. Hence, the […]

403 forbidden on one page only

I can’t access The only error i get is Forbidden You don’t have permission to access /biljke/ on this server. This is regular hierarchical category for post. I have tried: deactivating all plugins (removed category slug also, so url should be but it still redirects me to ). I have deleted htaccess […]

I want to create a posts widget and be able to select categories

Can you please tell me how can I create a wordpress posts widget that outputs posts based on a categories selection ( category checkboxes of all the post categories ) This is in my form function: <?php foreach ( get_categories() as $category ) : ?> <p> <input class=”checkbox” type=”checkbox” id=”” name=”” /> <label for=””><?php echo […]

Programmatically create product category and add thumbnail in woocommerce

I’m trying to create product-(sub)categories on a WordPress installation. The (sub)categories part is no problem at all, but I can’t seem to find a way to add the thumbnail image to the specific category. In wp-admin, the field I want to fill asks for an attachment ID, so I tried uploading the image as attachment, […]

wp_nav_menu not highlighting the current category when viewing a single post

My WordPress site has a bunch of posts, all filed by a top-level category and a bunch of subcategories therein. I have the main site nav rendering the category pages, which, when clicked, get all posts in that top-level category as an ‘archive’. The category highlights as you’d expect when you visit one of these […]

Hide posts of a certain category unless logged in

I want to hide posts belonging to a certain category unless logged in. I found some code(attached) in the codex that works great for the loop. But how to ensure the post pages are empty as well? function exclude_category($query) { if (!is_user_logged_in()) { $query->set(‘cat’, ‘-2’); } } add_action(‘pre_get_posts’, ‘exclude_category’);

Querying Term Posts in Loop

I’m trying to show my CPT Category along with any posts associated with it below the title. I have the first loop fine: <?php $cats = get_categories(array(‘taxonomy’ => ‘custtax’, ‘orderby’ => ‘term_group’)); if(!empty($cats)) : foreach($cats as $cat) : ?> <a href=”<?php echo get_category_link($cat->term_id); ?>”><?php echo $cat->name; ?></a> <br /> <?php wp_reset_query(); ?> <?php $cat_posts = […]

Display empty taxonomy terms with get_terms()

I have a function setup as follows: <?php $terms = get_terms(“wpsc_product_category”); if ( !empty( $terms ) && !is_wp_error( $terms ) ){ foreach ( $terms as $term ) { ?> <li class=”calendar-filter-menu-item” data-filter=”.<?php echo $term->slug; ?>”><?php echo $term->count; ?></li> <?php } } ?> Which displays the taxonomy slug and count for each taxonomy, only problem is […]

Change the_content() in Theme Thirteen

I worked with site created on Theme Thirteen and theme uses <?php the_content( __( ‘Continue reading <span class=”meta-nav”>&rarr;</span>’, ‘twentythirteen’ ) ); ?> to get post title, date, part of content and read-more link. But now I need to show only post date and entire post content, but I can’t find how to do that. If […]

How to only show posts on last child category

By default WordPress will list posts on each category in its hierarchy. Example: Parent /- child /– grandchild When viewing the “Parent” category you will see a list of posts from child, grandchild and parent – even if the post is just ticked in “Grandchild”. My question is: How do I only show posts when […]