• I have tried to use add_action method with all possible methods but it have no effect on code implementation.

    can some one guide me best suitable way how to use add_action method and add_shortcode hook.

    Thanks in advance

Viewing 9 replies - 1 through 9 (of 9 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    First show the code in which you have tried to use add_action

    Thread Starter uzairshah

    (@uzairshah)

    This is a simple scenario for testing I have adopted for testing

    function abc_func($attr)
    {
    echo “a”;
    return “hello”;
    }
    add_shortcode(“abc”,”abc_func()”);

    ==================================================
    for add_Action
    add_action(‘admin_menu’, ‘myplguin_menu’);

    function myplugin_menu() {
    // Add a submenu to the Dashboard:
    add_submenu_page(‘post.php’, ‘My Plugin Managment’, ‘My Plugin Managment’, 8, ‘myplugin/myplugin_admin.php’);
    }

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Try add_action after the function myplugin_menu

    Thread Starter uzairshah

    (@uzairshah)

    yeah I have tried event at the end of the page but all in vain. ??

    Thread Starter uzairshah

    (@uzairshah)

    Do you have some working example
    ?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    function addMyScript() {
        wp_enqueue_style('joetremlin', get_bloginfo('template_directory').'/resets.css', array('blueprint'), '', 'screen, projection');
    }
    add_action('wp_head', 'addMyScript');
    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Thread Starter uzairshah

    (@uzairshah)

    I have tried these examples but it is not working actually. is there any possibility that it is a version problem or something like

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Which WordPress version do you have and what do you mean, “not working”, are you receiving an error or anything useful?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘add_action is not working in any case’ is closed to new replies.