Wednesday, May 15, 2013

Nextgen gallery WYSIWYG description area(just gallery description not for gallery picture description)

$editor_id = "gallerydesc";
$tacontent = stripslashes($gallery->galdesc);
wp_editor($tacontent,$editor_id,array("media_buttons"=>FALSE,"textarea_name"=>$editor_id,"teeny"=>true,"textarea_rows"=>4,"editor_css"=>"","quicktags"=>false,"tinymce"=>array("theme_advanced_buttons1"=>"bold, italic, underline, blockquote, separator, strikethrough, link, unlink") ));

Saturday, May 4, 2013

Query multiple/duplicate meta_key values


SELECT $wpdb->posts. *
FROM $wpdb->posts, $wpdb->postmeta
WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
AND $wpdb->postmeta.meta_key = 'productcode'
AND $wpdb->posts.post_status = 'publish'
AND $wpdb->posts.post_type = 'post'
AND $wpdb->posts.post_date < NOW( )
AND $wpdb->postmeta.meta_value = $wpdb->postmeta.meta_value
GROUP BY $wpdb->postmeta.meta_value
HAVING count( * ) >1
ORDER BY $wpdb->posts.post_date DESC