Randomize Posts. Skip the first post in ascending order

I believe there are different ways of achieving this. Simplest way I could imagine is as below: $featured_content_query = new WP_Query( array( ‘post_type’ => ‘feature’, ‘offset’ => 1, ‘posts_per_page’ => 10, ‘order’ => ‘ASC’ ) ); shuffle( $featured_content_query ); //PHP function to randomise posts array You can then continue to use $featured_content_query as usual!

Posts are duplicating on wp_post_update

Ah, I found the answer myself. I’ve added global $post before the loop and now all seems to works fine. I don’t know if this is a good practice, so if you have another ideas share them 🙂 Here is the revised code: add_action(‘save_post’, ‘bulk_refresh’); function bulk_refresh($post_id) { if($post_id != 123)//123 is the ‘certain page’ … Read more

Multiple portfolios and single item in two of them (ideas?)

One simple option would be to add a parameter to the query string of the portfolio item (i.e. yousite.com/portfolio-item/?backto=portfolio-3), then on the item page modify the ‘back’ link with JavaScript: if the backto parameter exists then change the link to point to the portfolio specified in it. Here’s some untested starter code. On the portfolio … Read more

Conditional Statement custom post type category

is_category() does not work on custom taxonomy archive pages. The correct conditional tag here is is_tax() which takes the name of the taxonomy as first parameter and a string|int|array of term name/s, slug/s or ID/s as second parameter. So your whole conditional statement can look something like : if ( is_tax( ‘my_taxonomy’, ‘slug-name-of-the-term’) ) { … Read more