Custom forms with HTML

In theory, this should work just fine if you are putting the code directly into a theme file, and not into a post body or something. However, it is very dependent on your site’s setup. Here are some things to watch out for: Permalink structure: if using GET requests to process the form, test to … Read more

Query pulling a single post per month

Maybe a bit less hacky: $months = array(); while(….){ list($month, $year) = explode(“https://wordpress.stackexchange.com/”, get_the_date(‘n/y’)); // eg. 7/11 if(in_array($month, $months)) continue; // skip $months[] = $month; echo ‘<li><a href=”‘.get_month_link($month, $year).'”>’.get_the_date(‘F Y’).'</a></li>’; } If you’re only getting 6 posts and you don’t need pagination that I guess it’s OK to go this way. Otherwise you need to … Read more

WordPress time queries

WordPress tries to set PHP environment to UTC timezone. Usually it is more reliable to use time zone-aware WP functions, such as current_time(), rather than vanilla PHP functionality.

Problem in replacing the_content with the_excerpt()

Are you sure you have replaced it in the correct template file? I found a useful way to tell by adding this to the functions.php file: <?php add_action( ‘wp_head’, ‘adminbar_print_template’ ); function adminbar_print_template() { global $template, $current_user, $wp_admin_bar; get_currentuserinfo(); /* If you have more than one user deny. Be sure to use your user ID! … Read more

Writing a link cloaking plugin

I don’t see why the same method can’t still work in a WordPress site. If you specifically specify a file to link to that is a valid PHP file, available on your server, then it will still hit that file instead of hitting WordPress. If you are having issues with this working, make sure you … Read more

Insert content into head tag with function

The content is modified with filters, not hooks. To modify the <title>, use wp_title filter Example: add_filter(‘wp_title’, ‘set_page_title’); function set_page_title($orig_title) { return ‘Modified ‘ . $orig_title; }