Category Archives: Tutorials

Absolute Minimum for a Working WordPress Theme

Let’s say you are thinking about all the files that a typical WordPress theme contains and wondering what of that is actually necessary for your site to work. If you are in need of a very simple theme, say to display an images or few, you could quickly make it from scratch. Here is the start.

The minimum requirement for a WordPress theme to work are index.php and style.css files.

The style.css file sets the name of your theme which will be displayed in the dashboard. The format is this:

/*
Theme Name: My New Minimal Theme
*/

That’s it, we only enter the theme’s name. Please note the commenting, it is required. Below this part is where your style will be added.

The minimum of content for the index.php file is a loop in it’s simplest form:

<?php
  if ( have_posts() ) : while ( have_posts() ) : the_post();
   the_content();
  endwhile; endif;
?>

That’s it. You will be able to show the content of whatever page or post(s) are set to display as homepage.

Now we can easily build from there. To add a post title, the code should look like this:

<?php
  if ( have_posts() ) : while ( have_posts() ) : the_post();
   the_title();
   the_content();
  endwhile; endif;
?>

And so on… In the next post we’ll be adding navigation. And let’s see just how many lines of code it takes to make a simple, functional and responsive theme.

WordPress Automatic Update without FTP

Insert this line at the end of your wp-config.php file. This file is found in your site’s public root directory, sometimes called www, httpdocs or public_html.

define('FS_METHOD','direct');

This will allow your site to bypass all the permission and file ownership warnings and update your WordPress installation to the latest version.

Better SEO: Custom Meta Description for Every WordPress Post, without Plugins

Search engines use page’s meta description in search result snippets to provide more information about the content of the page and it’s relevance to the user’s query. Google recommend that you include a unique, descriptive meta description for each page. They sensibly prefer it to an auto-generated one, cobbled together out of words, phrases and chunks of sentences found throughout the page or entire site.

WordPress does not provide meta description out-of-the-box. While there are some excellent plugins that can greatly improve your site’s search engine friendliness, good practice is to keep the number of plugins to a minimum, especially when DIY solution is an easy one, as in this case.

To add the custom meta description feature to our site, we’ll make use of custom fields: the ability to include any number of key/value pairs with a post and then use them as needed.

So, let’s create a key/value pair by typing it into the form as shown bellow. The name of my key will be description, and for its value I’ll type in the meta description I want to use for my post:

wp-custom-field-meta-description-visual-culture.me

Now that we have the content of our new meta description for our post, all that’s let to do is call our meta key up and use it’s value in our page. Place the following code within the <head> tag in your template’s header.php file:

<meta name="description" content="<?php
	get_post_meta($post->ID, 'description', true);
?>" />

This is it. The HTML code for your page will now look like this:

wp-head-tag-code-visualculture-me

And this is how the link will appear in Google search results:

wp-google-snippet-visualculture-me

Event Espresso Confirmation Email Settings

Event Espresso allows setting and customization of the outgoing registration confirmation email message in three different ways:

1. Through the general default email template,

2. Through saved custom email templates, and

3. In the settings page of each individual event.

1. General Settings page

On the plugins General Settings page scroll to Default email template box. The content of the box is a template for a default confirmation email that will be sent out unless the settings are overridden manually for the individual event (via options 2. or 3.).

Notice the example content in the email box. It consists of plain text as well as bits of instructions for the program, called shortcodes:

Thank You [fname] [lname]

Shortcodes will be replaced by the actual information from the registration form, so in the confirmation email in place of [fname] and [lname] customer’s real name will be used instead.

Edit the general template if one confirmation email format is sufficient for all your events, e.g., if you offer just one kind of events, say, a photography class.

If you find you will need more then one email templates for different types of events, look at:

2. Custom templates

Email Manager, found in Event Espresso General Settings menu, allows for creation of any number of confirmation email templates that can be saved and latter assigned to individual events as needed.

On the Email Manager page click on Add New Mail and fill out the form. The Email Name is the name of your template for your reference and you can be descriptive here as it’s useful. In the next field, Email Subject Line, enter the subject of the confirmation email as it will appear in your customer’s mailbox. Email Text field is for the body of your message. Use plain text and shortcodes as in 1. Complete list of shortcodes available bellow.

Once your email template is saved, it will become available to be assigned for each of your events. To assign a template to an event go the event editing screen and scroll down to Email Confirmation box. Select “Yes” in the first drop down menu and the title of your template you’d like to use.

3. Individual event’s custom confirmation email

On the event settings page, in the Email Confirmation box, Select “Yes” for “Send custom confirmation emails for this event?”. Leave pre-existing email drop-down menu empty and in the bottom box after “Create a custom email:” type the content of your email sign-up confirmation email. As in 1. and 2., use plain text and Event Espresso shortcodes. The template entered here will be used for this event only.

Event Espresso email confirmation shortcodes:

[registration_id], [fname], [lname], [phone], [edit_attendee_link], [event], [event_link], [event_url], [ticket_type], [ticket_link], [qr_code], [description], [cost], [company], [co_add1], [co_add2], [co_city],[co_state], [co_zip],[contact], [payment_url], [invoice_link], [start_date], [start_time], [end_date], [end_time], [location], [location_phone], [google_map_link], [venue_title], [venue_address], [venue_url], [venue_image], [venue_phone], [custom_questions], [seating_tag]