Browsing "Older Posts"

Browsing Category "Tutorials"

[Solved] How to Limit the_excerpt() Character Length in WordPress

By Rubel - No Comments
Limit Character Length in WordPress
Sometimes you want to try limit the character length in WordPress default the_excerpt() length. See following method how to limit the character length.

Code: In your function.php file add following code.
/**   
* Changing excerpt length
* www.codiblog.com
*/
function get_excerpt($count){
  $permalink = get_permalink($post->ID);
  $excerpt = get_the_content();
  $excerpt = strip_tags($excerpt);
  $excerpt = substr($excerpt, 0, $count);
  $excerpt = $excerpt.'...';
  return $excerpt;
}
Then where you used <?php the_excerpt(); ?> , you need to replace this by following code
<?php echo get_excerpt(36); ?>
You can change character length value 36 as your wish.

How to fix duplicate content issue in Blogger SSL

By Rubel - 2 Comments
Fix duplicate content in Blogger SSL
Duplicate content is very bad for blogger seo. If search engine find duplicate content, they will decrease your site ranking from search page. It can be http to https. Recently blogger release https version for their sub-domain sites and it's currently not available for custom domain blogs.

I personally recommend you to enable https version in your site. I added it to my other site and after few days my website ranking boost dramatically. Then after few days i have seen that in my html code some of link contain http link and i changed them to https. Then you can not imagine, my website ranking boost fast than before. So in this post, i will tell you how to fix http to https in your blogger template.

How to Fix Duplicate Content in Blogger:


Step 1: Login to your blogger account
Step 2: Go to Theme>Edit HTML
Step 3: Click anywhere inside the code area
Step 4: Search following text
http://
Step 5: Replace http:// text to https and that's it.

Remember: Before changing http to https, check link is it work with https version.

How to perfectly redirect non-www URLs to www

By Rubel - 7 Comments
Redirect Non-WWW urls to www
Non-www and www version there are two url format for your site. You need to fix it to prevent from duplicate content.

To redirect all of your yourdomain.com or yourdomain.com/sub-folder visitors to www.yourdomain.com or www.yourdomain.com/sub-folder, you should need to add following code at the beginning of your .htacess file in your public_html folder


For yourdomain.com to www.yourdomain.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]
Change yourdomain.com with your website name. After add it, when someone accesses to http://yourdomain.com he/she will be redirected to http://www.yourdomain.com


For yourdomain.com/sub-folder to www.yourdomain.com/subfolder
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{REQUEST_URI} ^/sub-folder/
RewriteRule ^(.*)$ http://www.yourdomain.com/sub-folder/$1 [R=301,L]
Change yourdomain.com with your website name and also sub-folder text with your existing sub-folder name. After add it, when someone accesses to http://yourdomain.com/sub-folder he/she will be redirected to http://www.yourdomain.com/sub-folder

That's it and it's safe method.

Advanced Tips: You can use it for your WordPress or any kind of site.

How to Eliminate render-blocking Javascript and CSS in Blogger

By Rubel - 11 Comments
Remove render-blocking Javascript and CSS from Blogger/Blogspot
May be recently, you checked your website by google page speed tools and seen that google tells you to eliminate render blocking javascript and css from several notice and that's can effect on your page speed. If you want to increase google pagespeed score, you need to solve this problem. So let's follow my tutorial, how to eliminate render-blocking javascript and css from blogger/blogspot.

** Backup your theme before apply this tricks**


Eliminate CSS Bundle - Blogger automatically create two css widget bundles for your website. It's looks like.
Remove Blogger CSS Bundle
To remove these bundle, follow simple steps.
Step 1: Go to Blogger>Theme
Step 2: Click on Edit HTML
Step 3: Click anywhere inside the code area
Step 4: Press CTRL+F to open a search bar
Step 5: Now search following code
<head>
Step 6: Replace <head> tags by below code
&lt;head&gt;
Step 7: Again search following code
</head>
Step 8: And replace </head> tags by below code
&lt;/head&gt;&lt;!--<head/>--&gt;
Step 9: Click on Save theme and you are done.

Now again search your website by google pagespeed insights tools and you will see that css bundle issue is solved.


Eliminate JS Bundle - Like css blogger automatically create widgets.js bundle for javascript. To remove these bundle follow below tutorial.
Step 1: Search following code
</body>
Step 2: Replace </body> tags by below code
&lt;!--</body>--&gt;&lt;/body&gt;
Step 3: Click on Save theme
That's it. Now see page speed score and it's improve.


How to fix contact form problem after applying JS bundle eliminate tricks - If you use contact form in static page and also want to remove js bundle then you need to follow my another trick. Because after removing js bundle, your contact from will not work anymore. This trick will not work, if you use contact form in sidebar or footer.
Step 1: Search following code
</body>
Step 2: Replace </body> tags by below code
<b:if cond='data:blog.url != &quot;http://www.codiblog.com/search/label/Contact_Us&quot;'>&lt;!--</b:if></body><b:if cond='data:blog.url != &quot;http://www.codiblog.com/search/label/Contact_Us&quot;'>--&gt;&lt;/body&gt;</b:if>
Customize: Replace http://www.codiblog.com/search/label/Contact_Us with your contact us page link url.
Step 3: Click on Save theme and you are done.

In this tricks, i have used blogger conditonal tags so that default javascript widget.js file only loads when someone visits contact us page, and other page it will be ignore.

How to Limit the number of Post in Blogger Search

By Rubel - 2 Comments
Blogger Search Page Limit
In this tutorial, codiblog will give you a few tips on how to limit the number of posts that appear when searching for an article in the blog page search. This trick is very easy and you can applied in on my 12 Stylish Beautiful Blogger/Blogspot Search Box post.

How to Limit the number of Post in Blogger Search


Step 1: Login to Blogger.
Step 2: Choose your blog and go to Theme.
Step 3: Click on Edit HTML.
Step 4: Click anywhere inside the code area.
Step 5: Press Ctrl+F from keyboard to open a search bar.
Step 6: Search following code.
action='/search'
Step 7: Replace above code by following code
action='/search/max-results=10'
Determine the number of 10 on how many posts you want to display in search page.
Step 8: Click on Save theme and see the result.

If you add search bar by blogger Layout>Add a Gadget, follow (Step 6 - 7).

Enjoy this simple trick and improve your blogger editor knowledge.

How to Add Adsense or Any Ads In the Middle of Blogger Posts

By Rubel - 15 Comments
Ads in the middle of Blogger Post
Today i will share a simple but effective tips for all of my buyers and readers on how to add Adsense or any other ads in the middle of blogger posts. There are lot of tutorial about this but my code help you to show it automatically in all of your posts. So, do you want to increase your earning revenue, want to increase your click rate, follow this tutorial.

How to Add Adsense or Any Ads In the Middle of Blogger Post


Step 1: Login to your blogger account and select the blog you want to edit.
Step 2: Go to Theme and click on Edit HTML.
Step 3: Click anywhere inside the code area.
Step 4: Press Ctrl+F from keyboard to open a search bar.
Step 5: Now search <data:post.body/> code and replace this code in your template with the below code.
Note: Inside of your template, you will find <data:post.body/> code multiple time depending on the template used, try one by one until the ad appears on the article page.
<div expr:id='"mad1" + data:post.id'/>
<div style="margin:20px auto;text-align:center;overflow:hidden;">
<!-- Add your ad code here -->
</div>
<div expr:id='"mad2" + data:post.id'><data:post.body/></div>
<script type='text/javascript'>
var obj0=document.getElementById(&quot;mad1<data:post.id/>&quot;);var obj1=document.getElementById(&quot;mad2<data:post.id/>&quot;);var s=obj1.innerHTML;var t=s.substr(0,s.length/2);var r=t.lastIndexOf(&quot;&lt;br&gt;&quot;);if(r&gt;0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+16);}
</script>
Customize: Replace <!-- Add your ad code here --> with your adsense or other any kind of ad code.
Step 6: Click on Save theme and see the result.

You can use my Responsive Adsense Ad Code Converter Tool to generate responsive ad and can paste, by replacing <!-- Add your ad code here --> code.

That's it. Happy Commenting!

How to Fix Blogger Newly Created Thumbnail Blurry Issue

By Rubel - 11 Comments
Today a lot of blogger facing a problem such as there website thumbnail (representative picture for the article) now looking bigger and blurry. May be blogger updated something so we faced this problem. I already faced this problem in my created blogger templates and i fixed it by updated. Let's see, how i fix it.

Step 1: Go to Blogger.
Step 2: Click on Theme>Edit HTML.
Step 3: Click anywhere inside the code area.
Step 4: Press Ctrl+F from keyboard.
Step 4: Search following code. (May be you will find this code in your read more script or other, see where this work, you can try one by one)
s72-c
Step 5: After find, replace it by following code.
s72-c-k-no
As shown below, is sample for my all created blogger templates, you script may be difference.
Solve Blogger Thumbnail Blurry Issue

That's it. I think that your problem will be solved. If not, you can tell me by comment, i am always ready to help you.

How to Enable Email Subscriptions to Google Feedburner

By Rubel - No Comments
By default google disable email subscription in their feedburner service. It's important to enable to receiving email subscriber from your newsletter. We know that who subscribe your feedburner by email, they will receive automatic article when you add new post on your website. Few days ago i posted a article on 20+ blogger newsletter email subscription widget, to receive this service, you must need to enable email subscription. Let's see how you do this.

How to Enable Email Subscriptions to Google Feedburner


  1. Go to https://feedburner.google.com
  2. Click on your Feed Title. See below image
  3. Email Subscription Widget
  4. Click on Publicize > Email Subscriptions 
  5. Publicize Email Subscription
  6. Click on Active and you are done
  7. Active Email Subscription
That's it now you can use any email subscription widget in your site. If you want, you can Deactive it any time.