Only Showing Upcoming Events

Hi @Spencer B.: Funny, my client submitted a bug ticket for the events modules I wrote for this very issue the other day, and I just fixed it a few hours ago. Note that my example uses a Custom Post Type of ‘event’ which is very useful to be able to differentiate logic for Events … Read more

Experiences with compiling WordPress using Hip Hop?

Original approach of static compilation in HipHop PHP-to-C++ has been since replaced by HipHop VM just-in-time compilation. Facebook prominently featured WordPress as example application and it no longer requires extensive (barely any by now) core edits. Old answer There is quite extensive presentation Rasmus Lerdorf – PHP Performance that uses WP as test subject and … Read more

WordPress URL Rewrite not working

first, you should use the proper filter and method to add query vars and rewrite rules and not manipulate the globals directly. the other issue I believe is your regex pattern, this is working for me: add_filter( ‘query_vars’, ‘wpa59404_query_vars’ ); function wpa59404_query_vars($query_vars){ $query_vars[] = ‘update_slug’; return $query_vars; } add_action( ‘init’, ‘wpa59404_rewrites’ ); function wpa59404_rewrites(){ add_rewrite_rule( … Read more

WordPress AJAX Pagination with query_posts

In the end I found that it is not possible to update the pagination. The way I loaded the next lot of posts was by setting a post offset, and using a load more button. So in your ajax call where you are loading more posts, you need to pass over an offset value: $.ajax({ … Read more

Change the filename format of saved featured images

There is a filter to use for the array containing the filename that is saved to postmeta but since there are no filters available to change the filename before it is saved you have to manually change it using rename(). function wpse_filter_image_resize_name( $filename ) { $new_name = preg_replace( “/-(?<match>\\d)/ui”, “_$1”, $filename ); if ( rename( … Read more

Inserting dynamic content into a page

As you are building a page template, you can insert in the content of that template whatever you want and use any PHP snippet you want. So, you can continue doing it as you was doing in PHP. For example, this could be your page template: <?php /* Template Name: My template */ get_header(); ?> … Read more

Correct regex for wp_embed_register_handler

Just few notes here: We have to be careful using % within sprintf() to avoid confusion with the placeholders. Try to remove the CSS styles. It’s sometimes easier to use the # or ~ delimiters in regular expressions, instead of the / delimiter. Since you have the (players.brightcove.net/) as the first match, it might not … Read more