More
    HomeDesign / DevDisplay Multiple Ads After Any Post Number

    Display Multiple Ads After Any Post Number

    Sometime we may need to add an advertisement or adsense ads after our first post. That is quite easy to do. However, how if we want to add multiple advertisements after certain number of posts? See how it can be done..

    • First open your themes index.php file using any of your favorite editor.
    • Find the following code of line:

    [sourcecode language=’php’]

    - Advertisement -

    [/sourcecode]

    • Copy the code below and paste it before the above code.

    [sourcecode language=’php’]

    - Advertisement -

    [/sourcecode]

    • Scroll more down the index.php page and find the following the code of line:

    [sourcecode language=’php’]

    [/sourcecode]

    • Same procedure, copy and paste the code below before the code above.

    [sourcecode language=’php’]

    [/sourcecode]

    • Finally, create two files named as ads1.php and ads2.php and paste any advertisement code into both the files. Not only advertisement actually. You can try to insert anything, really.
    • Make sure to put both files into the same directory as the index.php file.
    The code above will display ads after the first and second post. By changing the $showads1=1 and $showads2=2 number into "2" or "3" will give different position of advertisement. Try with different combination to get anywhere you want the ads to appear. Best example is that you can see after my first post, there are two rows of section (popular posts and subscription section). Now, enjoy!

    - Advertisement -
    WPTidBits
    WPTidBitshttps://wptidbits.com/
    Owner of WPTidBits. Totally in love with WordPress!

    3 COMMENTS

    LEAVE A REPLY

    Please enter your comment!
    Please enter your name here

    110FansLike
    761FollowersFollow