New answers tagged categories
0
votes
why same category base and single post base don't work?
When you set WordPress up with:
The set-up
Custom Permalink Structure: /blog/%postname%/
Category base: blog
Generated rewrite rules
WordPress generates these rewrite rules:
blog/([^/]+)(?:/([0-9]+))?...
1
vote
WP Query filtering by custom category not showing all relevant posts
@jacob-peattie answered the question in his comment - I used the wrong key to set the number of posts my query generates. Swapping numberposts with posts_per_page solved the issue.
Here's the final ...
1
vote
Accepted
Add taxonomy or category slug to custom post types URL
You would do it by assigning the taxonomies when registering the post type:
'taxonomies' => [ 'taxonomy1', 'taxonomy2', ..etc ],
https://developer.wordpress.org/reference/functions/...
0
votes
Adding content to the top of post's based on their category
You can use the the_content filter for this:
add_filter( 'the_content', 'wpse420024_filter_content' );
/**
* Conditionally adds content above the post content.
*
* @param string $content The post ...
0
votes
How can I specify a category post on my home page
Quick example we are using in HoverCraft inside index.php that fails gracefully, which will affect either your homepage and/or "Posts page" depending on your settings:
<?php
...
0
votes
Show posts assigned to multiple categories in current category page
That's because that's what you're asking for:
'category__in' => array($category),
It's only going to show posts in that category.
You shouldn't be using get_posts() or WP_Query() in category.php. ...
1
vote
Accepted
Show category name in category.php when posts assigned to multiple categories
For the heading on a category archive use either:
the_archive_title();
Or:
single_term_title();
The first one can be used on the template for any archive, while the second should only be used on ...
0
votes
How do we ReWrite HTACCESS to point a cat/subcat Product URL, to Cat/ only?
When I refresh the error page, it just refreshes.
If the rule has been put in the correct place in the .htaccess file (ie. near the top of the file before the existing WordPress code block) then you ...
0
votes
Main menu not appearing on category pages
I also had this problem and found out that the error is caused by this code snippet
add_action( 'pre_get_posts', function ( $query ) {
if ( !is_admin() ) {
if( is_post_type_archive( 'project' ) &...
Top 50 recent answers are included
Related Tags
categories × 4795posts × 577
custom-post-types × 513
taxonomy × 307
php × 302
custom-taxonomy × 290
wp-query × 284
loop × 270
tags × 228
permalinks × 212
customization × 201
archives × 193
woocommerce-offtopic × 190
functions × 178
plugins × 164
terms × 159
pages × 129
menus × 126
filters × 119
templates × 117
theme-development × 104
query-posts × 101
pagination × 100
query × 95
custom-field × 93