An elegant solution to clean up html comments from wordpress themes

Typically, all popular wordpress themes come with html comments to mark endings of div block. This is required for theme developers as it is much easier to see where particular block ends.

However, I do not like leaving code like that in production site. Although some claim that HTML comments have no effect in SEO, it might have effect in keyword discovery process. Additionally, they might have effect for various security plugins, that filter and block content containing bad words.  Third, I think it is bad to leave debug information in production sites.

The biggest problem of these is that WordPress theme frameworks like Hybrid uses these as well. So you will have to clean up frameworks source each time you upgrade your framework. That is not the best approach.

However, You can implement this by creating couple filters in your childs (or custom) theme  functions.php file:

function custom_callback($buffer) {

$buffer=preg_replace('/<!--(.*)-->/Ui',' ',$buffer);

return $buffer;

}

function custom_buffer_start() { ob_start("custom_callback"); }

function custom_buffer_end() { ob_end_flush(); }

if (is_user_logged_in() ) {

} else {

add_action('wp_head', 'custom_buffer_start');

add_action('wp_footer', 'custom_buffer_end');

}

This will clean the code from comments when user is not logged in (for search engines and visitors).

Why there is THAT site in search results or disambiguation of search query

Sometimes friends and clients complain about competing sites that should not be there:

  • No obvious optimization
  • Content is crappy, mentions term once and in very different context
  • Few or no links
  • Design is old and ugly

However, such site is in the first page and sometimes quite high in results. So, what are the reasons for this?

Personally, I have seen a blog that ranked really well under one porn term with single mention in blog post. It had nothing to do with porn industry though.

Sure, we do not know Google algorithm, but my guess is disambiguation of search results plays major role in niche markets. Quite often the key phrase is not enough to determine searcher’s intent and search engine has to provide alternate meanings for the term. Sure, in many cases the Nr1 is site that performs best in terms of SEO, but there is room for different sites as well.

Let’s discuss an example. A person searches for “online poker” – a quite competitive term. In the first page we will see poker rooms, poker information portal, poker forum, some news sites and images. It is not because forum sites and poker rooms are at the same level in terms of SEO. We get these results because Google cannot determine which result is most relevant for us:

  • We might want to play online poker in top rooms (highest possibility for the term).
  • We might want to read reviews of these rooms
  • We might want to discuss about online poker
  • We might want to read some related news, etc.
  • We might want some local results as well.

Sure, we will not see poor sites under this query in top places. Online Poker is too competitive. However, some of the sites might appear out of nowhere even under this term.

So, what can we conclude from this?

  1. Copying top sites is not the fastest way to front page. Unique approach is.
  2. The longer the query the more SEO work has an impact.
  3. Behavioral analysis and local data will have an impact on what results you get as well. They matter. Guess what sites target users need, and not what they use now.

Thats all today :)

11 tips on sending emails from web applications

Email marketing is still useful for list builders and keeping in touch with your consumers. However, quite often communication is lost in the email Spam box and not read by recipient. How to solve this problem? Here are some tips.
  1. Your server and domain
    1. First thing I would check is the spammy IP list. Is your IP address blacklisted? It happens, especially on shared hosting. Good place to start searching is http://www.mxtoolbox.com/blacklists.aspx . I would use a dedicated IP if I plan to do mass mailing.
    2. Do your IP address resolves back and how? If it has IP address in reverse domain address, they think it is a DSL – assigned IP and not a hosting one, so it is assumed that this is SPAM. If IP resolves back to your domain, it is a good sign.
    3. SPF record is highly advisable. Not all incoming mail servers use SPF record; however it never hurts to have one.
  2. Your email message headers. Forging headers is bad idea. Your headers should be informative and correct, including message ID. It is important how you write your email address there as well, you should always use real name with email address where possible. Same is applicable for recipient email address as well. Prove that you know them.
  3. Avoid spam words or keep their density low. The message should have enough text; however it should not be too big. Also, avoid excessive capitalization and spacing.
  4. You should include information why they are getting this message, also your contact information, as well unsubscribe information (if applicable). You do not have to write that your message is not spam – only spammers do that.
  5. You should use well-formed html if you have to use it. No hidden text, tracking images or similar – they are usually blocked by anti-spam programs. Also you should include text version of email.
  6. Avoid using spam – mailers. The anti-spam programs know about them and how to recognize most of them. This is quite sure way to be flagged as spam.
  7. Monitor your returning email box. See what messages got undelivered and bounced back. See if it is your problem or the recipient problem.
  8. Upon registration, ask your visitors to add your email to their address book and use same email for communication with them. Address book is the best way to pass spam filters.
  9. Some mail servers do not like too many emails from single sender at any point. Try to space out the sending of your newsletters.
  10. Avoid sending too many messages to people that can’t read them – full message boxes, blocked, etc.
  11. Check your web application if it can’t be used to send spam for real. This might be a case for “send to a friend” forms or similar which allow information input. This is quite serious security issue as you might get blacklisted.

Overall, the most important factor is monitoring back all information you get back from emails you send, especially the “negative” one : bounced emails, sending errors and similar. There are lots of information in bounced messages that you should read and evaluate.

Malwarebytes best free protection for your PC? Yeah, right

I have a very mixed feelings about one issue in anti-spyware community. That is how products are marketed as free. During the years as I work in the industry, there were a large amount of products marketed as free despite the fact that their important features are paid ones. Typically, this was the remover itself. However, some tools has changed the scene.

One of these tools is Malwarebytes anti-malware. It provides free detection and removal for parasites in database, and its paid feature is real-time protection module. So, what is the problem with it?

The problem is how this tool is positioned for end user. You are told that Malware bytes Antimalware provides the best free protection, however it is not so. Protection it is not same as removal. Protection from computer parasites depend on capabilities of real-time protection module. But few promoting this tool mentions this. Some of the experts can’t even see the difference in these statements.

However, Malwarebytes anti-malware is a free good program for SOLVING infections, and in most cases this is one of the first tools I install on infected PCs. It has quite good detection ratio, and quite often was enough to solve the problem. Then again, there are quite a few cases when I had to install spyware doctor or other program to finish off remains.

That brings me to another issue I do not like about Malwarebytes anti-malware: its naming conventions. Most of trojan parasites are hidden under simple name of Trojan.downloader so users can not find more information on what infected their PC at other anti-virus and anti-spyware vendors. Some might argue that this information is not important. I disagree, as other vendors might provide better, more in-depth information about particular parasite.

Thus I would stick to other anti-spywares like  super anti-spyware or Spyware doctor for reliable protection, and keep malwarebytes as a just in case tool only.