jgme
Forum Replies Created
-
stamen maps is based on openstreetmap and
Basic Google Maps Placemarks is based on Google Maps. So it won’t work! ??Forum: Hacks
In reply to: How to get a meta values from all posts in a special categoryYou are my hero. Thanks for the help, it works!
I have changed the code on line 14 from AND tt.term_id = ‘%d’ to AND tt.term_id IN($catid) because with the other one I can only get one $catid now I can put in more more.function get_meta_values( $key = '', $catid = '' , $type = 'post', $status = 'publish', $tax = 'category') { global $wpdb; if( empty( $catid ) ) $catid = '1'; if( empty( $key ) ) return; $r = $wpdb->get_results( $wpdb->prepare( " SELECT p.ID, pm.meta_value FROM {$wpdb->postmeta} pm LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id LEFT JOIN {$wpdb->term_relationships} tr ON p.ID = tr.object_id LEFT JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE pm.meta_key = '%s' AND p.post_status = '%s' AND p.post_type = '%s' AND tt.taxonomy = '%s' AND tt.term_id IN($catid) ", $key, $status, $type, $tax, $catid )); foreach ( $r as $my_r ) $metas[$my_r->ID] = $my_r->meta_value; return $metas; }
Get Values:
$myarray = get_meta_values( 'my_meta_key', '1,2' );
Forum: Fixing WordPress
In reply to: Opacity and Text on Image HoverYou can use :before
<style type="text/css"> .addFav:before {background:url(https://lorempixel.com/400/200/sports) no-repeat; height:200px; width:400px; position:absolute; content:""; opacity:1;} .addFav:hover:before { opacity:0.2; } .addFav { height:200px; width:400px;} ?</style>
<div class=”addFav”>Your Text</div>
Forum: Fixing WordPress
In reply to: I am new! Please please help me!!Hi,
I hope I understood what you meant.The category “Recipe” must be the parent category of “Baking” and “Baking” must be the parent category of “Bread”.
You can adjust it under Posts/categories: Edit category.
PS. Sorry for the bad english too! ??
Forum: Fixing WordPress
In reply to: Category cloud for direct sub-categories of a certain categoryThis will work:
<?php $childcategories = get_categories('child_of=' . $cat . '&hide_empty=1'); foreach ($childcategories as $childcategory) { if (in_category($childcategory)) { $childs = array($childcategory->cat_ID); foreach($childs as $idofchild){$string .= $idofchild.',';} } } $args = array( 'taxonomy' => 'category','include' => $string); wp_tag_cloud( $args); ?>
And here a Version for all descendant categories:
<?php $childcategories = get_categories('child_of=' . $cat . '&hide_empty=1'); foreach ($childcategories as $childcategory) { $childs = array($childcategory->cat_ID); foreach($childs as $idofchild){$string .= $idofchild.',';} } $args = array( 'taxonomy' => 'category','include' => $string); wp_tag_cloud( $args); ?>