Free Online Courses for Software Developers - MrBool
× Please, log in to give us a feedback. Click here to login
×

You must be logged to download. Click here to login

×

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

×

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

Most commented posts in Wordpress.

In this article we will look at some techniques very simple but very useful for anyone who develops something for wordpress, we will hide some things like email, change language and insert most commented posts on Wordpress.

Hello guys, in today's article I will give some tips on Wordpress, first let's talk about:

In this part of the article you'll learn how to hide the email to the bots, but not for users, this code has the capability to mask the email in your page's source code by applying a simple shortcode in your page.

Unfortunately there are bots that are sweeping the web looking for emails to be innocent victims of evil plans of sites and companies that do not have a good reputation on the web and your email once captured the spans take your inbox with unwanted advertisements, a virtual telemarketing if not worse, but it turns out we can not disclose our email as it is to him that we get our first contact with the client, especially us who work as freelancers.

First we have to add the following code in functions.php of your theme:

function cwc_mail_shortcode( $atts , $content=null ) {
for ($i = 0; $i < strlen($content); $i++) $encodedmail .= “&#” . ord($content[$i]) . ‘;’;
return ‘<a href=”mailto:’.$encodedmail.’”>’.$encodedmail.’</a>’;
}
add_shortcode(‘email’, ‘cwc_mail_shortcode’);

Now just insert this shortcode on pages or posts that you are inserting any email:

[email] email@domain.com [/email]

Now if you want to add your email address somewhere in your theme as I did in footer.php, just use the following code in place of your email, remembering to replace the email address for your:

<?php echo antispambot(‘email@domain.com’) ?>

If you analyze the source code of your page will see that your email is completely unrecognizable, but only visible to human eyes, ready you are protected against bots!

Changing language of Wordpress

Many people install WordPress in English without knowing that there is an official version in different languages or upgrade to the latest version of CMS in English, here's a simple step by step teaches you to change the WordPress language to any language is so simple you can translate English into another in just 5 minutes.

Step 1

Download the latest version of WordPress in your own language

Step 2

Extract the WordPress folder and enter the "wp-content" and send the folder "languages" for your current site, while respecting the hierarchy of folders.

Step 3

Now in your site open the file "wp-config.php" find the command line:

define (‘WPLANG’, ”);

and replace with:

//We will use pt_BR for example, but you need to put the name of your own language
define (‘WPLANG’, ‘pt_BR’);

Save the changes and ready your theme is in your own language! Enjoy!

Showing most commented posts

In this part of the article we will learn how to show the most commented posts in a list on your WordPress, this is quite simple but it helps to disclose matters that were most commented on your site, generating curiosity and thus more clicks and comments for your posting.

Let the code:

<ul>
<?php $result = $wpdb->get_results(“SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 10″);
foreach ($result as $post) {
setup_postdata($post);
$postid = $post->ID;
$title = $post->post_title;
$commentcount = $post->comment_count;
if ($commentcount != 0) { ?>
<li><a href=”<?php echo get_permalink($postid); ?>” title=”<?php echo $title ?>”>
<?php echo $title ?></a> <?php echo $commentcount ?></li>
<?php } } ?>
</ul>

To change the amount of posts that will be shown just change the second line of code where the number is 10, to change the amount that suits you and the rest of the code is pretty explanatory:

  • $result = the result is displayed after you select the database, listing in descending order (ORDER BY comment_count DESC)
  • $postid = ID of post
  • $title = Title of Post
  • $commentcount = Number of Comments

If you want to go further and use a bit of creativity, to further customize using images, CSS and icons to make it more attractive your most commented posts also serves as a gateway to your visitors know your most commented posts and a certain form encourages comments on your blog.

I hope you enjoyed.

Until next.



He graduated in advertising by UBC, acts to 7 years as webdesigner, programmer, creative and curious. Currently working as an analyst at RPM producing SEO enthusiast SEO, SEM, Conversion Optimization, WordPress and Magento.

What did you think of this post?
Services
[Close]
To have full access to this post (or download the associated files) you must have MrBool Credits.

  See the prices for this post in Mr.Bool Credits System below:

Individually – in this case the price for this post is US$ 0,00 (Buy it now)
in this case you will buy only this video by paying the full price with no discount.

Package of 10 credits - in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download few videos. In this plan you will receive a discount of 50% in each video. Subscribe for this package!

Package of 50 credits – in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download several videos. In this plan you will receive a discount of 83% in each video. Subscribe for this package!


> More info about MrBool Credits
[Close]
You must be logged to download.

Click here to login