WordPress.org

Ready to get started?Download WordPress

Forums

How to add a selector to wp_loginout (5 posts)

  1. scottsemple
    Member
    Posted 3 years ago #

    I'm trying to style wp_loginout without success. Shouldn't this work?

    <?php wp_loginout('class="woo-sc-button"'); ?>

    Thanks!

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

  3. scottsemple
    Member
    Posted 3 years ago #

    Thanks. I read that previously, but I didn't see ny info on adding a selector.

  4. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    there is probably no parameter to add an selector.

    however, wp_loginout() has a filter hook 'loginout' which you could use to influence the output - i.e. to include a selector.

    for instance by adding a filter function like this to functions.php of your theme:

    add_filter('loginout', 'loginout_selector');
    function loginout_selector($text) {
    $selector = 'class="woo-sc-button"';
    $text = str_replace('<a ', '<a '.$selector, $text);
    return $text;
    }
  5. scottsemple
    Member
    Posted 3 years ago #

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic