May 24th, 2010: Recently a client project required a breadcrumb navigation for all interior pages. After a bit of research and discovery of the useful WP function get_post_ancestors I created the following: Add to functions.php function my_breadcrumb() { if (!is_home()) { global $post; echo '<a href="'; echo bloginfo('url'); echo '">Home</a> < '; if(is_page() && [...]
March 25th, 2009: I spend a lot of time working with WordPress, using it for simple blogs and also as a CMS solution for client sites. Some of my most used code snippets and tricks I have listed below. Get your blog URL <?php bloginfo('url'); ?> Linking to an image/file (not from CSS file) In this case you [...]
January 23rd, 2009: While developing a registration form for a client I had the following problem: This form needed to be able to grab multi-record values for one table. In this case I had a form where a person could sign up more than one participant. (Using CakePHP standard form names) echo $form->input('Participant.0.first_name'); echo $form->input('Participant.0.last_name'); echo $form->input('Participant.1.first_name'); echo [...]
January 23rd, 2009: I needed to be able to generate PDFs for a client project and came upon this tutorial for using CakePHP and TCPDF. It turned out I needed to make some tweaks and after gathering info from different Google sources finally got it to work. Thought I’d save someone else the trouble and post my version. [...]
July 28th, 2008: Simple way to check if your WordPress post has an excerpt specified and either show the_excerpt or the_content. !empty($post->post_excerpt) Example: <?php if (!empty($post->post_excerpt)) { ?> <?php the_excerpt(); ?> <?php } else { ?> <?php the_content('<p>Continue reading</p>'); } ?>