wp_loginout() in footer
-
Hello,
I’d like to add the wp_loginout() function to the footer.
I created a function in functions.php.But the wp_loginout() won’t be in the <p> function of the sprint().
Whats wrong with that?
Here is my custom function from the functions.phpadd_filter( 'tc_credits_display', 'my_credits_display' ); function my_credits_display($html) { ?> <div class="span4 credits"> <?php $credits = sprintf( '<p> · © %1$s <a href="%2$s" title="%3$s" rel="bookmark">%3$s</a> · %4$s ·</p>', esc_attr( date( 'Y' ) ), esc_url( home_url() ), esc_attr(get_bloginfo()), '<a href="'.TC_WEBSITE.'">Themes & Co.</a>' ); echo $credits; $anmelden = sprintf( '<p> · %1$s · </p>',esc_url(wp_loginout())); echo $anmelden; ?> </div> <?php }
-
http://codex.wordpress.org/Function_Reference/wp_loginout
the ‘echo’ parameter of
wp_loginout()
needs to be set accordingly if you want to use it in a string operation.example:
$anmelden = sprintf( '<p> · %1$s · </p>',esc_url(wp_loginout('', false)));
Hi,
thanks for the feedback.
I integrated your example but %1$s is empty.
Only the points will be shown.Is here a failure in the $anmelden variable ?
Do what alchymyth says but don’t use esc_url :), which btw is useless since wp_loginout already uses it:
https://core.trac.wordpress.org/browser/tags/3.9.1/src/wp-includes/general-template.php#L282try and remove the
esc_url
– this is already part of the functionwp_loginout()
i.e.:
$anmelden = sprintf( '<p> · %1$s · </p>', wp_loginout('',false));
Hi guys,
thanks for the fast feedback.
What I have to say, it works.
Greatfull thanks.
- The topic ‘wp_loginout() in footer’ is closed to new replies.