SQL: Search query to get attachments only of those parents which are published

Well since nobody helped with at first look such an easy problem, i used my way, and if somebody will need it here it is: I used this query: $results = $wpdb->get_results( $wpdb->prepare( “select $wpdb->posts.ID, $wpdb->posts.post_status, $wpdb->posts.post_parent from $wpdb->posts where post_title like ‘%%%s%%’ and (post_type=”albumas” OR post_mime_type=”audio/mpeg”) AND (post_status=”inherit” OR post_status=”publish”) $excludes limit 0,”.$setting->limit, ($setting->search_content … Read more

Implode Taxonomy to hide parents?

You can check if the resulting term has any children before adding it to the array: $terms = get_the_terms($wp_query->post->ID, ‘propertytype’); $props = array(); foreach ($terms as $term) { $hasChildrenTest = get_term_children($term->ID, ‘propertyType’); if ($term->parent) { if (empty($hasChildrenTest) && !is_wp_error($hasChildrenTest)) { $props[] = $term->name; } } echo implode(‘, ‘, $props); ps: the if($term->parent) test might become … Read more

Remove “minor-publishing” div from Publish admin metabox

In short- no. The html in question is hard-coded in the post_submit_meta_box callback function. You can, of course de-register the publish metabox and re-register your own which mimics post_submit_meta_box (but making your alterations) and being sure to keep the names of the inputs exactly the same. This method has been outlined the following posts where … Read more

Why does my taxonomy code display the first alphabetical term?

With wp_get_object_terms() you’re able to manipulate the sorting. Make sure you tweak the sorting to what you want. Try something more or less like this (Updated: 5/17/2012 — 8:15AM): $taxonomyName=”producttype”; $terms = wp_get_object_terms($wp_query->post->ID, $taxonomyName, array(‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘fields’ => ‘all’)); if(!empty($terms)){ if(!is_wp_error($terms)){ for($i = 0; $i < count($terms); $i++){ if($terms[$i]->parent != 0){ … Read more