WordPress.org

Ready to get started?Download WordPress

Forums

Stupid php question (10 posts)

  1. mpjltd
    Member
    Posted 3 years ago #

    // add custom post content
    function add_post_content($content) {
    	if(!is_feed() && !is_home()) {
    		$content .= '<p>Copyright &copy; '.date('Y').'&nbsp;'.bloginfo('name').'</p>';
    	}
    	return $content;
    }
    add_filter('the_content', 'add_post_content');

    The html source output is
    myblog<p>Copyright &copy; 2011&nbsp;</p>

    and normal:

    myblog
    Copyright © 2011

    WHat is wrong with my php ?

  2. _blackened_
    Member
    Posted 3 years ago #

    Nothing. What's your charset?

    And why do you write out the &copy and &nbsp. That's not necessary if you use the right charset.

  3. mpjltd
    Member
    Posted 3 years ago #

    utf-8

  4. converting2wp
    Member
    Posted 3 years ago #

    Or are you asking why the "myblog" is coming out before the copyright notice instead of after as in the

    $content .= '<p>Copyright &copy; '.date('Y').'&nbsp;'.bloginfo('name').'</p>';

    in your original post?

    Hope you've figured this out ...

  5. mpjltd
    Member
    Posted 3 years ago #

    nope

  6. converting2wp
    Member
    Posted 3 years ago #

    So the question is that "bloginfo" is at the end of the PHP code but at the beginning of the output?

    Bizarre.

  7. mpjltd
    Member
    Posted 3 years ago #

    yes, correct
    I really don't have a clue

  8. GRAQ
    Member
    Posted 3 years ago #

  9. converting2wp
    Member
    Posted 3 years ago #

    Doh. Thanks, GRAQ.

  10. mpjltd
    Member
    Posted 3 years ago #

    it's like when u go to a shop ask where the toilet paper is, and the answer is: it's there where the toilet paper is.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags