removing list item from wp-loginout and wp-register (3 posts)

  1. Mercer2789
    Posted 6 years ago #

    I've added this code to display the links for log in/log out, and register/site admin.

    <?php wp_loginout(); ?>

    <?php wp_register(); ?>

    The problem I'm having is the html those commands generate has the text displayed as a list item.

    <li><a href="http://www.myblogsurl.com/wp-admin/">Site Admin</a></li>

    How can I stop it from making these list items and just only display the link as regular text?
    I'm not the best with php and checked over my theme's function code a few times unable to find the problem.
    I'm assuming it's how wordpress automatically generates these.

  2. esmi
    Forum Moderator
    Posted 6 years ago #

    You can amend the output of wp_register but not wp_loginout. Your best option would be to re-style those lists using CSS.

  3. finofontana
    Posted 6 years ago #

    Hai esmi, Are you suggesting to edit the wp_register() function? If so: wp_register() would be in general-template.php which is a WP core file. Editing core files is dangerous, because the changes could be overwritten when upgrading WP.
    What you can do, is to call wp_register() with arguments like this:

    <?php wp_register( '', '' ); ?>

    This way you'll get rid of the li tags. Or you can call the function with tags of your liking:

    <?php wp_register( '<div class="register">', '</div>' ); ?>

    Next you'll go and CSS the tag.

    (also see: http://codex.wordpress.org/Function_Reference/wp_register).


Topic Closed

This topic has been closed to new replies.

About this Topic