Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter Amnesia180

    (@amnesia180)

    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']))

    Thread Starter Amnesia180

    (@amnesia180)

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

    Any further advice?

    Thread Starter Amnesia180

    (@amnesia180)

    *bump*

    Thread Starter Amnesia180

    (@amnesia180)

    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?

    Thread Starter Amnesia180

    (@amnesia180)

    Anyone?

    Brajesh

    (@write2brajesh)

    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

    Thread Starter Amnesia180

    (@amnesia180)

    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”.

    Brajesh

    (@write2brajesh)

    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

    }
    ?>

    Thread Starter Amnesia180

    (@amnesia180)

    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”.

    Thread Starter Amnesia180

    (@amnesia180)

    bump.

    Brajesh

    (@write2brajesh)

    hi
    well, just use something like this

    <div class="entry">
    <?php if(!is_page(16)):?>
    	<?php comments_template(); ?>
    <?php endif;?>
    	</div>
Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How to remove an image from certain pages only’ is closed to new replies.