New answers tagged

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]+))?...
kofeigen's user avatar
  • 281
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 ...
Jillian Hoenig's user avatar
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/...
Tom J Nowell's user avatar
  • 58.2k
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 ...
Pat J's user avatar
  • 11.5k
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 ...
Jesse Nickles's user avatar
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. ...
Jacob Peattie's user avatar
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 ...
Jacob Peattie's user avatar
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 ...
MrWhite's user avatar
  • 3,871
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' ) &...
Ketrin's user avatar
  • 1

Top 50 recent answers are included