Iperdesign_IT
Forum Replies Created
-
Maybe something like this: https://pastebin.com/m9xpfVB1
It first get’s the posts for “unsold” and “booked” and then get’s the posts for “sold” and then merges both.Will this works with pagination too?
Because i use this query ( for now ):$args=array( 'post_type' => $type, 'paged' => $paged, 'posts_per_page' => 5, 'orderby' => 'meta_value', 'meta_key' => 'Stato', 'order' => 'ASC' );
Thanks anyway ??
I explain it better:
I have a real estate agency. This agency has “property sold”, “unsold properties” and “property booked”. These elements are just meta fields of a custom post type. When an user search for some property, the result must show first “unsold properties” and “property booked” custom posts and in the end “property sold” custom posts. I forgot to tell you that i also use pagination, since there are a lots of property.
Understood now? ??
Forum: Fixing WordPress
In reply to: get_posts with numberposts is not workingI just used === and it returned true… still nothing happened ??
Forum: Fixing WordPress
In reply to: get_posts with numberposts is not workingI echoed both Instance and Post_to_show… still nothing: they are both populated. I tried to echo the entire args array to see if the variable was “corrupted”, but it was not “corrupted”. I’ll try with ===
Forum: Fixing WordPress
In reply to: get_posts with numberposts is not workingWhere’s the $posts variable coming from? I’d suggest that you change the name of the variable to avoid any conflicts and ensure that it an integer before you feed it into the get_posts arguments.
I changed the name of that variable into $posts_to_show, and still nothing. By the way that variable come from an input text inside a widget and it is store into $istance.
Forum: Fixing WordPress
In reply to: Change post categories on post savingTry clearing your browsers cache and deleting cookies.
Thanks! Now it is working! ??
Forum: Fixing WordPress
In reply to: Change post categories on post savingThis works for me:
function set_my_categories($post_ID){ if(wp_is_post_autosave($post_ID) || wp_is_post_revision($post_ID)) { return $post_ID; } wp_set_post_categories( $post_ID, array(49,13) ); } add_action('save_post', 'set_my_categories');
Thanks, but when the page loaded ( after save ), i need to reload to see categories setted. Any idea to avoid this refresh?