Category: Snippets

any code we publish

Quick Hack to Remove Auto ‘P’ Tag from Contact Form 7

Recently I had a situation where I needed to remove the auto generated ‘p’ tag from Contact Form 7, but could not do it in the conventional way. Contact Form 7 uses a number of constants, set in the WP config file, which allow behaviour changes. I always found that a bit of an odd approach (configuring a plugin’s options from the entire site’s config file), but it generally caused little concern. On this project, however, it was not possible since the site lives on a multisite install and only one theme required the change.

Surprisingly, I found no other filter options that could be accessed easily. I’m sure it can be done, but in the time I had I didn’t find anything. So the quick and dirty answer was to write a jQuery hack that can simply remove the ‘p’ tag for this one site. Here it is:

jQuery(document).ready(function ($) {

$(".wpcf7-form").find("p").contents().unwrap();

});

Create a custom walker class to extend wp_list_pages

The Walker class in WordPress is used to create hierarchical navigation links. It works by ‘walking’ — or iterating — over the data in the database and then outputting the results according to the parameters that have been set. The nice thing is that by using inheritance the class can be extended and manipulated in a child theme to output in a way that might be more suitable to the project at hand.
Continue reading

How to Move WordPress from Local to Live Seamlessly

One of the most common and tedious tasks for WordPress developers is constantly having to move files from local development to the remote server where it can be accessed online. Typically this will be some kind of staging server where online quirks can be sorted out and the client can have a look at the site before it is published. File updates, if coded correctly, will generally not cause any problem since the internal linking should all be relative. But content changes of any kind will affect the database and require the database records to be adjusted, and that is where the tedium can set it.
Continue reading