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.

Question Wordpress Page code

Discussion in 'Content Management' started by Axus Technologies Inc., Apr 22, 2010.

  1. #1
    Hi..
    I want to add a BACK TO HOME link to all of my pages automatically.

    I downloaded this plugin,
    http://downloads.wordpress.org/plugin/subscribe-remind.1.2.zip

    I was expecting to remove the rss feed code from it and put my BACK TO HOME html there , but this only appears on POSTS page , and not PAGES .

    The code is,

    <?php
    define('SUBSCRIBE_REMIND_TEXT', '<em>If you enjoyed this post, make sure you <a href="%s">subscribe to my RSS feed</a>!</em>');
    
    function subscribe_remind($content) {
    	if ( is_single() )
    		$content .= "\n\n" . sprintf(SUBSCRIBE_REMIND_TEXT, get_bloginfo('rss2_url'));
    	return $content;
    }
    
    add_filter('the_content', 'subscribe_remind');
    
    ?>
    
    Code (markup):

    Now, what do I need to modify or add here, so that this can appear on my PAGES also, and not just posts.

    Please help.. :cool:
     
    Axus Technologies Inc., Apr 22, 2010 IP
  2. s_ruben

    s_ruben Active Member

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

    
    <?php
    define('SUBSCRIBE_REMIND_TEXT', '<em>If you enjoyed this post, make sure you <a href="%s">subscribe to my RSS feed</a>!</em>');
    
    function subscribe_remind($content) {
    	$content .= "\n\n" . sprintf(SUBSCRIBE_REMIND_TEXT, get_bloginfo('rss2_url'));
    	return $content;
    }
    
    add_filter('the_content', 'subscribe_remind');
    
    ?>
    
    Code (markup):
     
    s_ruben, Apr 22, 2010 IP
  3. Axus Technologies Inc.

    Axus Technologies Inc. Peon

    Messages:
    599
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I did this and it worked,

    Changed ,

    to

     
    Axus Technologies Inc., Apr 22, 2010 IP
  4. Axus Technologies Inc.

    Axus Technologies Inc. Peon

    Messages:
    599
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Another question..

    Lets say, I want to exclude few Pages , from showing this . So, how can I do that ?

    I have the Page IDs ready in a list.
     
    Axus Technologies Inc., Apr 22, 2010 IP
  5. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #5
    I think you can do it like this:

    if(get_the_ID()!=5 || get_the_ID()!=85){
    // the code
    }

    or you can have an array with the pages ids that you want to exclude and do like this:

    if(array_search(get_the_ID(),$excluding_pages_ids)===false){
    // the code
    }
     
    s_ruben, Apr 22, 2010 IP
  6. windy

    windy Active Member

    Messages:
    1,093
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #6
    yes. this code worked
     
    windy, May 1, 2010 IP