Arun’s The Morning After is a great WordPress theme. However, every blogger is different and has different needs. Therefore, I made some customisations to „satisfy“ my needs.
One of these needs is to have a small control panel in my sidebar that:
f these needs is to have a small control panel in my sidebar that:
- is only offered if the Administration > Options > General > Membership: Anyone can register box is checked.
- offers a login / registration form to unregistered visitors (if the mentioned box is checked)
- displays to a registered user the links to the WordPress Dashboard, the „write new post“ page and to his WordPress profile.
- gives the a registered user the possibility to log out.
Forunately, I have found the code for those requirements quite fast. I just had to make it ready for The Morning After. If you share my needs for this control panel, here is the tutorial:
siebbar.php
Open the sidebar.php file in your theme editor and insert the following code between the id=“side_categories“ and the h3 headline class=“mast“ Categories
<?php global $user_ID, $user_identity, $user_level ?>
<?php if ( $user_ID ) : ?>
<h3 class="mast">Control panel</h3>
<ul class="cat">
<li><a href="<?php bloginfo('url') ?>/wp-admin/">Dashboard</a></li>
<?php if ( $user_level >= 1 ) : ?>
<li><a href="<?php bloginfo('url') ?>/wp-admin/post-new.php">Write an article</a></li>
<?php endif // $user_level >= 1 ?>
<li><a href="<?php bloginfo('url') ?>/wp-admin/profile.php">Profile</a></li>
<li><a href="<?php bloginfo('url') ?>/wp-login.php?action=logout&redirect_to=<?php echo urlencode($_SERVER['REQUEST_URI']) ?>">Log out</a></li>
</ul>
<?php elseif ( get_option('users_can_register') ) : ?>
<h3 class="mast">Identification</h3>
<ul class="login">
<li>
<form action="<?php bloginfo('url') ?>/wp-login.php" method="post">
<p class="login">
<label for="log"><input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="22" /> User</label><br />
<label for="pwd"><input type="password" name="pwd" id="pwd" size="22" /> Password</label><br />
<input type="submit" name="submit" value="Send" class="button" />
<label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Remember me</label><br />
</p>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
</form>
</li>
<li><a href="<?php bloginfo('url') ?>/wp-register.php">Register</a></li>
<li><a href="<?php bloginfo('url') ?>/wp-login.php?action=lostpassword">Recover password</a></li>
</ul>
<?php endif // get_option('users_can_register') ?>
style.css
Open the sidebar.php file in your theme editor and insert the following code between the id=“side_categories“ and the h3 headline class=“mast“ Categories:
/* Category List */
#side_categories { margin: 0 0 1em 0; }
ul.login li { list-style: none; }
p.login {text-align:left; }
ul.cat li { padding: 0 0 0.3em 0; margin: 0;}
The result
The control panel for registered users, log-in from for unregistered (and logged out) users.
Schreibe einen Kommentar