WordPress.org

Ready to get started?Download WordPress

Forums

Problem with classes, functions and hooks (2 posts)

  1. Ameisenman
    Member
    Posted 3 years ago #

    Hi,
    I am currently developing some extensions for a theme and I got stuck on a problem:
    I have a class

    class myClass
    {
    function myFunction()
    {
    return "Anything";
    }
    }
    $myClass = new myClass();

    I also have a function which creates a tag for easier use inside the theme called the_extension :

    function the_extension()
    {
    global $post;
    if($post->ID == '1')
    {
    add_action('init', array('myClass', 'myFunction'));
    }
    }

    This doesn't work... Where did I go wrong???

    Thanx in advance

  2. stvwlf
    Member
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.