taxonomy tags 404 to custom post types
Try resetting permalink. Go to Settings -> Permalinks and hit save on that page. Try if tags are working now.
Try resetting permalink. Go to Settings -> Permalinks and hit save on that page. Try if tags are working now.
Change your code with this and might help you with what you are looking for. The issue here is that we cannot include key, order and orderby in meta_query. But if you want to order you result posts based on key than you can pass the query arguments as below: $custom_query_args = array( ‘post_type’ => … Read more
I’m not sure why the first page works but the second doesn’t, though this may be a hint toward the problem. Toward the bottom of the category template page you have the following: if (function_exists(custom_pagination)) { custom_pagination($custom_query->max_num_pages,””,$paged); } If you review the above, there is a variable called $custom_query. This looks like it’s a WordPress … Read more
You can retrieve the index of the post in the loop with $wp_query->current_post. From that, you can check with a simple if-statement: /*Check if post index is 2 (you referred to the 3rd post, given indexing starts from 0, the 3rd post index would be 2 */ if ( $wp_query->current_post == 2 ) : /* … Read more
With WP_Query it’s only possible to sort by a single meta value by setting the meta_key argument to which key you want to be able to sort by, and orderby to meta_value (or meta_value_num if the value is to be sorted numerically). This is what the arguments would look like: $args = array( ‘meta_key’ => … Read more
You haven’t accounted for the case that there are no tags assigned in your declaration of $tag_related_posts. Your get_posts function always returns results in your line of code: $tag_related_posts = get_posts(‘exclude=” . $post->ID . “&numberposts=” . $max_articles . “&tag=’ . $tags_string); If the $tags_string is null, it just returns a random list of posts and … Read more
Each of your if statements have the same has_term(‘NBS_CONS’, ‘broad_type_nbs’ ) function. This could be put in a variable for reuse instead. & Your argument for each if statement is actually very consistent, so much so you could probably reduce it by just putting your varying data in an array, loop though, and use Variable … Read more
If you look at the codex (here) you’ll see that the_content() is just a wrapper for get_the_content() which passes it through the the_content filter. So, you too can hook into that filter to change your content output without having to edit the theme files.
Based on wordpress reference for WP_QUERY you can use author__in to filter by more than one author. It uses an array of user ids. Here is your code with the needed changes: function list_cpt_by_author_id(){ $user = get_current_user_id(); $authors_id = array(“1”, $user); $custom_terms = get_terms(‘custom-tax’); foreach($custom_terms as $custom_term) { wp_reset_query(); $args = array( ‘post_type’ => ‘artigos’, … Read more
Moving here so comments don’t turn into a mess. Basically there are two things that can go wrong here: Fetching of posts. Check that $thumbnails gets correct post and only one. I am not sure if that is the issue, but get_posts() docs list numberposts argument instead of posts_per_page that is listed for query_posts(). That … Read more