Unanswered Questions
4,022 questions with no upvoted or accepted answers
6
votes
1
answer
2k
views
Add category to custom post URL
I am trying to create custom post with custom taxonomy and categories. Structure is like:
Product:
Has categories
Has taxonomy
Custom post type create:
function create_alco_custom_post() {
$...
5
votes
2
answers
6k
views
Display all posts from all categories with pagination
Alright, this might be a tricky one to explain but I'll do my best.
At the front page I want to display all the posts from all the categories. However I want them to be divided. Take this for an ...
4
votes
0
answers
208
views
Is it safe to delete from db orphaned posts i.e. whose post_parent no longer exists?
I inherited a couple of WP + WooCommerce shops with roughly 30,000 products for sale each, and a wp_postmeta which is over a million lines. The former webmasters ran away.
In an effort to clean up old ...
4
votes
1
answer
117
views
How do I get the total number of categories in a list of search results?
I want to display the total count of categories in a set of search results.
For example, "10 posts found in 3 categories." (Assuming that each post has only 1 category.)
Right now, my solution is to ...
4
votes
0
answers
435
views
display most popular tags of category?
0ne year ago i used this code to show most popular tag of the current category in my sidebar:
function my_tags_from_category( $atts, $content = null ) {
extract(shortcode_atts(array(
'type' => ...
4
votes
1
answer
1k
views
Custom taxonomy on permalink
I have a long time problem and look forward for your help.
I have a custom taxonomy of "city" (it is no hierarchical like tags).
I just would like my URLs to look like this:
/%city%/%category%/%...
4
votes
0
answers
2k
views
get_permalink returns default link
I hope you can help me.
So I'm using /%postname%/ as permalink structure, and my htaccess looks like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /develop/...
4
votes
0
answers
194
views
permalinks with get variables
I'm trying to create my own permalinks with wordpress rewrite API. I have been registering my get variables as it follows
add_filter( 'query_vars','driver_vars' );
function driver_vars( $vars ) {
...
4
votes
1
answer
644
views
Get page content by category or tag
I'm trying to sort of emulate the Views behaviour in Drupal with WordPress, but doing it in theme templates.
Now, I have pages that are assembled by using wp_query in the template to get posts ...
4
votes
1
answer
353
views
How to sort posts by last name (2nd word) on ONE category only?
I have an "author" category that is used as a list to browse multiple posts containing author biographies. I have Smart Category Ordering installed and right now it is sorted by title ascending. ...
3
votes
0
answers
90
views
Child post with numeric only slug keeps redirecting to parent
I modified the allow-numeric-stubs plugin code to work with CPTs. You can view my forked repository here: https://github.com/akshatkedia/allow-numeric-stubs
WordPress is now allowing numeric slugs for ...
3
votes
1
answer
5k
views
Is there a Woocommerce hook that fires when applying a coupon but before checking if it's valid?
I want to add an item to the cart (that same item gets discounted with the coupon) upon using a coupon code (with a hook).
E.g. when using the coupon code SAMPLECODE, a product is added to the cart ...
3
votes
1
answer
104
views
Changing a function in function.php to a shortcode - for listing categories of only a certain post type
I'm trying to create a shortcode that can display a list of categories. However, it should:
First, limit the results to a specific post type (based on shortcode usage)
then check to see if category ...
3
votes
0
answers
1k
views
How to display post categories within the Latest Posts block?
I'm trying to display the category/categories from each post within the Latest Posts block in the WordPress editor.
This post seems to provide some solutions, however I am unsure how to use this ...
3
votes
0
answers
875
views
Using 'Primary Category' in URL
I'm running into an issue where I want to set up categories in my URL (%category%/%postname%), but doing this will create multiple URLs for the same content if I select multiple categories.
So, for ...