WordPress.org

Forums

How To Display Sidebar Content On All Pages Except The Home Page (9 posts)

  1. Bhoney
    Member
    Posted 6 years ago #

    Hi everyone.

    I need to show ads in my sidebar on every page EXCEPT the home page. I thought I had figured it out using if(is_single() but discovered categories, pages, archives- and everything else was not displaying the ads in the sidebar.

    If anyone knows the exact code I should use it would be helpful.

    Below is what I am using

    <?php if(is_single() && $post==$posts[0] && !is_paged()) { ?>
    		CODE HERE
    <?php } ?>

    Thank you :)

  2. blogsdna
    Member
    Posted 6 years ago #

    you can use this

    <?php if(!is_home()) { ?>
    CODE HERE
    <?php } ?>

  3. Bhoney
    Member
    Posted 6 years ago #

    Thank you for your response.

    I actually didn't know my post had gone through because I got an error message.

    Anyway- I used the above code and it worked. However, while browsing my site I discovered the ads are not showing on pages like below:

    http://mysite.com/page/2/ and so on.

    I am using the Paginate plugin.

    Is there anyway to make the ads show up on these pages as well?

    Thanks :)

  4. moshu
    Member
    Posted 6 years ago #

    Conditional_Tags - everything is in the Documentation, just has to be read.

  5. Bhoney
    Member
    Posted 6 years ago #

    I actually did read the Conditional Tags pages. Posting for help was a last resort after several things didn't work. As I said above, via searching I actually found the info blogsdna gave me. I then read some more and came back and asked again after I could not figure it out.

    I know some are lazy and won't read or search first before asking for help- I however, did both.

    :)

  6. moshu
    Member
    Posted 6 years ago #

    Read it again: 2.15.

  7. Bhoney
    Member
    Posted 6 years ago #

    Do I have to alter this code above or do I have to add a whole new line of coding with the content I need to show on the paged page as well?

  8. moshu
    Member
    Posted 6 years ago #

    I am not a coder, I just can read code, but yes, you have to ADD the "paged" thing. Actually, you had it in your first example, only saying "if it is NOT paged". You need AND if it IS paged (remove the !)

  9. Bhoney
    Member
    Posted 6 years ago #

    I figured there was a way to add it with the first set of coding but I couldn't get it to work. I tried removing the ! and changing words around.... nothing I just ended up adding a whole new set of coding with the ad content I was trying to display.

    Just in case anyone else wants to know.

    Thanks :)
    --------------------
    <?php if(is_paged() && $post==$posts[0] && is_paged()) { ?>
    Content Here
    <?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.