How to Create a Floating "Sticky" Sidebar Widget in Blogger


Sidebar widgets that float along your screen are pretty cool and attention grabbing. They are more commonly known as the “Sticky” floating widgets that stick to your screen as you scroll and tend to have a higher click through rate. In this article, I will show you how to create a floating “sticky” Sidebar widget in Blogger?

Remember: This works pretty well with all kinds of widgets present in your sidebar. It is not necessary that a person can only use if for email subscription boxes. You can use it for promotion of your items, galleries, popular posts, Instagram photos, and basically everything that you wish for.

Step#1: Adding a New Widget: 

The First thing you need to do is to add a new widget in your sidebar so that later on you can make it sticky. Go to Blogger.com >> Layout >> Add a Gadget >> Add HTML/JavaScript >> and name the widget as “My Sticky Gadget”. Now writing anything in the HTML body and once everything is down press “Save” button located at the end of the page.

Step#2: Installing a “Sticky” Plugin:

Now after properly adding a new widget in your blog, it’s time for some serious work. This time go to Template >> Edit HTML >> and search for the ending </body> tag and just above it paste the following JavaScript code.
<script>
/*<![CDATA[*/
// Sticky Plugin
// =============
// Author: Syed Faizan Ali & Revised by Levynson Otunga
(function($) {
    var defaults = {
            topSpacing: 0,
            bottomSpacing: 0,
            className: 'is-sticky',
            center: false
        },
        $window = $(window),
        $document = $(document),
        sticked = [],
        windowHeight = $window.height(),
        scroller = function() {
            var scrollTop = $window.scrollTop(),
                documentHeight = $document.height(),
                dwh = documentHeight - windowHeight,
                extra = (scrollTop > dwh) ? dwh - scrollTop : 0;
            for (var i = 0; i < sticked.length; i++) {
                var s = sticked[i],
                    elementTop = s.stickyWrapper.offset().top,
                    etse = elementTop - s.topSpacing - extra;
                if (scrollTop <= etse) {
                    if (s.currentTop !== null) {
                        s.stickyElement.css('position', '').css('top', '').removeClass(s.className);
                        s.currentTop = null;
                    }
                }
                else {
                    var newTop = documentHeight - s.elementHeight - s.topSpacing - s.bottomSpacing - scrollTop - extra;
                    if (newTop < 0) {
                        newTop = newTop + s.topSpacing;
                    } else {
                        newTop = s.topSpacing;
                    }
                    if (s.currentTop != newTop) {
                        s.stickyElement.css('position', 'fixed').css('top', newTop).addClass(s.className);
                        s.currentTop = newTop;
                    }
                }
            }
        },
        resizer = function() {
            windowHeight = $window.height();
        };
    // should be more efficient than using $window.scroll(scroller) and $window.resize(resizer):
    if (window.addEventListener) {
        window.addEventListener('scroll', scroller, false);
        window.addEventListener('resize', resizer, false);
    } else if (window.attachEvent) {
        window.attachEvent('onscroll', scroller);
        window.attachEvent('onresize', resizer);
    }
    $.fn.sticky = function(options) {
        var o = $.extend(defaults, options);
        return this.each(function() {
            var stickyElement = $(this);
            if (o.center)
                var centerElement = "margin-left:auto;margin-right:auto;";
            stickyId = stickyElement.attr('id');
            stickyElement
                .wrapAll('<div id="' + stickyId + 'StickyWrapper" style="' + centerElement + '"></div>')
                .css('width', stickyElement.width());
            var elementHeight = stickyElement.outerHeight(),
                stickyWrapper = stickyElement.parent();
            stickyWrapper
                .css('width', stickyElement.outerWidth())
                .css('height', elementHeight)
                .css('clear', stickyElement.css('clear'));
            sticked.push({
                topSpacing: o.topSpacing,
                bottomSpacing: o.bottomSpacing,
                stickyElement: stickyElement,
                currentTop: null,
                stickyWrapper: stickyWrapper,
                elementHeight: elementHeight,
                className: o.className
            });
        });
    };
})(jQuery);
/*]]>*/
</script>
<script type='text/javascript'>
   $(document).ready(function(){
    $("#mblfloater").sticky({topSpacing:0});
   });
 </script>

Step#3: Creating a Widget “Sticky” in Blogger:

After adding the JavaScript code, you have to search for the name of your widget. Since, we have named it as "My Sticky Gadget". Therefore, in the template coding search for "My Sticky Gadget". To be able to search correctly it is essential that you must use the built-in search box provided by the Blogger template editor.

Note: To enable the search box click anywhere in the template editor and press "CTRL+F". Now on finding "My Sticky Gadget" you will able to see a code similar to the the following one.
<b:widget id='HTML32' locked='false' title='My Sticky Gadget' type='HTML'>
            <b:includable id='main'>
  <!-- only display title if it's non-empty -->
  <b:if cond='data:title != &quot;&quot;'>
    <h2 class='title'><data:title/></h2>
  </b:if>
  <div class='widget-content'>
    <data:content/>
  </div>
</b:includable>
          </b:widget>
Now after finding the code as mentioned above, just replace it completely with the following coding.
<b:widget id='HTML32' locked='false' title='My Sticky Gadget' type='HTML'>
            <b:includable id='main'>
<div id='mblfloater'>
  <!-- only display title if it's non-empty -->
  <b:if cond='data:title != &quot;&quot;'>
    <h2 class='title'><data:title/></h2>
  </b:if>
  <div class='widget-content'>
    <data:content/>
  </div>  </div>
</b:includable>
          </b:widget>
Remember: The ID of your widget should be unique. For example, if you are using id='HTML32' in any of your widget then you cannot use the same ID for others.

All done: Once everything is done, press the "Save Template" button to finish the process.

Sticky floating sidebar widgets can bring a lot of growth in your sign ups. They help in increasing user engagement. You can also use multiple floating widgets in sidebar. However, this act might annoy your visitors. Make sure you have a balanced design, so that it don't annoy your users

We hope that this article have helped you in creating a Sticky floating sidebar widget in your Blogger website. This plugin is robust enough to be used in any element of your sites. Let us know what you think in the below comments.

This article was published at mybloggerlab and revised by blogakona

Keep in Mind you can also get get some come stuff from mybloggerlab too.
Share:

ENOUGH WITH NON-RESPONSIVE SITES ALREADY!

Still waiting for a sign from above to compel you to take the necessary steps to tweak that old site of yours so it can finally be classified as “Responsive” and “Mobile friendly”?

Well, this might be it…

It’s 2017… Your Site Should Be Optimized For Mobile!

Since Mobile usage keeps growing and growing and growing, Google has implemented a series of measures that will rank sites differently depending on their Mobile-preparedness.

The multinational conglomerate and leader in search has removed its ‘Mobile-Friendly’ label from its results, something first introduced in 2014. Why the shift toward removal, you might ask?

Aside from their goal of simplifying mobile search and helping users better find the content they’re seeking, this change is in large part due to the fact that 85% of most websites are already mobile-friendly!

It may seem counterintuitive, but it’s not. Its removal suggests mobile-optimized sites are no longer a suggestion from Google but now more of an expected and assumed reality.

In fact, this new direction by Google should come as little surprise to some, especially those who recall the news in 2016 when the company announced they would be adopting “Mobile-first” indexing over Desktop-oriented indexing.

Their algorithms will now primarily use the mobile version of a site’s content to rank pages from that particular site. So if you’re not mobile-friendly yet, this is your call-to-action!

Those changes were implemented last November, but you probably haven’t felt them yet. Indeed, Google took baby steps in the months thereafter before transitioning and rolling out the widespread change.

But having not quite felt—or noticed—a difference in your Google Pagerank ranking doesn’t necessarily mean that you should continue sitting on your… couch.

Is your site Mobile-friendly? Check it with Google’s official tool!
If you already have a mobile version of your site set up OR a responsive one, here’s Google’s official “Mobile-Friendly” site checker and testing tool we highly recommend you give a whirl. It’s quite nifty!

And if you’ve made changes to your site, don’t forget to inform Google by going to Google Search Console to Fetch your URLs, so the search engine will reevaluate it.

Intrusive ads are so in the past! Be flexible with mobile in 2017

Your can’t-miss-it offer that USED to convert like crazy is now the shred of what it used to be!

It could be because its one-time, hard-to-skip design is now a problem and is no longer the conversion catching magnet and asset it once was.

If you’re wondering why, it’s because back in January, Google announced penalties for sites that incorporated intrusive interstitials and pops that made content less accessible on mobile devices.

Since mobile use is now higher in the US (51%) than desktop (42%), Google decided to implement measures to help users find the best answers to their questions more quickly, regardless of the device they’re using.

You know those pops that seemed next to impossible to skip without doing whatever…? Well, now if they appear, you will surely receive a penalty from Google. Which means a drop in the results, and less traffic for you.

Thing is, penalties could be manual, which means they might give you a warning via email before it’s applied, or they can also be automatic. You may very could see a drop in conversions without knowing why. That’s when you know you’ve been ghosted!

Google’s take on “intrusive”

If you’re wondering what Google considers intrusive, here are some examples from the master of search themselves:


All pops and interstitials that are difficult to minimize or close, that take up the entire screen or blur the content will be penalized. With some exceptions…

Those who display age verification or cookie usage won’t be penalized, as well as login dialogs on sites where content is not publicly indexable.

Smaller banners that use less screen space won’t be penalized either. So don’t burn your house down just yet! Reducing the size of your pops might mean a slight decrease in conversions, but it will allow you to stay in the Google game, and the true value there is immeasurable.

Remember that when you make you’re contemplating intrusive vs. non-intrusive…

You’re getting traffic, but is it quality traffic?

Google found that almost 70% of users who encountered an intrusive ad left the site, never to return. And if these users appear to spend more time on your site with interstitials opposed to traditional pops … it might just be to find that sneaky “X”!

In that same test, Google examined the number of users who downloaded the Google+ app after seeing it advertised in an intrusive manner as well as a non-intrusive design.

They reported no change in downloads with a more subtle version of its ad.

But the kicker is that the traffic on the website increased by 17 percent with a less intrusive design.

Content and Consent

To improve your position on Google and to make sure that users keep coming back to your site, content is key. And it will unlock many possibilities for conversions.

It’s all about permission and consent…

Instead of losing customers by irritating them, you’re attracting them by respecting their boundaries!

In addition to your mobile-friendly design, this is a surefire way to get people to come back again and again!

Learn more from incomecrack
Share:

HOW TO CHOOSE A GREAT WORDPRESS THEME

WordPress — it’s the leading free content management system beloved by so many.

It allows us to create beautiful websites and blogs of all varieties and niches without breaking the bank. But when it comes to theme selection… there’s just so many choices!

In WordPress, your theme sets the tone (and overall look and feel) of your site within seconds of that first user impression.

That’s why it’s essential to pick a theme that’s right for you, your site, and one that delivers.

Here are some things to consider to help you pick that perfect WordPress theme!

Is the theme regularly updated?

This first question — whether the theme you’re looking at provides regular updates — is actually a must-ask question and a good indicator of a theme’s quality.

The date of the last update is visible on the theme’s presentation page whether you’re browsing the official WordPress Theme Directory or browsing Themeforest.

Don’t make the mistake of selecting a theme that hasn’t been updated in years because you’ll have absolutely no way of fixing problems if you encounter a bug, or if one of the features no longer work.

A good rule of thumb: a theme that’s been updated in the last 6 or so months is generally regarded as a safe bet and safe choice.

And this brings us to the number one question for any Webmaster just starting to get his or her feet wet in the WordPress scene…

FREE vs. PREMIUM?!

The million dollar question is:

  • do you go with a free WordPress theme, or a paid one?

Really, it all comes down to where you’re at with your marketing and what your budget is.

Will a free theme suffice for the average Webmaster just starting out?

Sure, you bet! There’s some pretty decent themes out there at no cost.

But here are some of the common issues you run into with free WordPress themes:

  • Themes frequently end up abandoned.
  • Support can be non-existent.
  • Theme creators may be nowhere to be found.
  • And the coding can be quite amateur-ish and crummy.

For the obvious reasons above, that’s why many Webmasters find themselves going the premium theme route.

Sure, it may cost you some money, but as the old saying goes:  you get what you pay for.

Other questions to ask:

What’s its rating?

Whether you’re going for a free or a premium theme, the theme’s overall user rating is another good indicator of how a theme holds up.

Obviously, the more ratings a theme has, the better you’ll be able to gauge how good or bad it is.

Just as you can find when a theme has last been updated on Themeforest or in the WordPress Theme Directory—you can find a theme’s rating on these same two pages.

Shooting for themes rated 5 stars never hurt nobody.

But don’t judge a theme too quickly if that theme you’re gravitating towards only has a 3 star rating after a few user reviews.

Remember, people who are disappointed are two-times more likely to rate a theme than the people who really enjoyed it.

So see what the general consensus is and use your best judgment and go from there.

If you want to avoid being inconvenienced or burned — stick with highly rated themes with many user reviews.

Does the theme provide support?

OK, maybe you’re a WordPress Jedi and you know you could rewrite the entire theme’s source code with your eyes closed if you really wanted to—but that doesn’t change anything we’re about to say.

Theme support is paramount.

And good theme support… on the other hand… is essential.

The difference between lackluster and awesome support means all the difference in time you could be saving, especially when it comes to working on other projects.

To the less seasoned WordPresser—reliable support is a lifesaver.  Support can help ensure you’re getting the most out of that WP theme.

With that said, it’s no secret the premium themes (aka the ones that cost money) are the ones that have the best support track record.  But that’s not to say all free ones fail in this department.

Believe it or not, some authors put their blood, sweat, and tears into a theme before releasing it. In many ways, it becomes their baby.

If you’re lucky enough to find a free WordPress theme with this kind of integrity and history behind it — it’s usually smooth sailing from there.

Authors who fall into this category usually have a tremendous track record when it comes to providing above and beyond dedicated support.

So while doing your theme research, check out if a theme lists any information about its author, and if it does, see if this person has went to great efforts answering other people’s questions.

You can also get a good idea of the average response / answer time by checking out the associated themes’ support pages via the Support forums and “Support” tab on a theme’s presentation page.

Is the theme Responsive?

OK, we know, this one might seem like a no brainer in the age of smartphones and tablets — but a theme’s Responsiveness should still be an essential deciding factor before pulling the trigger.

In fact, it’s very easy to find out.

To ensure a WordPress theme is responsive and a contender for your needs, simply preview it through ResponsiveTest.net (it’s a very nifty tool).

Don’t just trust the theme’s description —  put it to the test!

Recommendation>> TOP WORDPRESS THEMES FOR ADULT BLOGS.

Is the theme easily customizable?

And last but not least…

How customizable is the WordPress theme you’re considering?

  • Do you need a theme that you can modify a bit and tailor to your needs?
  • Or does a one-size fits all approach work just fine for you?

Sure, themes may be really well designed these days, but that doesn’t mean you won’t want to tweak a thing or two at some point in the near future.

Indeed, customizing a few things – even just things of subtle nature  – is what makes your site or blog stand out from all the rest.

If you are an experienced WordPress Webmaster, you may want to look for a theme with a simple and comprehensible StyleSheet to save time on theme customization. Indeed, sometimes theme creators deliberately protect their design by making their StyleSheet clunky without notes, filled with unnecessary code, so it isn’t easy for the average user to modify. You’ll find this especially true with the free themes.

If you are unfamiliar with WordPress, you may want to search for themes with customization features already included and integrated. This way, you’ll be able to work on the theme and add your brand signature without having to struggle with the code (but it’s always good to start familiarizing yourself with the code sooner rather than later because it will open up more opportunities in the long run!).

The Search is ON for the Perfect Theme!

Depending on the exact type of theme you’re on the hunt for, you may need to ask yourself some additional questions and check a few more things off your checklist before making up your mind.

(e.g., if you know for a fact you’ll be using your site to sell something — like sex toys, for instance — you would want your WordPress themed site to be able to handle the task and perhaps suited for plugins such as WooCommerce — which has been self-described as the best eCommerce platform for WP).

But regardless of the type of site you plan on running, the questions we highlighted above are ones worth asking when it comes to theme selection.

Read more from incomecrak
Share:

Top 6 Best Ad Networks For New Bloggers


Most time new bloggers experience difficulties earning income through ads monetization program. This is because most of the program at least a higher number of monthly visitors to you blog.  Well today you should worry out as i will let you know the best ads program that can run on low traffic blogs.

These advertising network are very much friendly to new bloggers, just with a piece of advice-please don't get overwhelmed. take your time reviewing each network and find the right one to suite your needs. 



1. Adsense is clearly a great ad platform because of the quality of their ads, but the problem is getting AdSense approval. Even though the “6 month-old domain” requirement is a kind of myth. Unique content is not the only factor for AdSense approval. There are many other factors AdSense wants to see before giving your site the thumbs up. Small blogs usually cannot get AdSense approval, so I have found several other good ad networks for new bloggers.( you can still opt to use adsense sometimes you acn get easy approval only by making sure you blog posts are not less that 30 posts).

2. Propellerads is a CPM network which is idle for any beginner or intermediate bloggers. All you need to do is after signing up;
  • Create ad
  • Place it on your blog
  • You will make  at least between $1-$4 for 1000 views.
Getting started with Propellerads is easy & they pay using Payoneer & other methods.



3. Revenue Hits is very different when compared to the other ad networks on this list.

Revenue Hits won’t pay you anything for clicks or impressions. They only pay when a click is turned into action. For example, if advertisers need user information, they advertise using Revenue Hits.

Publishers place the ad code on their blog. When a visitor clicks the ad and gives his/her name and email to the advertiser, the publisher (you) will get paid.
  • They pay $10-$50 per action
  • The minimum payout is $50
  • They pay via Paypal, Payoneer & bank transfer
Pros of Revenue Hits:
  1. Very high CPA rates
  2. Good minimum payout when compared to other ad networks like AdSense
  3. Good support
  4. Instant activation (Yup!)
Cons of Revenue Hits:

The ad format don’t use CPC or CPM methods. They only pay through CTR.


4. Bidvertiser was founded in 2002 and is one of the oldest ad networks.

They offer a large range of ad formats.
  • More ad formats means more ads, more clicks, and more money.
The minimum payout of Bidvertiser is $10 via PayPal, $20 via check, and $50 via bank transfer.

Pros of Bidvertiser:
  1. The minimum payout is very low
  2. They offer a lot of ad formats
Cons of Bidvertiser:
  1. Bidvertiser ads are not high-quality ads.
  2. Sometimes mobile users will be redirected to the app/play store which is very irritating.
  3. The interface looks old and dated.

5. PopAds is a premium pop ad network. This is a good ad network for small publishers because they have no minimum traffic requirements.
They started in 2010 & promise to offer 100% fill rates. They allow all types of blogs including illegal ones, porn sites, and other “adult” related content and approval is instant.

Pros of PopAds:

  1. High CPM rates when compared to other networks
  2. No minimum traffic requirements
  3. Minimum payout is $5
Cons of PopAds:

  1. The only available payment mode is PayPal


Infolinks is another popular ad program which is also very newbie blogger friendly. Infolinks offers many ad types & is popularly known for their in-text ads.
Pros of Infolinks:
  1. Trusted advertising company
  2. Timely payouts
Cons of Infolinks:
  1. Minimum payout is $50

6. Chitika was one of the top AdSense alternatives. Over time & with newer advancements in technology, many other networks have replaced Chitika. But one thing that is still the same for Chitika is the popularity among new bloggers.

This is what the offer:
  • low minimum payout ($10 made via PayPal)
  • easy to use interface
  • no minimum traffic requirement
Pros of Chitika:
  1. No minimum traffic requirements
  2. Good support for both publishers and advertisers
Cons of Chitika:
  1. Chitika works on a zero-tolerance policy. Any invalid click will permanently ban you from Chitika
  2. Chitika only monetizes search traffic
  3. It takes some time to get an approval or rejection decision
Share:

#AddThis: The Beginner’s Guide to On-Page SEO


You want people to find your website, right?

Well, that means making sure that when someone searches Google or another search engine for what you’ve got on your site, they’ll find it. This will only happen if the content on your website is properly optimized.

Sounds pretty straightforward, but there is a lot you can do on your site to get search engines prioritizing your content above others with similar keywords.

Download the AddThis Beginner’s Guide to On-Page SEO.


Share:

How to add Adsense to WordPress Blog


Google Adsense is one of the easiest ways to make money online from your website. In this article, I explain how to add Google Adsense Banners into your WordPress  Blog sidebar and content.

As you’ve probably noticed, I’m using Google Adsense in my blog to make some money online. Google Adsense is one of the biggest (and probably easiest) alternatives to make money online when you have a website or a blog.

Why Adsense?
Simple. As you’re starting to make a website or a blog, you’ll definitively want to make some money from it. This way you can at least make a few cents and pay the hosting or other expenses.

Thus, Adsense is the alternative from Google which allows you to put contextual ads into your site depending on what you’re writing.

The best thing is that Adsense is really easy to setup, and you just need to send your request with your website and wait until Google decides to enable your account.

However, one thing is to create an Adsense Ad and put it wherever you want on your blog, and another different thing is to put it on the right place. For instance, I recommend putting Adsense Ads on the following places:

  • Top Banner of your website (468×60 px)
  • Sidebar (Varies from 125×125 px up to 300×250 px)
  • Content (468×60 or 300×250)

So, to achieve this, there’s a manual way to do it by modifying your posts php file, or you can add it manually on every post. But I prefer doing it with a WordPress plugin, so let me show you how I do this.

How to add Google Adsense to WordPress

Step 1 – Create an Ad
First, go to your Adsense Dashboard and then into “My Ads” menu. Create a new Add from there:

Then customize your Ad depending on your website’s design. In my case, I selected a default style which already matches my website, but you can customize it if needed.

Also make sure you select the name of the Ad and select if you want text, pictures or both things displayed in your banner. Don’t worry too much. You can change this later.

Step 2 – Install the Quick Adsense Plugin
Now the plugin I’m going to use today is called Quick Adsense. Quick Adsense allows you to put multiple banners in your page, no matter if they’re from Google Adsense or any other Ad program (including Affiliates). So download it, enable it and access to the configuration panel.

From this point, you’ll be able to select how many Ads you want to show and the position of it. For example, I’m using an Ad at the top of the content with right alignment, and a secondary ad centered at the middle of the content.

Step 3 – Copy and Paste your codes
After you select your Ads (Google Adsense allows up to 3 ads in the same page) then you can copy and paste your Adsense Code to the selected Ads. You can also add a pixel margin between the Ad and the content, which by default is 10px.

And there you have it. After doing this, save the settings and open a post on your blog to see how it looks. If you’re not satisfied with the result, go back to the Quick Adsense panel settings and move everything until you feel it’s good enough (Remember not to be so intrusive with your readers).

Credit stream-seo
Share:

How To Fix "Microsoft Hosted Network Is Not Available" Error


Halo there my friends, are you in or perhaps in trouble solving Microsoft Hosted Network?. Well, worry not as in this tutorial am gonna show you how to fix 'Microsoft Hosted Network is Not Available' error, which appears when using Connectivity Hotspot application on your computer.

When Microsoft Hosted Network is Not Available appears you can not start the connectivity hotspot on your computer. What you should do is to go to Device Manager on your windows, then Find the Network Adapters, then look to the Microsoft Virtual WiFi Miniport Adapter, if there is a down arrow picture on the icon, it shows the driver software is out of date and you have to update it in a way, right-click Update driver Software then Search automatically for updated driver software.

Once the driver is Microsoft Virtual WiFi Miniport Adapter has been updated, start Connectivity Hotspot.

If the above methods still not work, please follow these steps ...

Open commandline cmd.exe as an administrator and enter next command:

netsh wlan set hostednetwork mode=allow ssid="MS Virtual WiFi" key="networkkey" keyUsage=persistent

press Enter and if you have entered is correct, then will confirm execution of the command and and the "Microsoft virtual WiFi miniport adapter" should appear in the Device Manager list (refresh list if you need).
Share:

#Wordpress: How To Automatically Insert Ads After First Paragraph

Hey folks, how are you doing today?...hope you're fine. Thanks for finding this topic as it is of much interest to you. Well you must have come across or seen some blogs with ads in the middle or whichever position in articles of each post, okay if you think of doing the same then hold on a continue reading this article. Putting ads code inside a post it's of a tricky job especially non-coders but still there are much simpler ways of doing even without coding classes you can still go on and do it yourself. i bet with this tutorial you can also call yourself a genius..well i i always do that...lol

Enough with talking, there is an easier way to insert ads after first paragraph automatically in wordpress  using a script that is put in the functions.php file. This method is much easier and more effective, because you do not need to touch the script adsense again during making articles.

The final result of this code is that it will be automatically be inserted by the script into the post after predetermined mark. In this tutorial, ads code will be inserted into each posts after first closing paragraph (html, paragraph), then the ads will appear in every post right after the first paragraph.

Below is a script behind the trick that must be inserted into your functions.php file to insert ads after first paragraph automatically in wordpress.

//Insert ads after first paragraph of single post content.
add_filter( 'the_content', 'prefix_insert_post_ads' );
     function prefix_insert_post_ads( $content ) {

 $ad_code = '<div>Ads code goes here</div>';
 if ( is_single() && ! is_admin() ) {
  return prefix_insert_after_paragraph( $ad_code, 1, $content );
 }

 return $content;
}
// Parent Function that makes the magic happen
function prefix_insert_after_paragraph( $insertion, $paragraph_id, $content ) {
 $closing_p = '</p>';
 $paragraphs = explode( $closing_p, $content );
 foreach ($paragraphs as $index => $paragraph) {
  if ( trim( $paragraph ) ) {
   $paragraphs[$index] .= $closing_p;
  }
  if ( $paragraph_id == $index + 1 ) {
   $paragraphs[$index] .= $insertion;
  }
 }

 return implode( '', $paragraphs );
}
Once you put the above code into functions, things you should do next is replace the red part with your ads code. You can also change the number of paragraphs by changing the orange part. Suppose I change the number of paragraph to 2, then the ad will appear after the second paragraph.

and that's how you do it, now you can insert ads after first paragraph automatically in wordpress with ease. Go ahead and call yourself a genius'@@@. If there are any questions please comment below, I will be happy to answer your questions.

Share:

How to Display Disqus Comment Count

Disqus is a comment system that has proven it's efficiency among many blogs and websites. Many of sites have now switched to Disqus comment system as it is fast, easy and simple to use, but sometime it can be frustrating when you don't see the comment counts in homepage until you go all way down to open the post. Comment counts are best way to prove to readers that your blog has a value of being viewed thus increasing you impression.

Okay saying that let's see how we can add the disqus comment count on your homepage. However you should note Disqus no longer supports import and syncronize for comment through blogger platform this is because Google has updated it's application that authenticate the access logged data with the latest OAuth 2.0 since April 2015.

Anyways you should not worry to much as I will be giving you tips on how to bring up the number of Disqus comments on the index page or your post.

First and most importantly be sure to get a disqus account.

If you haven't install disqus in your blog already please follow these steps:
1. Log in to Disqus profile > then click the Settings icon> Admin> Settings> Install> Universal Code> Then scroll to the bottom and find the phrase 'How to display the comment count'. Then copy the code immediately before the </body>

Please follow the step below 

Go to Blogger -> Template -> Edit HTML.

Place this Javascript code above </body>.
<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES * * */
    var disqus_shortname = 'blogakona';
   
    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function () {
        var s = document.createElement('script'); s.async = true;
        s.type = 'text/javascript';
        s.src = '//' + disqus_shortname + '.disqus.com/count.js';
        (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
    }());
</script>
Replace the blue background text above to your Disqus shortname example: blogakona from blogakona.disqus.com is the shortname.

2. The next step you should look for comment markup something like this (This code is taken from Blogger's default template, for the rest match the template comment markup you use)
<span class='post-comment-link'>
<b:include cond='data:blog.pageType not in {&quot;item&quot;,&quot;static_page&quot;} and data:post.allowComments' data='post' name='comment_count_picker'/>
</span>
Then replace all the above code with the code below:
<span class='post-comment'><a expr:href='data:post.url + &quot;#disqus_thread&quot;' title='Comments'/></span>
In case the above code doesn't function in you template, you might want to use the code below instead. This is because some template have different comment functions.

Find this code:
<b:if cond='data:post.allowComments'>
              <span class='comment-info'>
              <i class='fa fa-comments-o'/> <a expr:href='data:post.addCommentUrl' expr:onclick='data:post.addCommentOnclick'> <b:if cond='data:post.numComments == 0'> Add Comment </b:if> <b:if cond='data:post.numComments == 1'>1 Comment</b:if><b:if cond='data:post.numComments &gt; 1'><data:post.numComments/> Comments</b:if>
              </a>
              </span>
            </b:if>
And replace with the one below:
 <b:if cond='data:post.allowComments'>
              <span class='comment-info'>
              <i class='fa fa-comments-o'/> <a expr:href='data:post.url + &quot;#disqus_thread&quot;' expr:onclick='data:post.addCommentOnclick' title='Comments'> <b:if cond='data:post.numComments == 0'> Add Comment </b:if> <b:if cond='data:post.numComments == 1'>1 Comment</b:if><b:if cond='data:post.numComments &gt; 1'><data:post.numComments/> Comments</b:if>
              </a>
              </span>
            </b:if>
Save you template and reload to see the effect. There you are done, check me if you need more help
Share:

Trending

Unordered List

  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  • Aliquam tincidunt mauris eu risus.
  • Vestibulum auctor dapibus neque.

Pages

Theme Support

Need our help to upload or customize this blogger template? Contact me with details about the theme customization you need.