Forums

How to remove an image from certain pages only (13 posts)

  1. Amnesia180
    Member
    Posted 3 years ago #

    Hi All,

    If you visit this page - http://thewebevolved.com/enter/?page_id=11 - you will see at the bottom there is some random lines and an image from the "comments" function. How can I get rid of these images on the about/contact pages only?

    Thanks!
    Amnesia

  2. MichaelH
    Volunteer
    Posted 3 years ago #

  3. Amnesia180
    Member
    Posted 3 years ago #

    Thanks MichaelH.

    I'm assuming that in my comments.php folder I should only need to add the following

    if (is_single('11'))
    {
     echo 'test';
     } else {

    here (where xxx is marked, that is where the above code will go.

    <?php // Do not delete these lines
    
    xxx
    
    	if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
  4. Amnesia180
    Member
    Posted 3 years ago #

    Still no luck here, I've even tried modifying the comments section in page.php but nothing.

    Any further advice?

  5. Amnesia180
    Member
    Posted 3 years ago #

    *bump*

  6. Amnesia180
    Member
    Posted 3 years ago #

    Still been mucking around with this.

    Simply, all I want to do is say "if my page is IDx, IDy and IDz... then do not sure the comments function. If my page is anything other than x,y or z... please include the comments function".

    Any further advice?

  7. Amnesia180
    Member
    Posted 3 years ago #

    Anyone?

  8. write2brajesh
    Member
    Posted 3 years ago #

    use something like this to control

    `<?php
    if(!is_page('your_page_id'))
    {
    //show tags and comments....
    //
    }

    `

    It must be put in page.php and if your theme is not having page.php it should go to your index.php where tags and comments are shown

  9. Amnesia180
    Member
    Posted 3 years ago #

    Thank you brajesh.

    However, do I not need an "else" control there too? To say "else.... use"

    Because I will want comments on EVERY page.... apart from 3. So it would be easier to say

    "if page is IDx, y and z do not show them"
    ELSE
    "show comments".

  10. write2brajesh
    Member
    Posted 3 years ago #

    hi
    You are most welcome.
    No you don't need the else as please see I have used if page is not having id 'your_page_id' then show the comments etc.else it should not not.That means,when you are on page having page_id 'your_page_id',the if condition will become false and it will not run.

    For multiple pages ,chain the conditional with logical or like


    <?php
    if(!(is_page('id1')||is_page('id2')||is_page('id3')))
    {
    //show tags and comments....
    //
    }
    ?>

    or another alternative, if easier on understanding could be something like this


    <?php
    if(is_page('id1')||is_page('id2')||is_page('id3'))
    {
    //Do NOT SHOW tags and comments....
    //
    }
    else
    {
    //show tags and comments

    }
    ?>

  11. Amnesia180
    Member
    Posted 3 years ago #

    Hi,

    It's me again. I'm still trying to position this properly.

    I have found this in the page.php part... and have tried including it in the code above, but it does't work.

    <div class="entry">
    	<?php comments_template(); ?>
    	</div>

    Also, the page ID I want to have NO comments on is 16... so do I need "id16" or just "16".

  12. Amnesia180
    Member
    Posted 3 years ago #

    bump.

  13. write2brajesh
    Member
    Posted 3 years ago #

    hi
    well, just use something like this

    <div class="entry">
    <?php if(!is_page(16)):?>
    	<?php comments_template(); ?>
    <?php endif;?>
    	</div>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.