Tag Archives: WordPress

Inline Style in WordPress Caption Shortcode

Those 10px the [Caption] tag adds to the attachment div, likely breaking your style in the process, are fixed with the following. The style tag setting width has been commented out.

add_filter( 'img_caption_shortcode', 'cleaner_caption', 10, 3 );

function cleaner_caption( $output, $attr, $content ) {

	/* We're not worried abut captions in feeds, so just return the output here. */
	if ( is_feed() )
		return $output;

	/* Set up the default arguments. */
	$defaults = array(
		'id' => '',
		'align' => 'alignnone',
		'width' => '',
		'caption' => ''
	);

	/* Merge the defaults with user input. */
	$attr = shortcode_atts( $defaults, $attr );

	/* If the width is less than 1 or there is no caption, return the content wrapped between the < tags. */
	if ( 1 > $attr['width'] || empty( $attr['caption'] ) )
		return $content;

	/* Set up the attributes for the caption <div>. */
	$attributes = ( !empty( $attr['id'] ) ? ' id="' . esc_attr( $attr['id'] ) . '"' : '' );
	$attributes .= ' class="wp-caption ' . esc_attr( $attr['align'] ) . '"';
/*	$attributes .= ' style="width: ' . esc_attr( $attr['width'] ) . 'px"';   */

	/* Open the caption <div>. */
	$output = '<div' . $attributes .'>';

	/* Allow shortcodes for the content the caption was created for. */
	$output .= do_shortcode( $content );

	/* Append the caption text. */
	$output .= '

' . $attr['caption'] . '

'; /* Close the caption </div>. */ $output .= '</div>'; /* Return the formatted, clean caption. */ return $output; }

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]