1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to exclude an added(to page.php) code from pages?(Wordpress)

Discussion in 'PHP' started by cini, Jun 15, 2010.

  1. #1
    In my blog,i have to add a code to the page.php (a must for me)

    I added the code and works fine in a specific page which i created but the problem is that,when i added the code all the other pages like contact,privacy policy shows it.I just want to show it in that specific page i created

    An example:I created a page let's say X.I added this code.<?php if(is_page('5989')){
    echo fvCommunityNewsGetSubmissions(30);
    } ?>
    to page.php
    All the pages(contact,privacy policy) effected from this code.I don't want this code to be shown in those pages but only X page

    Is there a way to exclude that code from other pages not to show it?
     
    cini, Jun 15, 2010 IP
  2. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #2
    Try this:

    
    <?php
           if(get_the_ID()==2){
                if(is_page('5989')){
                    echo fvCommunityNewsGetSubmissions(30);
                }
           }
    ?>
    
    Code (markup):
    Change the number 2 to the ID of the page X.
     
    s_ruben, Jun 16, 2010 IP
  3. cini

    cini Active Member

    Messages:
    248
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    sorry ruben

    the added code is <?php if (function_exists('fvCommunityNewsForm'))

    fvCommunityNewsForm(); ?>
     
    cini, Jun 16, 2010 IP
  4. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #4
    
    <?php
           if(get_the_ID()==2){
                if (function_exists('fvCommunityNewsForm'))
                     fvCommunityNewsForm();
           }
    ?>
    
    Code (markup):
     
    s_ruben, Jun 16, 2010 IP
    cini likes this.
  5. cini

    cini Active Member

    Messages:
    248
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #5
    Thank you very much s_ruben

    Worked!!! :)
     
    cini, Jun 16, 2010 IP