Get Posts updated or published within the last x hours

here is a shorter version that assumes the GET parameter ?time=[integer] (for example ?time=8) add_filter(‘posts_where’, ‘filter_where’, 11); function filter_where($where=””) { if(isset($_GET[‘time’])){ $time = $_GET[‘time’]; $time=(int)$time; // only allow integers if(in_array($time,array(8,24,72))){ $where .= ” AND post_date > ‘”.date(‘Y-m-d H:i:s’, strtotime(‘-“.$time.” hours’)).”‘”; } } return $where; }

how to use force_filtered_html_on_import in add_filter?

The solution that I’ve found is to add this line just before doing the import: if (function_exists(‘kses_remove_filters’)) { kses_remove_filters(); } That will disable the kses filters responsible for stripping HTML tag inside the post_content. I have successfully added this to the first plugin. Once this is disabled, it seems that when the import call to … Read more

add img class to native wordpress galleries

try this.Passed $attachment->ID to get_post_meta to retrive alt tag of each image add_filter(‘wp_get_attachment_link’, ‘galleryWIthClass’); function galleryWithClass($src) { $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => null, ‘post_status’ => null, ‘post_parent’ => get_the_ID() ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $attachment) { $alt = get_post_meta($attachment->ID, ‘_wp_attachment_image_alt’, true); $html= str_replace(‘<img’, ‘<img class=”‘. $alt.'” ‘, … Read more

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