badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

How to modify have _posts ()?

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4800
    simbha
    Participant

    The main page shows all post titles with excerpt, I want to modify the theme in order to show ads on main page after 2-3 post titles. How can I do this?
    I was having a look at an online tutorial which mentioned about change the have_post() function. In which file it’s located I didn’t get it. The tutorial mentioned steps as followed:

    Find :

    <php if (have _posts ()) : ?> 
    <php while (have_posts()) : the_post(); ?>

    Replace:

    <?php $postcounter = 1; if (have_posts()) : ?> 
    <?php while (have_posts()) : $postcounter = $postcounter + 1; the_post(); ?> 
    <?php if(4 == $postcounter) { echo ' <div id="adsbetween"> <center> YOUR_ADSENSE_CODE </center> </div> ' ; } ?>	

    And where is the the content() function I didn’t find it either.I’m using the free attitude theme.

    #4801
    simbha
    Participant

    I got it..if( have_posts() ) it’s in file content-extensions.php in library/structure folder.

    #4862
    Rabin Shrestha
    Participant

    Hi Simbha,

    Don’t edit the theme file directly else your changes will be lost when you update the theme. Make a child theme and do the required editing.
    Here is link for more detail http://codex.wordpress.org/Child_Themes

    Rabin

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.