Using nextGen Gallery.. how can I call a list of all Gallery Names?

All your Galleries are stored a table called wp_ngg_gallery in your wordpress database. (For the sake of completeness: nextGen Gallery creates 2 more tables for albums and pictures, respectively) $gallery_ids = $wpdb->get_results( “SELECT gid FROM “.$wpdb->prefix.”ngg_gallery ORDER BY gid ASC”, ARRAY_A); fetches the IDs of all galleries into an array, ordered by ID from 1 … Read more

How do I create a meta box for dates?

If you’re in need of Meta Boxes for WordPress, check out the amazing code in github by jaredatch. https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress This allows you to add all sorts of metaboxes to your WP theme (or plugin). Date Picker, file upload, wysiwyg, text areas, text boxes…it’s really amazing and saves lots of time.

WordPress parent select need to be removed

Per comments a way around it is to set the post_type to something that isn’t a hierarchical type in the filter, as the wp_dropdown_pages() function used to populate the select calls get_pages() which just returns without doing anything if the post_type isn’t hierarchical. So using a non-existent post_type works: function limit_parents_wpse_106164( $args ) { $args[‘post_type’] … Read more

Multipart/formatted MySQL query problem

After much trial and error I finally figured out a solution using mysqli. I consider it a acceptable solution since the query will only be run on plugin updates. $mysqli = new mysqli(); $mysqli->connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $sql = ” DROP TRIGGER IF EXISTS {$wpdb->get_blog_prefix($site->id)}post_queue_insert; CREATE TRIGGER {$wpdb->get_blog_prefix($site->id)}post_queue_insert BEFORE INSERT ON {$wpdb->get_blog_prefix($site->id)}posts FOR EACH ROW … Read more

Rearranging posts based on categories

May be it’s a bad idea, but it’s the only. Don’t print posts immediately, but collect them in different variables: one for category “test”, one for the rest. <?php $w_h = $w_d = $last = 0; // init variables to concatenate content later $primary_posts = $secondary_posts=””; // empty array to fill later $category_names = array(); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)