Add Jetpack Subscribe Form To Bottom of All WordPress Posts & Pages

You may have noticed I’ve added subscribe widgets at the end of every post, right below the related articles. It’s really simple to do, and comes built-in with the Jetpack WordPress Plugin.

First, make sure you’re using a child theme so you’re not changing the core code of your theme, as your changes will be lost on updates. You can read about creating a child theme here at the WordPress Codex.

1. Register New Sidebar

First, add this to your functions.php file. It will register a new sidebar called Subscribe In Page.

register_sidebar( array(
    'name' => 'Subscribe in page',
    'id' => 'subscribe-in-page',
    'before_widget' => '<div id="subscribe">',
    'after_widget' => '</div>',
    'before_title' => '<h3>',
    'after_title' => '</h3>'
) );

2. Call Our New Sidebar

Now, in your WordPress loop, find something like <?php the_content(); ?>. Here’s what my the_contenet() call looks like:

<div class="entry-content" itemprop="mainContentOfPage">
    <?php the_content(); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-links-next-prev">', 'after' => '</div>', 'nextpagelink' => '<button class="next-page-nav">' . __( 'Next page &rarr;', 'independent_publisher' ) . '</button>', 'previouspagelink' => '<button class="previous-page-nav">' . __( '&larr; Previous page', 'independent_publisher' ) . '</button>', 'next_or_number' => 'next' ) ); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'independent_publisher' ), 'after' => '</div>' ) ); ?>
</div>
<!-- .entry-content -->

Notice there’s a couple functions after the_content(), this is normal and will vary from theme to theme. Any plugins you’ve got set to appear below your post will be shown, and then the subscription form will be shown.

4. Add Your Jetpack Subscribe Widget

Just like adding a normal widget. Go to Appearances, and then Widgets. You should see an area titled Subscribe In Page. Drag the Blog Subscriptions (JetPack) widget into the Subscribe In Page sidebar area. Configure it, save it.

5. Add The Sidebar To The Theme

To add the Jetpack subscription form, add <?php dynamic_sidebar( ‘subscribe-in-page’ ); ?>, which calls our custom sidebar, to your loop. It should go somewhere under the_content() if you want it to show at the end of the post. If you want it at the beginning, add <?php dynamic_sidebar( ‘subscribe-in-page’ ); ?> before the_content().

You’re Done!

And that’s really all there is to adding a subscribe form to the end of each post. You can also add the same subscribe form in the sidebar, like I have at longren.org. As a note, the Jetpack plugin is packed full of functionality. Chances are good that you’ll find more Jetpack modules to use, other than the Subscriptions module.

Do you use the Jetpack plugin for WordPress?

View Results

Loading ... Loading ...
2+

Freelancing Tips, Other Than “Networking”?

Thinking about doing some freelance work for a while, especially now that kegplan.io is nearing launch. There was just a thread on HN today about freelancing, or getting a “real” job. Getting recurring freelance work can be difficult, but a “real” job provides a steady paycheck. And there’s this post on Reddit about breaking into the freelance scene, which means being able to make a real living from freelancing.

Most suggestions I hear are about starting freelancing are pretty obvious. Network, network, network. The most up-voted answer on that Reddit thread starts off “Network, network, network. It’s less about what you know, and often more about who you know.” I think most people over the age of 13 know that, so it’s really not all that helpful.

Constant networking isn’t always possible, at least not without major sacrifices (read: family being pissed). If I’m out networking all the time with friends who have a lot of contacts, friends-of-friends, possible clients, and just committing to making lots of new contacts in general, that leaves little time for family (not to mention other things).

Is it just a natural progression? Like, the longer you’re in it, the more stuff comes your way? If so, that would make the claim of network, network, network a bit misleading, it implies urgency (at least to me). Seems like network carefully and methodically is more apt. Yet, that still brings up issues, like the possibility of not going hard enough and not living up to your potential.

Do you do freelance work?

View Results

Loading ... Loading ...

So maybe there are no real tips that can be given on freelancing, other than to just stick with it.

I closed my LinkedIn account a long time ago, should I open it back up? I do literally no “online” networking, all geographical and in-person. I do have an oDesk account, which is 100% complete and I’ve completed 5 tests. My oDesk account is entirely filled out.

I’ve been thinking of doing this for a while, but @daniAWESOME made me think a lot more about it.
https://twitter.com/daniAWESOME/status/439090606145421312

Any successful freelancers have any advice? Leave a comment, or @tlongren on Twitter.

0

Mist.io for DigitalOcean, and Every Other Cloud Provider, Is Awesome

Control all the things!

I love mist.io. However, I’ll stick with DigitalOcean Swimmer (Android only) for now. There’s even a few good looking iOS apps, but I haven’t tested them, Droplets for DigitalOcean and DigitalOcean Manager. Hopefully, paying for monitoring as well is something I can justify in a few months, when I have a steady job or am getting along with freelancing, which is really what I’d like.

But anyway, mist.io is a really nice service, but the website could use an update. It almost has a standard jQuery mobile feel to it. However, I do know they’re working on some UI changes that should be a vast improvement. But aside from that, the functionality is itself great. You can do the usual, like create new droplets, edit droplets, and you can add multiple backends.

Backends in mist.io are just connections to hosts, like DigitalOcean or Linode. They support a lot of backends, like RackSpace, OpenStack, AWS, HP Cloud, NephoScale, and even bare metal.

The DigitalOcean Swimmer Android app has a great interface, too. It seems to mostly abide by the Android style guide, which is freaking awesome. There’s a little gallery at the end with some screenshots of it as well as the mist.io website.

I love all the apps that support DigitalOcean (referral link), it’s partly why it’s so appealing to me. I really like mist.io because it supports sooo many providers though. The mist.io site looks good on a mobile device, but could still use some updating, which I’d be surprised if they weren’t already working on.

When I do add another different hosting provider (probably Linode), I’ll happily pay for the mist.io service. A real, native Android and even iOS client would be killer, please mist.io? :)

Photos below are of the mist.io site and a couple screenshots from the DigitalOcean Swimmer Android app. For iOS screenshots, see here and here.

Have you used mist.io prior to reading this post?

View Results

Loading ... Loading ...

At the very least you should give mist.io a try. All of the management features are free, like SSH key management, spinning up machines, and image managemenet. Monitoring is the only thing that is paid. So, you can get some really good use out of mist.io totally free!

0

Add Schema.org Markup To Any WordPress Theme

Make Google, Yahoo, and Bing like you more!

The last post I made on this topic was a bit too specific to the Independent Publisher theme and was more editorial like, which made it really hard to follow. So, at the request of Manish Suwal ‘Enwil’, I’ve decided to write a more generic version that should apply to most, if not all, WordPress themes.

Please note that the class names used below could be different in the theme you’re using, so it’s mostly important to just pay attention to the HTML tags themselves, unless you’re doing something with a div, span, etc.

There’s 6 steps, although step 6 has a few different parts to it.

1. First, you’re going to want this PHP function, a slightly modified version from Paul Lund. This function defines the schema type based on the type of content being displayed (article, author profile page, search results page, etc). Add this function to your themes functions.php file. The function is named html_tag_schema(). You can find it here:

2. Find the <html> section of your theme and add our html_tag_schema() function. This will output the proper result from html_tag_schema(). It should look like the following:

<html class="no-js" <?php schema_org_markup(); ?> <?php language_attributes(); ?>>

3. The page title tag is usually the same as the title of the page, so you can add this to your titletag:
<title itemprop="name"><?php wp_title(''); ?></title>

4. Now you’ll need to find the part of your theme that contains the_content() function. It could look something like this:

<div class="entry-content" itemprop="mainContentOfPage">
  <?php the_content(); ?>
</div>

5. It’s generally a good idea to let Google (and other search engines) know when an article/post was published. You can also tell them if/when an article has been updated. Both of these can be taken care of with schema.org markup:

<time class="entry-date" datetime="<?php the_date('c'); ?>" itemprop="datePublished" pubdate><?php the_time( get_option( 'date_format' ) ); ?></time>

6. You can apply schema.org markup to any image, but it’s easiest when your theme supports featured images. I think most themes do support Featured Images now, and if your theme doesn’t, just add Featured Image support yourself, or kindly ask the theme developer to add support. I could probably help you out, too.

6a.If your theme supports Featured Images, it should make use of the the_post_thumbnail() function. Find that function in your theme and replace it with this:
the_post_thumbnail( ‘thumbnail’, array(‘itemprop’=>’image’ ) );

6b.If the ‘thumbnail’ parameter value in your existing the_post_thumbnail() function is something other than ‘thumbnail’, make sure to keep that original paramater value. For example, if your the_post_thumbnail() call looked like the_post_thumbnail( array( 700, 700 ) );, adjust your the_post_thumbnail() function call to the following:
the_post_thumbnail( array( 700, 700 ), array(‘itemprop’=>’image’ ) );

6c.The array( 700, 700 ) piece can be replaced by whatever size you want. The first array value is the width, and the second is the height. There’s a variety of image sizes pre-defined by WordPress:

The default image sizes of WordPress are “thumbnail”, “medium”, “large” and “full” (the size of the image you uploaded). These image sizes can be configured in the WordPress Administration Media panel under Settings > Media. This is how you can use these default sizes with the_post_thumbnail() and schema.org markup:
the_post_thumbnail(); // without parameter -> 'post-thumbnail'

the_post_thumbnail(‘thumbnail’,array(‘itemprop’=>’image’ )); // Thumbnail (default 150px x 150px max)
the_post_thumbnail(‘medium’,array(‘itemprop’=>’image’ )); // Medium resolution (default 300px x 300px max)
the_post_thumbnail(‘large’,array(‘itemprop’=>’image’ )); // Large resolution (default 640px x 640px max)
the_post_thumbnail(‘full’,array(‘itemprop’=>’image’ )); // Full resolution (original size uploaded)

the_post_thumbnail( array(100,100), array('itemprop'=>'image' ) ); // Other resolutions (100x100)

That’s it!

If you want to know more about schema.org, have a look at my original post. Schema.org is also a wonderful resource, their documentation is excellent and would advise that you read through the Getting Started Guide, it provides a great overview of the concepts behind structured data and schema.org.

Other Resources

Google has this little post about adding schema.org markup for organization logos. If you’re an organization, you should probably see what that’s all about.

Craig Bradford at Moz.com says you’re behind if you’re not using schema.org yet. That post from Craig also has a lot of really good information for those new to schema.org and structured data.

Google also has a post about adding schema.org markup to videos, which could be really useful if you run a site with a lot of video content.

Searching the Google Webmaster Central Blog for “schema” yields some pretty useful results, too.

End

That’s all there is to adding basic schema.org structured data to your WordPress theme. You could obviously extend it to support more schema.org “things”, but I’ll leave that for you. If you did every step in this post, you’ll have schema.org markup for featured images, article publish and update time, main content declaration and structured data enabled title and head HTML tags.

Should more WordPress theme developers start building schema.org markup into their themes?

View Results

Loading ... Loading ...
No structured data? You suck.

Have any questions, comments, or maybe even praise? Comments are open, as usual.

0

WordPress Theme Devs: Add Schema.org Markup To Your Themes

I’m using the Independent Publisher theme. I made a child theme to add schema.org markup a few days ago. Instead of hoarding it, I sent a pull request on GitHub with the schema.org markup for inclusion in Independent Publisher.

Not sure what schema.org is? It’s a widely adopted microdata format, similar to microformats. Schema.org, however, is supported by all the major search engines, giving it a definite edge over other microdata. The FAQ at schema.org is definitely worth checking out.

Structured Data Markup HelperGoogle also has a Structured Data Markup Helper that helps you add structured-data markup to a sample page. Just give it a URL, select an element and choose which structured-data to apply.
Structured Data Markup Helper Interface
It’s not like there’s no WordPress themes without schema.org markup built-in, but there’s certainly not many. I don’t even have this built into my WordPress themes, I should update Rootdip with schema.org markup. Unwakeable, however, hasn’t been maintained in forever, and schema.org didn’t even exist back then.

There’s plenty of plugins for adding schema.org markup to your WordPress site, but I think it makes sense to just integrate it right into the theme. The theme developers know exactly where their tags are, preventing the need to add additional info to the end of the post that’s wrapped in schema.org markup.

I tried out the All In One Schema.org Rich Snippets plugin, but it would require me to enter duplicate content (title, description, etc). It would also display a box at the end of each individual post page containing that extra, unnecessary content.

Because of that, I decided to just add the schema.org markup myself. It’s really very simple and only took about 15 minutes to do. Google likes schema.org data, and making Google happy is important to the ranking of your site. 15 minutes is definitely worth the time to do it right.

Paul Lund has an excellent write up on adding schema.org to your WordPress theme. This post by Isabel Castillo basically spelled out how to add the proper attributes to images, which was one thing missing in Paul’s post.

Anyway, here’s what I’ve put together as a basic starting point for integrating schema.org into your WordPress theme. Stuff is probably missing, some stuff may be incorrect. If so, please let me know in the comments.

Should more WordPress theme developers start building schema.org markup into their themes?

View Results

Loading ... Loading ...

Before you begin

If your theme doesn’t include some of the tags mentioned below, like <header>, <footer> , <article> , and <time> , you can use regular <span> tags instead. Just make sure you keep the itemscope attributes and their values.

Modify single article file

This is usually single.php, content-single.php, or something similar. Find the <article> tag and add the following to the end:
itemscope=”itemscope” itemtype=”http://schema.org/BlogPosting” itemprop=”blogPost”

If your theme supports post thumbnails, find the_post_thumbnail(); function and replace it with something like this:
the_post_thumbnail( ‘thumbnail’, array(‘itemprop’=>’image’ ) );

Now find where the post date/time is being displayed. You’ll want to wrap it in a <time> tag like below. You can also use a regular <span> tag as well, just be sure to add the itemprop=”datePublished” and pubdate attributes.
<time class=”entry-date” datetime=”<?php the_time(‘Y-m-dTH:i:sO’); ?>” itemprop=”datePublished” pubdate><?php the_time( get_option( ‘date_format’ ) ); ?></time>

Next find where the title is printed, usually between h1 tags, add an itemprop attribute with a value of name, like so:
<h1 class=”entry-title” itemprop=”name”><?php the_title(); ?></h1>

Now add another itemprop attribute wtih a value of mainContentOfPage to the div containing the_content(); WordPress function:
<div class=”entry-content” itemprop=”mainContentOfPage”>

Modify header.php

Only a few easy changes in this file. First, change your <html <?php language_attributes(); ?>> to look like this:
<html <?php html_tag_schema(); ?> <?php language_attributes(); ?>>

Next, change your <body> tag to this:
<body <?php body_class(); ?> itemscope=”itemscope” itemtype=”http://schema.org/WebPage”>

If your theme has a <header> element, change it so it’s similar to this:
<header id=”masthead” class=”site-header” role=”banner” itemscope itemtype=”http://schema.org/WPHeader”>

Modify footer.php

If you theme has a <footer> element, modify so it resembles the code below:
<footer id=”colophon” class=”site-footer” itemscope=”itemscope” itemtype=”http://schema.org/WPFooter” role=”contentinfo”>

functions.php addition

Paul Lund wrote this function to define the schema type automatically for the type of content being displayed (ie: article, contact page, etc). You can see the <html <?php html_tag_schema(); ?> <?php language_attributes(); ?>> function in the functions.php file in the demo repo.

Ideal Implementation

Don’t modify the core files of the theme you’re using. It’s seriously wrong and makes upgrading your theme almost impossible. Instead, create a child theme. It’s really, really easy to do and will inherit all the functionality and styles of the parent theme. For your convenience, I’ve put an example child theme up on GitHub, tlongren/wordpress-child-example.

Since it’s a child theme for Independent Publisher, you’ll want to fork it and modify it to fit your theme. If you’re already using Independent Publisher, you should be good to download the repo, upload it to WordPress, and activate the new theme from the WP dashboard.

Why Implement Schema.org?

Because Google says so:

Historically, we’ve supported three different standards for structured data markup: microdata, microformats, and RDFa. Instead of having webmasters decide between competing formats, we’ve decided to focus on just one format for schema.org. In addition, a single format will improve consistency across search engines relying on the data. There are arguments to be made for preferring any of the existing standards, but we’ve found that microdata strikes a balance between the extensibility of RDFa and the simplicity of microformats, so this is the format that we’ve gone with.

It also helps you define the default image that’s pulled when sharing a link on Google+ or Facebook. Users will still have the option of choosing another image, but probably won’t when the featured image from your post is automatically there. And this is just one example of why you should at least consider implementing schema.org markup.

As usual, comments are open, so please let me know what I got wrong and what could be improved. I appreciate whatever feedback people offer.

This post is a mess

This one is much more concise and much easier to implement, you’re probably better off starting there.

0