PHP Code Widget
[resolved] Function from function.php (2 posts)

  1. cuncta
    Posted 2 years ago #

    Hi !

    I try to call into a widget a function from function.php file. I call the function in a widget into the sidebar with this:

    <?php add_login_logout_link($items, $args); ?>

    My function from function .php is:

    function add_login_logout_link($items, $args)
        $newitems = $$items;
        $newitems .= '
                      <li><a class="button wc-forward" title="mon compte" href="/mon-compte/">Mon compte</a></li>
                      <li><a class="button wc-forward" title="se d├ęconnecter" href="'. wp_logout_url('index.php') .'">Se d├ęconnecter</a></li>';
        $newitems = $items;
        $newitems .= '<li><a class="button wc-forward" title="Login" href="'. wp_login_url('/catalogue-investissement/') .'">Se connecter</a></li>';
      return $newitems;

    Nothing is display this that. I try to use $GLOBALS['variablex'] but it doesn't work.

    Thanks for your help. I keep trying to find !


  2. Samuel Wood (Otto)
    WordPress.org Tech Dude
    Plugin Author

    Posted 2 years ago #

    Your function returns HTML, which you then do nothing with.

    Add an echo before your call to the function.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic