insert thumbnail image from php script

You’ll want to take a look at wp_insert_attachment and wp_generate_attachment_metadata. You can’t insert a featured image/thumbnail using the_post_thumbnail – that function only gets the thumbnail for the current post. See: http://codex.wordpress.org/Function_Reference/wp_insert_attachment and http://codex.wordpress.org/Function_Reference/wp_generate_attachment_metadata

meta_query not working with the_content()

the_content() echoes data to the page so essentially your query looks like: ‘meta_query’ => array( array( ‘key’ => ”, ‘value’ => $related_venue_variable, ‘compare’ => ‘==’ ) ) You want get_the_content() to return a string that you can pass along through the query. However, having the post content as a meta key doesn’t make any sense. … Read more

Custom Post Type shows pagination (w/404) or posts_per_page query, but not both

user5477769 reports in the comments of the original post, that the problem has been solved: I was following Custom Post Type UI instructions but it seems it led me astray. Creating a archive-gallery.php with a vanilla Loop, along with removing is_main_query has solved all problems, and the pages now show with 9 posts and correct … Read more

Orderby modified only for specific post types

Am Afraid that you have to go with Direct MYSQL or you can run two WP_Query() and then combine them, sort them or sort them with WP_Query() then combine them. Here is an example $args = array( ‘post_type’ => array( ‘staff-updates’, ‘coreteam’, ‘developing-updates’, ‘vacancies’, ‘recognition’, ‘page’ ), ‘orderby’ => ‘modified’, ‘posts_per_page’ => ’10’, ‘order’ => … Read more