Support » Plugins » Just a tiny bit of PHP help.

  • bluehorse2

    (@bluehorse2)


    Ok simple WP content word replacement plugin.

    <?php
    /**
    Plugin Name: replace
    Author: bluehorse
    */
    add_filter('the_content', 'replace_the_content');
    function replace_the_content($content) {
    $content = str_replace('username', '<a href="http://www.usersurl.com">username', $content);
    return $content;
    }
    ?>

    Can anyone offer a little help on how to just insert say <a href="get_the_author_url">get_the_author_nickname</a> on to the end of the content.

    I can’t figure out how to just insert things and my eyes are hurting. :S

    All links to other info would be appreciated I’ve seached and searched. Currently I’m stuck on http://uk2.php.net/manual/en/ref.strings.php

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Can anyone offer a little help on how to just insert say get_the_author_nickname on to the end of the content.

    Like this?
    <?php
    function add_to_the_content($content) {
    $content .= '<a href="' . get_the_author_url() . '">' . get_the_author_nickname() . '</a>';
    return $content;
    }
    add_filter('the_content', 'add_to_the_content');
    ?>

    bluehorse2

    (@bluehorse2)

    Thankyou 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Just a tiny bit of PHP help.’ is closed to new replies.