Conditional custom field query

I found this: http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query I have modified the date to retrieve the last 15 days. It’s untested, but should work. $expireDays=”15″; $querystr = ” SELECT $wpdb->posts.* FROM $wpdb->posts, $wpdb->postmeta WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->posts.post_status=”publish” AND $wpdb->posts.post_type=”post” AND $wpdb->posts.post_date >= ( CURDATE() – INTERVAL $expireDays DAY ) ORDER BY $wpdb->posts.post_date DESC “; $pageposts = $wpdb->get_results($querystr, … Read more

Eliminating the appearance of a specific custom field in a post

The function, the_meta() allows you to hook to the the_meta_key filter (which currently is not documented in the Codex); this is where it fires off: // wp-includes/post-templates.php @line 744 echo apply_filters(‘the_meta_key’, “<li><span class=”post-meta-key”>$key:</span> $value</li>\n”, $key, $value); http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/post-template.php#L735 This filter is applied to each and every meta pair, which means that you can add a filter … Read more

load custom fields on click

I don’t know if you’ve found an answer on this question yet since it’s from 2011 but I have an idea on how to retrieve the data. What if you created a VERY simple php file that took the post ID as a get variable and displayed the post’s custom fields? It would look something … Read more

Custom Fields Not in Search Results

You can use an custom plugin for your custom fields function fb_custom_search_where($where) { // put the custom fields into an array $customs = array(‘custom_field1’, ‘custom_field2’, ‘custom_field3’); foreach( $customs as $custom ) { $query .= ” OR (“; $query .= “( m.meta_key = ‘$custom’ )”; $query .= ” AND ( m.meta_value LIKE ‘{$n}{$term}{$n}’ )”; $query .= … Read more

Passing Custom Field Data as Array to be Saved (Resulting Custom Field Array is inconsistent)

Definite solution: Seeing as wp’s core get_post_custom function returns multiple data fields saved as a single key in a random order, I resolved the issue by writing a function to replace it – which has some added flexibility: /*————————————————————— Function: Retrieve post meta field for a post based on ID Usage: [admin/meta_box/downloads.php] = to replace … Read more

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