Tag Info

Hot answers tagged

3

Your problem is your custom query. Do not use variables that is used by default by Wordpress. $posts and $post is Wordpress reserved global variables. Change $post to a unique variable, something like $posts_query. When using get_posts and you need to setup postdata to make use of template tags, you have no choiche but to use $post as setup_postdata() ...


3

In all probability you are using a custom taxonomy, and not the build-in category taxonomy. If this is the case, then the category parameters won't work. You will need a tax_query to query posts from a specific term. (Remember, get_posts uses WP_Query, so you can pass any parameter from WP_Query to get_posts) $args = [ 'post_type' => 'product', ...


3

You can use 'posts_orderby' filter to change the SQL performed. Note that: using get_posts() you need to set 'suppress_filters' argument of false for the filter to be performed if you don't explicitly set 'post_status' you'll get only published posts (so no much to order) Code sample: $filter = function() { return 'post_status ASC'; }; ...


2

query_posts - You should never ever use query_posts. Apart from what @Rarst has said, the really big issue with query_posts is, it breaks the main query object ( stored in $wp_query ). A lot of plugins and custom code relies on the main query object, so breaking the main query object means that you are breaking the functionalities of plugins and custom code. ...


1

Please try the following javascript you need to add class to a tag for read more <a class='readmode'>Read More</a> $('.readmode').click(function() { $(this).siblings('.pop').slideToggle(); return false; }); Here is the demo http://jsfiddle.net/fvcvyc1e/4/


1

Running a no limit query is very likely the cause of your memory issues. So you might want to change your query. If still you need to do this way, you can use the fields option, it returns post IDs only and will save a lot of memory usage - example below: $your_query = get_posts( array( 'posts_per_page' => -1, 'post_type' => ...



Only top voted, non community-wiki answers of a minimum length are eligible