WordPress.org

Ready to get started?Download WordPress

Forums

I need help with globals (2 posts)

  1. seramar
    Member
    Posted 6 years ago #

    Hi, I am developing my first plugin and have hit my first (semi)impassible road block and it involves the use of globals... I just don't get it and could really need some help. Thanks a lot!

    $tdzWitCount = 1;

    add_filter('bloginfo', 'tdz_add_wit', 10, 2);

    function tdz_add_wit($info, $show) {
    global $tdzWitCount;
    if (($show == 'name') && ($tdzWitCount == 1)) {
    $info = $info . " " . "now has wit.";
    $tdzWitCount++;
    }
    return $info;
    }

    I also tried:

    add_filter('bloginfo', 'tdz_add_wit', 10, 2);

    function tdz_add_wit($info, $show) {
    static $count = 1;
    if (($show == 'name') and ($count == 1)) {
    $info = $info . " " . "is infinitely resourceful.";
    $count == ($count + 1);
    }
    return $info;
    }

  2. Obvious
    Member
    Posted 6 years ago #

    And the problem is..?

Topic Closed

This topic has been closed to new replies.

About this Topic