Category Archives: WordPress Tutorials

Big MailChimp is a powerful plugin that provides an abstraction level and handles many tasks in the background. Hence, we are able to provide an easy to use interface with only a few options to modify. In most cases the default settings will suffice. However, some of us like to have a 100% control over the code and performance of our sites. Some of the options have already been explained in the plugins page and Adding MailChimp Forms to your WordPress Site. Continue Reading Big MailChimp Options

Email marketing is an effective way of reminding people to visit your site and keep them updated through your newsletters. It is a great tool to reach to thousands of people who have voluntarily signed up to your mailing list to receive updates from you. However, before any email marketing efforts can be done, you will need to collect an email list. Collecting an email list is not an easy task. Many email newsletter companies will provide you a link to a page that contains an email capture form that is hosted by them. This means every time a visitor tries to sign up to your mailing list they will have to exit your site. Not cool! Continue Reading Adding MailChimp Forms to your WordPress Site

We occasionally receive emails from our visitors with a specific question that we can refer to an article or section of a page on our website. However, with our lengthy articles, often times we find it frustrating to direct the user to a page with few lines of instructions. This is where anchor tags come in for the help. We decided to manipulate the content and add anchor tags to all our H2 tags.

Here is a feature that we thought is missing in WordPress

Add this code in your functions.php file and all your H2 tags will get an id attributes. Here we use WordPress’s built in sanitize_title_with_dashes function that’s used for creating permalinks when you type in your new post title.

// This function adds nice anchor with id attribute to our h2 tags for reference
// @link: http://www.w3.org/TR/html4/struct/links.html#h-12.2.3

function anchor_content_h2($content) {

    // Pattern that we want to match
    $pattern = '/<h2>(.*?)</h2>/';

    // now run the pattern and callback function on content
    // and process it through a function that replaces the title with an id 
    $content = preg_replace_callback($pattern, function ($matches) {
                $title = $matches[1];
                $slug = sanitize_title_with_dashes($title);
                return '<h2 id="' . $slug . '">' . $title . '</h2>';
            }, $content);
    return $content;
}

add_filter('the_content', 'anchor_content_h2');

And there we have our anchor tags. Now we can link to specific sections of our website like How to overwrite a CSS rule. Add some smooth scrolling if you desire, and you will have an impressive and user friendly website.

Why this feature is not a default in WordPress you ask?

Well, according to W3C Recommentatin for anchor tags, you can not have id attributes declare the same name twice in the same document. And since these elements are coming from the content editor generated by the user, there is no way to produce a valid markup if users use the same sub headings in the same post.

You have had your site for sometime and now it is time to make some changes to it to keep it on par with the ever fast moving technology. Thus, you decided to upgrade your site or moved it to an entire new domain. Maybe, just started using Search Engine friendly URLs or just decided to move one document to a new location. Bottom line a document or a directory that was at location “Old-URL” has been moved to “New-URL” and therefore not accessible at the “Old-URL.” This can greatly effect your Page Rank and undo all the hard work you have put into Search Engine Optimization (SEO). Moreover, all the URLs linking in to your site from external sources, such as emails you sent, links you shared on social media websites, and any place you published those link are now broken.

Continue Reading 301 Redirect, 302 Redirect, 303 See Other, 410 Gone. Do you know how to use them?