Twenty Twelve
[resolved] [Twenty Twelve] Adding elements to the right side of header image (8 posts)

  1. Havends
    Posted 3 years ago #

    What I would basically like to do is to add something like:

    Welcome to MyBlogName!
    Register | Login

    for guests, and,

    Welcome USERNAME!
    Edit your profile | Sign out

    for registered users, to the right side of the header image of Twenty Twelve theme (after reducing the width of header image).
    Using solutions like:

    <?php wp_register(); ?>
    <?php wp_loginout(); ?>

    made each link appear on separate lines. I would like them to appear in the same line.

    It would be great if you could also direct me to adding a 'Header widget' that would align to the right of the header image, which would enable easy additions of links, Search box, etc.

    NB: I am currently working on the theme using Bitnami WordPress Stack. If you want, I can upload the theme files, if necessary.

  2. ThorHammer
    Posted 3 years ago #

    Try to include the content within the headers H1.

  3. Michael
    Part-Time Forum Moderator
    Posted 3 years ago #

    the default output of wp_register() is a html li element; use the corresponding parameter to remove that:



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

  4. Havends
    Posted 3 years ago #

    Thanks a ton alchymyth! It turned out to be just the thing I needed (I am not much into php; just able to understand some parts of it as I go on reading codes). :)

    @ThorHammer Thanks for your valuable time and suggestion. :)

  5. Havends
    Posted 3 years ago #

    After searching around, the following code is what I am using now (to make it easy for other users searching for a solution).

    Please suggest a better alternative, if you have any.

    <div class="welcomein">
    <?php global $user_ID; if( $user_ID ) : ?>
    Welcome <?php global $current_user; get_currentuserinfo(); echo ($current_user->user_login); ?>
    <?php else : ?>
    Welcome to My Site!</br>Please
    <?php endif; ?>
    <?php wp_register(' ',' '); ?> | <?php wp_loginout(); ?></div>
  6. Havends
    Posted 3 years ago #

    Still one doubt...
    Using <?php wp_register(' ',' '); ?> gives me "Register" or "Site Admin".
    I am looking forward to restricting "Subscribers" from Admin pages. So, how can I display "Edit your profile" (wp-admin/profile.php) instead of "Site Admin" (wp-admin/) ?

  7. Michael
    Part-Time Forum Moderator
    Posted 3 years ago #

    you could possibly add a filter function into functions.php of your theme;


    //change 'Site Admin' link and text for logged in 'subscribers' to point to 'Edit your Profile'//
    //anybody with higher capabilities such as 'contributor' and above will get linked to 'Site Admin'//
    function point_admin_link_to_profile( $link ) {
    //check for 'subscriber' with checking for cannot 'edit_posts'//
    if( is_user_logged_in() && !current_user_can('edit_posts') ) {
    $link = str_replace('Site Admin','Edit your Profile', $link);
    $link = str_replace('wp-admin/','wp-admin/profile.php', $link);
    return $link;
  8. Havends
    Posted 3 years ago #

    Thank you alchymyth! :)

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic