Listing posts by grouping dates

I’ve been using the following plugin for Event management, and it has short code to display all events and sort them by date. It also has some developer features to give you a bit more control over things. http://wordpress.org/extend/plugins/events-manager/ Very cool plugin that is actively developed.

WordPress query by category, sorted by custom field

I don’t think there’s an easy to sort by three different meta values, and really, I don’t see why you need to in this case. Why not just save the event date in one meta value and sort by that? It makes your query much more efficient (removes two unnecessary joins) and lets you use … Read more

Help with wordpress custom query and advanced custom fields plugin

$yesterday = array ( ‘year’ => date(‘y’), ‘month’ => date(‘m’), ‘day’ => date(‘d’)-1 ); $rows = $wpdb->query($wpdb->prepare(*emphasized text* “SELECT id, yymmdd FROM plugin_data WHERE yymmdd LIKE ‘%d-%d-%d”, $yesterday[‘year’], $yesterday[‘month’], $yesterday[‘day’] )); foreach ( $rows as $r ) { $id_for_yesterday_rows[]= $r->id; } Now you have all ids or rows that were submitted yesterday in an array.

Get the timout value of a saved transient?

So, after one minute of more thinking, there is an easy solution, although i did not try it myself: $transient=”_transient_timeout_” . $_your_transient_name; $transient_timeout = get_option ( $transient ); you should be ready to go with this. Another Way throught the database would be: $transient=”_transient_timeout_” . $_your_transient_name; global $wpdb; $query = ‘SELECT option_value FROM ‘ . … Read more

Remove Unnecessary Mysql Query

Best I can tell is that those default widgets get options from the database as their classes are constructed, so there’s no way to prevent the DB queries without disabling those widgets entirely. Depending on your needs, you may want that slight performance bump and do not need the widgets, in which case you can … Read more

Custom query to get terms from post ids

It is not advised to make use of custom SQL queries if there are functions in WordPress that already does the job. To accomplish this, you can simply make use of wp_get_object_terms(). The first parameter $object_ids takes a string or an array of object ID’s. In your case, you can make use of an array … Read more

Difference between fragment caching and wp_cache

I’ll post this as an answer, even though I don’t know much about caching. If you read about WP Object Cache it says: By default, the object cache is non-persistent. This means that data stored in the cache resides in memory only and only for the duration of the request. Cached data will not be … Read more

Most effective use of DB querys

The $wpdb object is based on ezSQL, it does not add much overhead, so I would not worry about that. Opening a second connection to the database yourself will probably lead to more overhead than using the $wpdb functions. The three queries you have described are ideal queries to do in the database (a small … Read more

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