How to Stop a Post's Featured Image Appearing in Site Header

The TwentyTen theme has an annoying feature which causes the image in your site header to be replaced by a post's Featured Image. I have no idea what they were thinking, other than that the featured image wasn't used anywhere else in the theme, so perhaps they should use it to override the image in the header.

Well that's a bad idea. Even though the theme doesn't use it, sites like Facebook will use the featured image as the thumbnail when a post is shared. It just doesn't make sense to change your site header according to the featured image.

In order to fix this, you have to edit your theme's header.php, preferably by creating a child theme. Search for these lines:

// Check if this is a post or page, if it has a thumbnail, and if it's a big one
if ( is_singular() && current_theme_supports( 'post-thumbnails' ) &&
        has_post_thumbnail( $post->ID ) &&
        ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
        $image[1] >= $header_image_width ) :
    // Houston, we have a new header image!
    echo get_the_post_thumbnail( $post->ID );
elseif ( get_header_image() ) :

And change them to:

// Always use the header image; dont put the featured image in the header!
if ( get_header_image() ) :

If you use MailPress, note that it attempts to follow suit; and even worse, in doing so it triggers a bug that prevents posts with a featured image from being sent at all. See this article on how to modify it too.

Posted in Themes | Tagged , | 2 Comments

How To Disable OpenGraph Tag Generation In Simple Facebook Connect

The Simple Facebook Connect plugin is the best way I've come across to automatically update your Facebook wall and/or fan page when you post. It seems to do a better job than the Facebook plugin, and is free unlike Network Publisher who recently reduced the number of networks you can share on for free dramatically.

However, Simple Facebook Connect uses an evil hack to generate OpenGraph tags based on a WordPress post's contents that causes the post to be generated twice internally. This causes subtle conflicts with many other plugins, including MailPress. Plenty of other plugins can generate OpenGraph tags, but you can't have more than one doing the job at any time and there's currently no automatic way to arbitrate between them, so we need a way to disable this feature in every plugin that supports it.

There's currently no option to disable OpenGraph tags in Simple Facebook Connect. I asked the author to add such an option since it causes conflicts with several other plugins but he declined.

However, you can work around this by adding the following code to your WordPress theme's functions.php:

/* Turn off Simple Facebook Connects evil OpenGraph tag generation */
remove_action('wp_head','sfc_base_meta');

Then enable OpenGraph tag generation in one of the other plugins capable of doing it. My current recommendation is to enable it in WordPress SEO by Yoast.

Posted in Social Media | Tagged , | Comments Off on How To Disable OpenGraph Tag Generation In Simple Facebook Connect

Updating Your Facebook Status Automatically With Facebook Plugin

Facebook have written their own plugin which allows you to update your Facebook status automatically via it's Social Publishing feature. There are other plugins out there that can do this for you, but I thought I'd try the plugin written and maintained by the Facebook team themselves. It works, but there are a few things to look out for.

Continue reading

Posted in Social Media | Tagged , | 2 Comments

How To Include A "Continue Reading..." Link In Your Newsletter

Having an automatic newsletter distributing your blog's content to your readers is great; but it does have one downside: readers don't have to visit your site to read your content, so you have less traffic than you otherwise would.

The solution to this is to have a Continue Reading... link in your newsletter. You start with a tasty introduction describing what you're about to say in order to hook your readers, and then they click on the link in order to read the rest of the article on your site. So how do you do this?

Continue reading

Posted in Email | Tagged , | Comments Off on How To Include A "Continue Reading..." Link In Your Newsletter

Fix For “Loading...” Keeps Spinning In MailPress

One of the most annoying problems I encounter regularly with MailPress is the “Loading...” icon keeps spinning in the subscription form. Sometimes it spins before you've even done anything; other times it spins after form submission and never stops.

It's always some form of problem with the MailPress Javascript or CSS used to power the form. I recommend you apply the following changes to any new MailPress installation, so that you can save yourself the grief of having to deal with this annoying problem.

If you're applying my MailPress hacks, it'll be called “Processing...” instead of “Loading...”. Either way, the solution is the same.

Here are my solutions:

Enable MP_wp_enqueue_script

There is an option in MailPress that enqueues the problematic Javascript for generation at the bottom of the page. With recent versions of WordPress, this is pretty much always a good thing; but this option isn't the default yet as it requires your theme to call wp_footer in footer.php. Any decent theme should be doing this anyway, but it's worth checking first.

To enable this option, copy or rename mailpress-config-sample.php in the mailpress top directory to mailpress-config.php

Edit the file and remove the // comment at the start of the line:

define ('MP_wp_enqueue_script', true);

Add The MailPress Widget CSS Rules To Your Themes style.css

By default, MailPress inserts style information for it's signup form inline. You could argue that it shouldn't be doing this, and you'd probably be right because it breaks in certain situations.

For example, if you use SEO Smart Links Pro and create a custom tag for “MailPress” (which you probably don't; but I do, because I write about it on this blog), the style information gets damaged because SEO Smart Links Pro isn't expecting it to appear in the middle of a post.

The fix is to move the MailPress form style information to your WordPress theme's style.css. Add these lines there:

div.MailPress div.mp-container, div.MailPress div.mp-formdiv {
 position:relative;
}

div.MailPress div.mp-loading, div.MailPress div.mp-message {
 position:absolute;
 filter:alpha(opacity=0); // IE
-moz-opacity:0;
-khtml-opacity: 0;
 opacity:0;
}

Then, in the MailPress widget (under Appearance → Widgets → MailPress), tick the box next to “Preloaded: CSS”

Conflict With Simple Facebook Connect Plugin

If you use the Simple Facebook Connect plugin to update your Facebook wall or fan page automatically when you post, you may notice the MailPress “Loading...” icon spinning when you use the mailpress shortcode on a page along side the MailPress widget. This happens because the Simple Facebook Connect plugin uses an evil hack to generate OpenGraph tags based on a WordPress page contents, which causes the WordPress page to be generated twice internally. Second time around, the MailPress widget CSS rules mentioned above get omitted.

This problem is also fixed by putting the MailPress widget CSS rules into your WordPress theme's style.css, as described above and specifying “Preloaded: CSS” in the MailPress widget.

If that's too hard or doesn't work for you, you can disable OpenGraph tag generation in Simple Facebook Connect. Then enable OpenGraph tag generation in one of the other plugins capable of doing it, like WordPress SEO by Yoast.

Alternatively, use the Facebook plugin instead of Simple Facebook Connect, which has the potential added bonus that it was written by Facebook engineers, so it may be better insulated from future Facebook API changes. Unfortunately it's not as easy to configure as Simple Facebook Connect and has way less features.

If you can't get the Facebook plugin to work, you can always fall back to Network Publisher, which does all the hard work for you; for instance, you don't need to create your own Facebook app for it to work. The downside is that the “via” link it generates in your postings links to their app instead of yours.

Posted in MailPress | Tagged , , , | 1 Comment

How to Add a Horizontal Banner Ad to Your Mailpress Newsletter

Want to advertise a product or service in your MailPress newsletter? I did this by adding a horizontal banner ad at the bottom of the newsletter email, just above the footer. Here's how:

Firstly, create a horizontal banner ad image using The Gimp or some other graphics editing package. Make it the same width as the header image in your theme, which you can work out by looking for HEADER_IMAGE_WIDTH in your MailPress theme's MP_theme_html.class.php. I found a height of about 100 pixels looked good for me. Save the image in your theme's images directory named horizbanner.jpg.

Secondly, add these lines to the end of the style array in your theme's style.php:

'bannerad_img' => "margin:0 4px; border:none; padding:0;",

Finally, add these lines to the top of your theme's footer.php:

<a href="http://site.com/targeturl" title="Click Here to Get The Product" rel="generator">
    <img src='images/horizbanner.jpg' <?php $this->classes('bannerad_img'); ?> />
</a>

Customise the target URL in the href field to point to the page you want readers to visit when they click, and the title to describe the product they'll be getting.

Posted in MailPress | 12 Comments

How to Migrate from SEO Ultimate to WordPress SEO by Yoast

I've tried a few WordPress SEO plugins over the years, from All In One SEO Pack to Robots Meta and then to SEO Ultimate; but that was before Joost de Valk (a.k.a. Yoast) released WordPress SEO by Yoast which is now my SEO plugin of choice for WordPress. If you want the definitive answer at who is the best SEO guy for WordPress, just do a Google search for WordPress SEO and see who ranks in position #1. That's one reason why I'm switching from to Yoast's plugin, and it has some other great features too like an awesome search results preview that helps you to optimise not just your search ranking, but also click-through rates.

Switching SEO plugins is no mean feat since you've probably already got meta descriptions and other information that you don't want to lose. There are also a few other tricks to migrating, so here's a step-by-step guide:

Installation and SEO Data Migration

Firstly, install and activate WordPress SEO by Joast.

While WordPress SEO by Joast can import data directly from several other SEO plugins, it can't handle SEO Ultimate directly. But never fear, because SEO Data Transporter can do the job, so install and activate it too.

Import the settings from SEO Ultimate using Tools → SEO Data Transport and selecting from: SEO Ultimate, to: WordPress SEO and Convert.

Disable SEO Ultimate and SEO Data Transporter plugins.

Configure WordPress SEO by Yoast

The WordPress SEO by Yoast settings appear in the main dashboard menu under SEO. I recommend you do the introduction tour to familiarise yourself with what the plugin has to offer.

If you've been using Yoast's RSS Footer plugin, go to SEO → Import and use Import from RSS Footer. Then disable the RSS Footer plugin as you won't need it any more. You could do the same for Robots Meta, but it's unlikely you'd be using that with SEO Ultimate.

Now go to SEO → Dashboard and set your main settings.

Select Disable date in snippet preview for posts, unless your posts are intentionally time-sensitive; generally you want to write evergreen content and you don't want Google's previews showing that your posts are “old” if they still contain great, relevant content.

Every now and then, some supposed SEO expert guy who claims to get paid thousands for his advice looks at my site for free and says “You don't have any keywords”, meaning that I don't have keyword meta tags. It won't help your search ranking since Google doesn't use keyword meta tags, but it will shut these guys up and possibly have them to keep looking for something that would improve your search ranking. Or maybe you want to just weed them out by leaving keyword meta tags disabled.

Personally, I like the idea of having keywords meta tags but don't want to go to any effort to generate them. You can do this easily with Yoast's plugin assuming you're using sensible WordPress category and tag names. So I enable Use meta keywords tag, and on SEO → Titles set your Post Meta keywords template to:

 %%category%%,%%tag%%

I leave all the other Title settings blank, allowing the plugin defaults to do their best.

Under SEO → Indexation, select the checkboxes to disable Date-based archives, Tag archives and Post Formats archives to limit duplicate content on your site and ensure that these are never returned in search results instead of your actual posts. Leave Category archives deselected (i.e. enabled) unless you aren't using categories at all.

Under Archive Settings, select the checkboxes to Disable the date-based archives and Disable post format archives. If your blog is your personal home site so you'll only ever have one author and your home page shows your archive, select Disable the author archives too.

Under SEO → Permalink Settings, select Strip the category base so your category archives appear in the logical place in the URL namespace. If you were previously using WP No Category Base to do this, disable that plugin.

Under SEO → Internal Links you can configure your breadcrumbs, which are supposed to be good but you need to add them to your theme. Can't say I've got around to this on my sites yet.

Under SEO → RSS add your RSS Footer settings to Content to put after each post. This helps give you backlinks from evil content scrapers who repost your RSS feed on their sites. I suggest:

<em>%%POSTLINK%%</em> is a post from <em>%%BLOGLINK%%</em>

Sitemap Configuration

Disable your old sitemap plugin, like Google XML Sitemaps.

Delete the files sitemap.xml and sitemap.xml.gz created by your old XML sitemaps plugin from your root directory using Filezilla. If you don't do this, Google will never see the updated sitemap from Yoast's plugin!

Under SEO → XML Sitemap select Check this box to enable XML sitemap functionality, Ping Yahoo! And Ping Ask.com.

Go to SEO → Edit Files Robots.txt and modify your Sitemap line to read like:

Sitemap: http://yoursitename/sitemap_index.xml

If you have manually submitted your old sitemap to Google Webmaster Tools, log in there and delete it. Google and other search engines can find the sitemap automatically from your robots.txt file.

Missing Features

SEO Ultimate has some features that WordPress SEO by Yoast doesn't have. If you use these features you'll need other plugins to compensate:

Deeplink Juggernaught: Install SEO Smart Links Pro and migrate your custom keywords manually.

Rich Snippets: Install GD Star Rating and migrate your ratings manually.

Slug Optimizer: Install Smart Slug (SEO Slugs hasn't been updated in a long time).

Clean Up

Delete whichever plugins you've disabled as you won't be needing them any more.

And you're done!

Posted in Plugins | Tagged , | 45 Comments

Workaround for Poor Embedded Video Support in Email Clients

WordPress has a neat feature that allows you to easily embed content from video sharing sites such as YouTube by simply writing the URL of the video you want to embed in your post, like this:

http://www.youtube.com/watch?v=RJM4697kLL4

When your post is displayed, this gets replaced with an iframe which contains the content you wanted to embed, like this:

This works great in a web browser, but isn't so good in your MailPress newsletter, because most email clients don't support iframes. Your readers end up with a newsletter with a blank space instead of the embedded video content. Andre has done some experiments to address this, but nothing has seen the light of day yet. The problem isn't really MailPress's fault, but it does make newsletters with postings containing embedded videos look pretty odd at present.

As a workaround, I suggest disabling the automatic embedding so that the email reader at least sees the link to the video instead of a blank space. To do this, add the following line to the top section of your MailPress theme's _loop.php where you disable content filter plugins that aren't compatible with MailPress:

remove_filter('the_content', array(&$GLOBALS['wp_embed'], 'autoembed'), 8 );/* Dont process autoembeds */

That will stop the link turning into an invisible iframe in the email. In order to make the link clickable, you also need to install the Auto-hyperlink URLs plugin. This will make all plain text URLs in your content clickable on your website, not just in MailPress newsletters; but that's probably not a bad thing. I suggest changing the Auto-hyperlinks default settings to avoid stripping the protocol so the link looks the way it did in your editor.

Posted in MailPress | Tagged , | 4 Comments

No more dofollow for this blog, I'm afraid

I'm getting way too many spammy comments from visitors who are clearly only interested in a dofollow backlink. Many of them look like they've been human generated but they're not adding value, so I've decided to disable the Do Follow plugin on this blog. I no longer recommend this plugin as it attracts too many link seekers who aren't really interested in engaging with you as a blogger.

From now on if you want a dofollow backlink, you'll have to play by CommentLuv Premium's rules and share the article before leaving your comment.

Posted in Plugins | Tagged , , , | 20 Comments

My MailPress Hacks

I have a small list of hacks that I make to MailPress every time I upgrade. It's been shrinking as some of the issues have been addressed in the plugin, but I thought I'd share my local modifications with you:

Remove "[Blog Name] New post" from Subjects

I'd rather have the Subject line of my newsletters read like a personal email than an automatically generated one, so I change:

mp-content/advanced/newsletters/post/post.xml:
Under <mail><subject>
Strip "[%1$s] New post : "

mp-content/advanced/newsletters/post/categories/categories.xml:
Under <mail><Template>singlecat</Template><subject>
Strip "[%1$s] New post in {{the_taxonomy}} : "

Friendlier Messages

I like messages that are clear to non-MailPress users, so I change:

mp-content/languages/MailPress.pot:4149 &
mp-includes/class/MP_Widget.class.php:104:
Change "Waiting for your confirmation" to "Check your inbox and confirm your email address"

mp-content/languages/MailPress.pot:4133 &
mp-includes/class/MP_Widget.class.php:99:
Change "Loading..." to "Processing..."

Featured Images

Apply the hack to avoid featured images appearing in the header image of the email. If you don't do this, posts with a featured image won't get processed.

Posted in MailPress | Tagged | 4 Comments