WordPress.org

Support

Support » Themes and Templates » [Resolved] [Twenty Twelve] Adding elements to the right side of header image

[Resolved] [Twenty Twelve] Adding elements to the right side of header image

  • 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.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Try to include the content within the headers H1.

    Moderator Michael

    @alchymyth

    Forum Moderator

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

    http://codex.wordpress.org/Function_Reference/wp_register

    example:

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

    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. 🙂

    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>

    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/) ?

    Moderator Michael

    @alchymyth

    Forum Moderator

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

    example:

    //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'//
    add_filter('register','point_admin_link_to_profile');
    
    function point_admin_link_to_profile( $link ) {
    //http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table//
    //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;
    }

    Thank you alchymyth! 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] [Twenty Twelve] Adding elements to the right side of header image’ is closed to new replies.