1

In my wordpress site I have

<?php wp_loginout(); ?> 

which produces

<a href="http://example.com/wp-login.php">Log in</a>

I want to add the following style to the a tag

style="color:white;"

I don't know php. Would I try find the php and then add it somehow? And how would I add it to the php?

3
  • 1
    you can use external style css for example : .abc a { color:white; } Commented Feb 23, 2016 at 10:09
  • I don't see a class tag Commented Feb 23, 2016 at 10:11
  • please share link here Commented Feb 23, 2016 at 10:16

4 Answers 4

5

Use below code:-

<div id='anchorStyle'>   <!-- define div  -->
  <?php wp_loginout(); ?> 
</div>

CSS

#anchorStyle a{
  color:white;
}

Hope it will help you :)

Sign up to request clarification or add additional context in comments.

Comments

1

wp_loginout() has a filter hook 'loginout' which you could use to influence the output. Add a filter function 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;
}

Ref: http://codex.wordpress.org/Function_Reference/wp_loginout

Comments

0

In functions.php replace/add this filter

add_filter( 'wp_nav_menu_secondary_items','wpsites_loginout_menu_link' );

function wpsites_loginout_menu_link( $menu ) {
    $loginout = '<li class="myNewClass">' . wp_loginout($_SERVER['REQUEST_URI'], false ) . '</li>';
    $menu .= $loginout;
    return $menu;
}

fore reference: http://codex.wordpress.org/Function_Reference/wp_loginout

Comments

0

you can't style the php. The a tag is the tag you should style (html).

if you want to add your style to the a tag best practice is to find/create the file which has extension .css or create a file called (name).css

Simple way to style all your a tags is

a {

color: white;

}

Again, this styles all a tags and I don't know the entire code.

If you would want to specify which a tag gets which colors. Read up on CSS and adding class/id or nested elements.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.