New answers tagged

-1

// This won't show date in all cases the_date( 'F d, Y' ); // This will show date in all cases the_time( 'F d, Y' );


0

I think you can simplify your code a lot, by just using: $episode_number = ( $query->found_posts - $query->current_post ); in the loop as the episode's number. So you don't need that problematic Get_Post_Number() function and there's no need to use a special shortcode for this.


0

There is an interesting answer on SO which present different methods to resolve that issue: How do I query for posts by partial meta key? By custom SQL query (in my project I've used that solution) By changing the meta schema to store the dynamic meta_key as a meta_value By using the posts_where filter to update query behaviour based on input


0

It seems you need to rest the post data before return the $postCount. Before return it, add the follow: wp_reset_postdata(); -- There is a difference between wp_reset_query()and wp_reset_postdata(), as explained here. wp_reset_query() - ensure that the main query has been reset to the original main query. wp_reset_postdata() - ensures that the global $...


0

Woah there. You've just opened up a can of SQL injection. I use the default get_query_var('s') that I believe is automatically escaped by wordpress. Not quite - get_search_query() will do that, but get_query_var( 's' ) gets the "raw" value. Regardless, always use wpdb::prepare or similar escaping before executing SQL: $query = $wpdb->prepare( "...


3

REWORKED APPROACH The issue with the original answer is that although we pass post ID's to post__in parameter, being on the author page, the main query removes all posts that does not belong to the author. We can pass an empty string to author_name via the pre_get_posts filter, but that inherintly breaks the query object, which is a no-no. This calls for a ...


0

I think that I figured this out. In my functions.php file I had the below function to redirect to the checkout page when a product is added to the cart. So I captured the username variable there and then added it to the redirected URL: add_filter ('add_to_cart_redirect', 'redirect_to_checkout'); function redirect_to_checkout() { global $woocommerce; ...


1

Off the top of my head - put this in your functions.php: add_filter( 'infinite_transporter_in_same_cat', '__return_false' );


1

After some tweaking I've discovered that I've totally forgotten the relation into meta_query. so I've just added 'meta_query' => array( 'relation' => 'AND', $closed, $ends, $budgets, ), and it worked fine.


0

You cant export only categories (or taxonomies generally). Just export all content with Tools/Export and you can delete content except categories from xml.



Top 50 recent answers are included