Is there a way to move the Buddypress "buddybar" from the admin bar into the navigation header of my theme. I want to use the "buddybar" menu and drop downs exactly as they are without being forced to use the admin bar.
I have been unable to find any documentation or forum discussions on this. Is there a starting function that can be called, that will load the "buddybar" elsewhere in my theme.
All you need is one piece of code to output most of what you need.
<?php bp_nav_menu(); ?>
Below is the the html and css is used to create the dropdown.
HTML
<ul class="dropdown-menu">
<li>
<ul id="drop-down-user-actions" class="ab-submenu hover">
<li id="drop-down-user-info"><a class="ab-item" href="<?php echo home_url() ?>/members/<?php echo $current_user->user_login ?>/profile/"><?php echo get_avatar( $current_user->ID, '65' );?></a></li>
<li id="drop-down-user-profile"><a class="ab-item" href="<?php echo home_url() ?>/members/<?php echo $current_user->user_login ?>/profile/"><?php echo $current_user->display_name ?></a></li>
<li id="drop-down-edit-profile"><a class="ab-item" href="<?php echo $link; ?>"><?php _e('Edit Profile','cactusthemes') ?></a></li>
<li id="drop-down-logout"><a class="ab-item" href="<?php echo wp_logout_url( get_permalink() ); ?>"><?php _e('Logout','cactusthemes') ?></a></li>
</ul>
</li>
<?php bp_nav_menu(); ?>
</ul>
CSS
#drop-down-user-info img {
position: relative;
width: 64px;
height: 64px;
float:left;
padding:0;
margin:0;
}
#drop-down-user-profile, #drop-down-edit-profile, #drop-down-logout {
margin-left: 80px;
}
#drop-down-user-profile {
color:#FFF;
}
#drop-down-user-profile > a {
text-transform: capitalize;
}
#menu-bp, #drop-down-user-actions {
padding: 6px 0;
background:#4c4c4d;
min-width: 264px;
font-family: 'Open Sans', sans-serif;
font-size: 13px;
font-weight: 300;
color:#C5C5C5
}
#drop-down-user-actions {
background:#26292c;
padding: 20px;
}
#menu-bp > li {
background:#4c4c4d;
}
#menu-bp > li > a, #menu-bp > li > ul > li > a {
padding-right: 1em;
padding-left: 1em;
line-height: 26px;
height: 26px;
white-space: nowrap;
min-width: 140px;
display: block;
}
#menu-bp > li.menu-parent:hover, #menu-bp > li.menu-parent > a:hover, #menu-bp .sub-menu li a:hover {
color: #e14d43;
}
#menu-bp .sub-menu li a {
color: #C5C5C5!important;
}
#menu-bp .sub-menu li a:hover {
color: #e14d43!important;
}
#menu-bp .menu-parent>a:before {
color: inherit!important;
position: relative!important;
font-size: 14px!important;
font-family: FontAwesome!important;
-webkit-font-smoothing: antialiased!important;
right: 5px!important;
top:0px!important;
content: "\f0d9"!important;
}
#menu-bp .menu-parent .sub-menu li > a:before, .dropdown-menu #drop-down-user-actions li > a:before {
content:none!important;
}
#menu-bp > li > ul {
display: none;
margin-left: 0;
left: inherit;
right: 100%;
padding:6px 10px;
margin-top:-32px;
position: absolute;
background:#4c4c4d;
}
#menu-bp .menu-parent:hover > .sub-menu {
display: block;
transition: all .1s ease;
}
#menu-bp > li > ul > li a {
padding:0;
}
#menu-bp li > a > span {
display:none;
}
#menu-bp > li > a {
pointer-events: none;
cursor: default;
}
This should give you a near exact copy of the buddybar but without the admin bar itself
Thanks to the inspiration from the previous answer I came up with this, which also includes the notification bit.
<?php
if (is_user_logged_in()) {
?>
<nav class="bp-nav" role="navigation">
<ul id="bp-nav-menu">
<li id="bp-nav-menu-notifications" class="menupop">
<a class="bp-nav-menu-item" aria-haspopup="true" href="<?php echo $menu_link; ?>">
<?php echo $menu_title; ?>
</a>
<div class="bp-nav-menu-sub-wrapper">
<ul id="bp-nav-menu-notifications-default" class="bp-nav-menu-submenu">
<?php
$notifications = bp_notifications_get_notifications_for_user( bp_loggedin_user_id(), 'object' );
$count = ! empty( $notifications ) ? count( $notifications ) : 0;
$alert_class = (int) $count > 0 ? 'pending-count alert' : 'count no-alert';
$menu_title = '<span id="ab-pending-notifications" class="' . $alert_class . '">' . number_format_i18n( $count ) . '</span>';
$menu_link = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() );
if ( ! empty( $notifications ) ) {
foreach ( (array) $notifications as $notification ) {
?>
<li id="bp-nav-menu-notification-<?php echo $notification->id; ?>">
<a class="bp-nav-menu-item" href="<?php echo $notification->href; ?>">
<?php echo $notification->content; ?>
</a>
</li>
<?php
}
} else {
?>
<li id="bp-nav-menu-no-notifications">
<a class="bp-nav-menu-item" href="<?php echo $menu_link; ?>">
<?php echo __( 'No new notifications', 'buddypress' ); ?>
</a>
</li>
<?php
}
?>
</ul>
</div>
</li>
<li id="bp-nav-menu-my-account" class="menupop with-avatar">
<a class="bp-nav-menu-item" aria-haspopup="true" href="<?php echo bp_loggedin_user_domain(); ?>/profile/edit/">
<?php bp_loggedin_user_fullname(); ?><?php bp_loggedin_user_avatar( 'type=thumb&width=28&height=28' );?>
</a>
<div class="bp-nav-menu-sub-wrapper">
<ul id="bp-nav-menu-user-actions" class="bp-nav-menu-submenu hover">
<li id="bp-nav-menu-user-info">
<a class="bp-nav-menu-item" href="<?php echo bp_loggedin_user_domain(); ?>">
<?php bp_loggedin_user_avatar( 'type=thumb&width=64&height=64' );?>
</a>
</li>
<li id="bp-nav-menu-user-profile">
<a class="bp-nav-menu-item" href="<?php echo bp_loggedin_user_domain(); ?>/profile/edit">
<?php bp_loggedin_user_fullname(); ?>
</a>
</li>
<li id="bp-nav-menu-edit-profile">
<a class="bp-nav-menu-item" href="<?php echo bp_loggedin_user_domain(); ?>/profile/edit">
<?php _e('Edit My Profile', 'buddypress') ?>
</a>
</li>
<li id="logout">
<a class="bp-nav-menu-item" href="<?php echo wp_logout_url( get_permalink() ); ?>">
<?php _e('Log Out', 'buddypress') ?>
</a>
</li>
</ul>
<?php bp_nav_menu(); ?>
</div>
</li>
</ul>
</nav>
<?php
}
?>
The only thing is, I am moving the first <li> out into a functions.php func, because then I'll be able to check it for updates via ajax.
Here's some basic CSS to get started. You probably aren't going to want it to look like the admin bar so no need to try to duplicate that:
#bp-nav-menu > li {
display: inline-block;
}
#bp-nav-menu > li.menupop {
position: relative;
}
#bp-nav-menu > li.menupop .bp-nav-menu-sub-wrapper {
display: none;
position: absolute;
top: 100%;
right: 0;
z-index: 3;
background: #ccc;
min-width: 200px;
}
#bp-nav-menu > li.menupop:hover .bp-nav-menu-sub-wrapper {
display: block;
}
#bp-nav-menu #bp-nav-menu-notifications > a {
padding: 0 0.5em;
}
#bp-nav-menu #bp-nav-menu-notifications > a span {
background: #ddd;
color: #333;
padding: 2px 5px;
border-radius: 4px;
}
#bp-nav-menu #bp-nav-menu-user-actions {
list-style: none;
overflow: hidden;
width: 250px;
}
#bp-nav-menu #bp-nav-menu-user-actions > li {
float: left;
clear: right;
}
#bp-nav-menu #bp-nav-menu-user-actions > li#bp-nav-menu-user-info {
clear: none;
}
#bp-nav-menu #menu-bp {
background: #aaa;
list-style: none;
padding: 0;
}
#bp-nav-menu #menu-bp .no-count {
display: none;
}
#bp-nav-menu #menu-bp .menu-parent {
position: relative;
}
#bp-nav-menu #menu-bp .menu-parent:before {
content: "\f141";
font-family: Dashicons;
}
#bp-nav-menu #menu-bp .menu-parent .sub-menu {
display: none;
position: absolute;
left: -200px;
top: 0;
width: 200px;
background: #999;
list-style: none;
}
#bp-nav-menu #menu-bp .menu-parent:hover .sub-menu {
display: block;
}
If you happen to prefer LESS like me:
#bp-nav-menu {
> li {
display: inline-block;
&.menupop {
position: relative;
.bp-nav-menu-sub-wrapper {
display: none;
position: absolute;
top: 100%;
right: 0;
z-index: 3;
background: #ccc;
min-width: 200px;
}
&:hover {
.bp-nav-menu-sub-wrapper {
display: block;
}
}
}
}
#bp-nav-menu-notifications {
> a {
padding: 0 0.5em;
span {
background: #ddd;
color: #333;
padding: 2px 5px;
border-radius: 4px;
}
}
}
#bp-nav-menu-user-actions {
list-style: none;
overflow: hidden;
width: 250px;
> li {
float: left;
clear: right;
&#bp-nav-menu-user-info {
clear: none;
}
}
}
#menu-bp {
background: #aaa;
list-style: none;
padding: 0;
.no-count {
display: none;
}
.menu-parent {
position: relative;
&:before {
content: "\f141";
font-family: Dashicons;
}
.sub-menu {
display: none;
position: absolute;
left: -200px;
top: 0;
width: 200px;
background: #999;
list-style: none;
> li {
}
}
&:hover .sub-menu {
display: block;
}
}
}
}
Related
I've got a problem : when i try to move the cursor of the mouse on the sub-menu of the drop down, for some motive it disappier.
I try to check in file css end in its file js but at the third day again i didn't find the solutions..i think that could be some problem with [block] in class css. does someone see if there something that wrong end eventually how could operate to resolve this problem? under here post an image with the code.
Thank in advance.
Here another image...maybe understanding better:
here the code about the top-link :
/* ======================================================================================= */
--> .top-link { background: #f7f7f7;line-height: 35px; position: relative;color: #6a6a6a; border-bottom: 1px solid #d8d8d8;}
.form-language, .form-currency { float: left;}
.form-language label { display: none;}
.form-language select, .form-currency select { padding: 4px 10px; background: #f2f2f2;}
p.welcome-msg { margin: 0 0 0 25px; float:left; padding: 5px 0;}
.top-link ul.links { padding: 5px 0;}
.top-link ul.links li { padding:0 15px 0 0; float: left;}
.top-link ul.links li a { color: #6a6a6a;font-size: 11px;text-transform: uppercase; }
.top-link ul.links li a:hover { }
.call-phone{text-align: right;}
.call-phone span{color:#999;font-weight: bold;}
here the code about bottom Drop down :
.drop-lang {
list-style: none;
padding: 0;
margin: 0;float: right;
}
.drop-lang .drop-trigger {
position: relative;
z-index: 9999;
float: right;
padding: 0 5px 0 10px;
}
.drop-lang li a {
position: relative;
padding: 5px 0 5px 0;
display: block;
color: #6a6a6a;
text-transform:uppercase;
font-weight: normal;
font-size: 11px;
z-index: 9999;
}
.drop-lang .drop-trigger .sub-lang {
position: absolute;
top:40px;
left:-1px; /* dropdown left or right */
list-style: none;
padding:0 11px 0 4px;
margin: 0;
display: none;
background: #f7f7f7;
border: 1px solid #d8d8d8;
border-top: none
z-index: 9999;
}
.drop-lang .drop-trigger:hover .sub-lang {
top:45px;
display: block;
}
.drop-lang .sub-lang li a { padding: 0 5px; line-height: 22px; display: block; color: #666; text-transform:uppercase; font-weight: normal; font-size: 11px; border-top: 1px solid #d8d8d8; border-right:0;border-left:0; border-bottom:0; border-radius:0;}
.drop-lang .sub-lang li a:hover { }
Html/php part :
<?php if(count($this->getStores())>1): ?>
<div class="form-language">
<label for="select-language"><?php echo $this->__('Language:') ?></label>
<ul class="drop-lang">
<li class="drop-trigger">
<?php foreach ($this->getStores() as $_lang): ?>
<?php if($_lang->getId() == $this->getCurrentStoreId()): ?>
<a class="<?php echo $_lang->getCode() ?>" href="<?php echo $_lang->getCurrentUrl() ?>"><?php echo $this->htmlEscape($_lang->getName()) ?><i class="fa fa-angle-down"></i></a>
<?php endif?>
<?php endforeach; ?>
<ul class="sub-lang">
<?php foreach ($this->getStores() as $_lang): ?>
<?php $_selected = ($_lang->getId() == $this->getCurrentStoreId()) ? ' class="selected"' : '' ?>
<li><a class="<?php echo $_lang->getCode() ?>" href="<?php echo $_lang->getCurrentUrl() ?>"<?php //echo $_selected; ?>><?php echo $this->htmlEscape($_lang->getName()) ?></a></li>
<?php endforeach; ?>
</ul>
</li>
</ul>
</div>
<?php endif; ?>
Try the fiddle at - https://jsfiddle.net/456f2sf7/
.drop-lang .drop-trigger:hover .sub-lang {
top:20px;//Updated value
display: block;
}
Just decreasing the top margin to 20px, ensures that the dropdown does not disappear as it is visible only on hover.
I have a project which I should finish until tomorrow but I have a problem.
When I resize the browser(smaller), primary-menu disappears and appears an empty element with a name nav-toggle. Even when I removed that nav-toggle, the primary menu is not displayable.
this is my php code
<div class="header-wrapper">
<div class="header">
<div class="section-inner">
<?php if ( get_theme_mod( 'rowling_logo' ) ) : ?>
<a class="blog-logo" href='<?php echo esc_url( home_url('/') ); ?>' title='<?php echo esc_attr( get_bloginfo( 'title' ) ); ?> — <?php echo esc_attr( get_bloginfo( 'description' ) ); ?>' rel='home'>
<img src='<?php echo esc_url( get_theme_mod( 'rowling_logo' ) ); ?>' alt='<?php echo esc_attr( get_bloginfo( 'title' ) ); ?>'>
</a>
<?php elseif ( get_bloginfo( 'description' ) || get_bloginfo( 'title' ) ) : ?>
<h2 class="blog-title">
<?php echo esc_attr( get_bloginfo( 'title' ) ); ?>
</h2>
<?php if ( get_bloginfo( 'description' ) ) : ?>
<h4 class="blog-description">
<?php bloginfo('description'); ?>
</h4>
<?php endif; ?>
<?php endif; ?>
<div class="nav-toggle">
<div class="bars">
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
</div>
</div> <!-- /nav-toggle -->
</div> <!-- /section-inner -->
</div> <!-- /header -->
<div class="navigation">
<div class="section-inner">
<ul class="primary-menu">
<?php if ( has_nav_menu( 'primary' ) ) {
wp_nav_menu( array(
'container' => '',
'items_wrap' => '%3$s',
'theme_location' => 'primary'
) ); } else {
wp_list_categories( array(
'container' => '',
'title_li' => ''
));
wp_list_pages( array(
'container' => '',
'title_li' => ''
));
} ?>
</ul>
<div class="clear"></div>
</div>
</div> <!-- /navigation -->
<ul class="mobile-menu">
<?php
?>
</ul> <!-- /mobile-menu -->
</div> <!-- /header-wrapper -->
this is some css code for primary-menu class
.primary-menu { display: none; }
.primary-menu ul ul {
padding-top: 0;
top: 10px;
}
.primary-menu ul ul li { background: #333; }
.primary-menu ul ul .menu-item-has-children:hover::after { border-left-
color: #333; }
.primary-menu ul ul ul li { background: #444; }
.primary-menu ul ul ul .menu-item-has-children:hover::after { border-left-
color: #444; }
.primary-menu ul ul ul ul li { background: #555; }
.primary-menu ul ul ul ul .menu-item-has-children:hover::after { border-
left- color: #555; }
.primary-menu ul ul ul ul ul li { background: #666; }
.primary-menu ul ul ul ul ul .menu-item-has-children:hover::after { border-
left-color: #666; }
.primary-menu li > ul > li:hover > ul {
opacity: 1;
top: 0;
left: 220px;
margin-left: 0;
}
.navigation .section-inner { background-color: #C0C0C0; }
.primary-menu { font-size: 0.8rem; }
.primary-menu > li {
float: left;
border-right: 1px solid rgba(0,0,0,0.1);
border-left: 1px solid rgba(255,255,255,0.1);
}
.primary-menu > li:last-child:after {
content: "";
display: block;
border-right: 1px solid rgba(255,255,255,0.1);
position: absolute;
top: 0;
right: -2px;
bottom: 0;
}
.primary-menu > li > a {
display: block;
padding: 20px;
font-weight: 900;
text-transform: uppercase;
letter-spacing: 1px;
color: #fff;
text-shadow: 0 1px 0 rgba(0,0,0,0.25);
}
.primary-menu > li.menu-item-has-children > a { padding-right: 34px; }
.primary-menu > li.menu-item-has-children:before,
.primary-menu > li.menu-item-has-children:after {
content: "";
display: block;
border: 4px solid transparent;
border-top-color: #fff;
position: absolute;
top: 50%;
margin-top: -3px;
right: 20px;
}
.primary-menu > li.menu-item-has-children:before {
border-top-color: rgba(0,0,0,0.25);
margin-top: -2px;
}
.primary-menu > li:hover > a {
background: rgba(255,255,255,0.1);
color: #fff;
}
.primary-menu > li.current_menu_item > a {
background: #fff;
border: none;
color: #333;
}
Please anybody can help me how should I do if I want to show the menu even the browser is resized?
Hey I am making a menu for a website for a project I am doing and I couldn't get the Menu item "Login" to align right. I would appreciate it if someone would help me. Also I would be happy to give you any other parts of the code you need. Thanks Joshua
CSS Code
html, body {
padding: 0;
margin: 0;
}
body {
background-color: #fff;
font-family: Arial;
font-size: 14px;
color: #000;
padding: 0;
margin: 0;
}
h1, h2, h3 {
margin-bottom: 40px;
}
p {
margin-bottom: 10px;
line-height: 22px;
}
.title-box {
font-size: 25px;
padding: 15px;
background-color: #fff;
color: #fff;
font-weight: 700;
}
.title-box a {
color: #fff;
text-decoration: none;
}
.header {
background-color: #42444f;
/*margin:20px 10px 0 10px;*/
margin: 0;
color: #acadb1;
font-size: 14px;
font-weight: 600;
letter-spacing: 0.5px;
}
.header_left_box {
float: left;
}
.header_right_box {
float: right;
}
.header a {
text-decoration: none;
}
.header li.active a,
.header li.active:hover a {
color: #fff;
background-color: #2c2f3b;
}
.header li:hover a {
color: #fff;
}
.content {
padding: 45px 35px;
margin: 0;
min-height: 250px;
}
.content a {
text-decoration: underline;
color: #2C2F3B;
}
.footer {
background-color: #42444f;
color: #acadb1;
font-size: 15px;
font-weight: bold;
padding: 30px 35px;
margin: 0;
}
h1 {
font-size: 40px;
margin-top: 0;
}
h2 {
font-size: 25px;
margin-top: 0;
}
.feedback {
border: 1px solid black;
color: black;
padding: 20px;
font-size: 16px;
margin-bottom: 35px;
}
.feedback.error {
border: 1px solid red;
color: red;
}
.feedback.success {
border: 1px solid green;
color: green;
}
ul#menu, ul#menu ul.sub-menu {
padding:0;
margin: 0;
}
ul#menu {
}
ul#menu li, ul#menu ul.sub-menu li {
list-style-type: none;
display: inline-block;
}
ul#menu li {
margin-left: -4px;
}
ul#menu li:first-of-type {
margin-left: 0;
}
ul#menu ul.sub-menu {
padding-bottom: 5px;
}
ul#menu ul.sub-menu li {
margin-left: 0;
}
ul#menu li a {
color: #acadb1;
text-decoration: none;
padding: 15px;
font-weight: bolder;
}
ul#menu li a, ul#menu li ul.sub-menu li a {
text-decoration: none;
display:inline-block;
white-space: nowrap;
}
ul#menu li a:hover {
color: #fff;
}
ul#menu li.active a {
color: #fff;
}
ul#menu li.active ul a {
color: #acadb1;
}
ul#menu li ul.sub-menu li a:hover {
color: #fff;
}
ul#menu li {
position: relative;
}
ul#menu li ul.sub-menu {
display:none;
position: absolute;
top: 44px;
left: 0;
background-color: #42444f;
}
ul#menu li.active ul.sub-menu {
background-color: #2c2f3b;
}
ul#menu li ul.sub-menu li a {
padding: 10px 15px;
font-size: 12px;
}
ul#menu li:hover ul.sub-menu {
display:block;
}
.header .namebox {
float: right;
background-color: #1e2029;
color: #FFFFFF;
font-size: 14px;
font-weight: bold;
height: 100%;
line-height: 44px;
padding: 0 30px;
text-decoration: none;
}
.header .avatar {
float: left;
width: 44px;
height: 44px;
}
input, select, textarea {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
label {
display: block;
margin-bottom: 5px;
line-height: 20px;
}
input {
display: block;
margin-bottom: 15px;
padding: 10px;
}
input[type="text"],
input[type="email"],
input[type="password"] {
border: 1px solid #ddd;
color: #555;
font-weight: bold;
}
input[type="submit"] {
border: 0;
background-color: #2C2F3B;
color: #fff;
font-weight: bold;
cursor: pointer;
}
.remember-me-checkbox {
float: left; min-width: 0; margin: 3px 10px 15px 0;
}
.remember-me-label {
float:left; min-width: 0; font-size: 12px; color: #888;
}
.login-submit-button {
float: none; clear: both;
}
.login-form-password-pattern-reminder {
display: block;
color: #999;
font-size: 11px;
}
.login-default-box,
.login-facebook-box {
display: inline-block;
width: 300px;
vertical-align: top;
}
a.facebook-login-button,
a.facebook-register-button {
background-color: #3b5998;
color: #fff;
text-decoration: none;
font-size: 16px;
font-weight: bolder;
padding: 15px 20px;
border-radius: 4px;
}
a.facebook-login-button:hover,
a.facebook-register-button:hover {
background-color: #2f477a;
}
.register-default-box,
.register-facebook-box {
display: inline-block;
width: 300px;
vertical-align: top;
}
.clear-both {
clear: both;
}
.debug-helper-box {
position: fixed;
bottom: 20px;
right: 0;
padding: 20px;
color: #fff;
background-color: red;
font-weight: bold;
}
#media only screen and (max-width:800px) {
.header_left_box,
.header .avatar {
float: none;
}
.header_right_box {
width: 100%;
background-color: #1E2029;
}
ul#menu li {
width: 100%;
text-align: center;
margin-left: 0;
}
ul#menu li a {
display: block;
}
ul#menu li ul.sub-menu {
display: block;
position: relative;
top: 0;
}
ul#menu li ul.sub-menu li {
font-size: 12px;
background-color: #4a4c55;
}
ul#menu li.active ul.sub-menu li {
background-color: #2C2F3B;
}
ul#menu ul.sub-menu {
padding-bottom: 0;
}
}
.avatar img {
width: 44px;
height: 44px;
}
table{
border-collapse: collapse;
border-spacing: 0;
border: 1px solid black;
-moz-border-radius-bottomleft:0px;
-webkit-border-bottom-left-radius:0px;
border-bottom-left-radius:0px;
-moz-border-radius-bottomright:0px;
-webkit-border-bottom-right-radius:0px;
border-bottom-right-radius:0px;
-moz-border-radius-topright:0px;
-webkit-border-top-right-radius:0px;
border-top-right-radius:0px;
-moz-border-radius-topleft:0px;
-webkit-border-top-left-radius:0px;
border-top-left-radius:0px;
height:100%;
margin:0px;padding:0px;
} tr:last-child td:last-child {
-moz-border-radius-bottomright:0px;
-webkit-border-bottom-right-radius:0px;
border-bottom-right-radius:0px;
}
table tr:first-child td:first-child {
-moz-border-radius-topleft:0px;
-webkit-border-top-left-radius:0px;
border-top-left-radius:0px;
}
table tr:first-child td:last-child {
-moz-border-radius-topright:0px;
-webkit-border-top-right-radius:0px;
border-top-right-radius:0px;
} tr:last-child td:first-child{
-moz-border-radius-bottomleft:0px;
-webkit-border-bottom-left-radius:0px;
border-bottom-left-radius:0px;
} tr:hover td{
background-color:#ffffff;
}
td{
vertical-align:middle;
background-color:#ffffff;
border:1px solid #000000;
border-width:0px 1px 1px 0px;
text-align:left;
padding:7px;
font-size:10px;
font-family:Arial;
font-weight:normal;
color:#000000;
} tr:last-child td{
border-width:0px 1px 0px 0px;
} tr td:last-child{
border-width:0px 0px 1px 0px;
} tr:last-child td:last-child{
border-width:0px 0px 0px 0px;
}
tr:first-child td{
background:-o-linear-gradient(bottom, #ff7f00 5%, #ff0000 100%); background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ff7f00), color-stop(1, #ff0000) );
background:-moz-linear-gradient( center top, #ff7f00 5%, #ff0000 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff7f00', endColorstr='#ff0000'); background: -o-linear-gradient(top,#ff7f00,ff0000);
background-color:#ff7f00;
border:0px solid #000000;
text-align:center;
border-width:0px 0px 1px 1px;
font-size:14px;
font-family:Arial;
font-weight:bold;
color:#ffffff;
}
tr:first-child:hover td{
background:-o-linear-gradient(bottom, #ff7f00 5%, #ff0000 100%); background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ff7f00), color-stop(1, #ff0000) );
background:-moz-linear-gradient( center top, #ff7f00 5%, #ff0000 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff7f00', endColorstr='#ff0000'); background: -o-linear-gradient(top,#ff7f00,ff0000);
background-color:#ff7f00;
}
tr:first-child td:first-child{
border-width:0px 0px 1px 0px;
}
tr:first-child td:last-child{
border-width:0px 0px 1px 1px;
}
Menu Code
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Login</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<?php echo URL; ?>application/libs/css/reset.css" />
<link rel="stylesheet" href="<?php echo URL; ?>application/libs/css/style.css" />
<script type="text/javascript" src="//code.jquery.com/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="<?php echo URL; ?>application/libs/js/application.js"></script>
</head>
<body>
<div class='title-box'>
<img src=''>
</div>
<div class="header">
<div class="header_left_box">
<ul id="menu">
<li <?php if ($this->checkForActiveController($filename, "index")) { echo ' class="active" '; } ?> >
Forum
</li>
<li <?php if ($this->checkForActiveController($filename, "helpcenter")) { echo ' class="active" '; } ?> >
Help Center
</li>
<?php if (Session::get('user_logged_in') == true):?>
<li <?php if ($this->checkForActiveController($filename, "dashboard")) { echo ' class="active" '; } ?> >
Dashboard
</li>
<?php endif; ?>
<?php if (Session::get('user_logged_in') == true):?>
<li <?php if ($this->checkForActiveController($filename, "login")) { echo ' class="active" '; } ?> >
My Account
<ul class="sub-menu">
<li <?php if ($this->checkForActiveController($filename, "login")) { echo ' class="active" '; } ?> >
Change account type
</li>
<li <?php if ($this->checkForActiveController($filename, "login")) { echo ' class="active" '; } ?> >
Upload an avatar
</li>
<li <?php if ($this->checkForActiveController($filename, "login")) { echo ' class="active" '; } ?> >
Edit my username
</li>
<li <?php if ($this->checkForActiveController($filename, "login")) { echo ' class="active" '; } ?> >
Edit my email
</li>
<li <?php if ($this->checkForActiveController($filename, "login")) { echo ' class="active" '; } ?> >
Edit my password
</li>
<li <?php if ($this->checkForActiveController($filename, "login")) { echo ' class="active" '; } ?> >
Logout
</li>
</ul>
</li>
<?php endif; ?>
<?php if (Session::get('user_type') == 1):?>
<li <?php if ($this->checkForActiveController($filename, "student")) { echo ' class="active" '; } ?> >
Student
<ul class="sub-menu">
<li <?php if ($this->checkForActiveController($filename, "student")) { echo ' class="active" '; } ?> >
</li>
</ul>
</li>
<?php endif; ?>
<?php if (Session::get('user_type') == 2):?>
<li <?php if ($this->checkForActiveController($filename, "student")) { echo ' class="active" '; } ?> >
Student
<ul class="sub-menu">
<li <?php if ($this->checkForActiveController($filename, "student")) { echo ' class="active" '; } ?> >
</li>
</ul>
</li>
<li <?php if ($this->checkForActiveController($filename, "teacher")) { echo ' class="active" '; } ?> >
Teacher
<ul class="sub-menu">
<li <?php if ($this->checkForActiveController($filename, "teacher")) { echo ' class="active" '; } ?> >
</li>
</ul>
</li>
<?php endif; ?>
<?php if (Session::get('user_type') == 3):?>
<li <?php if ($this->checkForActiveController($filename, "student")) { echo ' class="active" '; } ?> >
Student
<ul class="sub-menu">
<li <?php if ($this->checkForActiveController($filename, "student")) { echo ' class="active" '; } ?> >
</li>
</ul>
</li>
<li <?php if ($this->checkForActiveController($filename, "teacher")) { echo ' class="active" '; } ?> >
Teacher
<ul class="sub-menu">
<li <?php if ($this->checkForActiveController($filename, "teacher")) { echo ' class="active" '; } ?> >
</li>
</ul>
</li>
<li <?php if ($this->checkForActiveController($filename, "admin")) { echo ' class="active" '; } ?> >
Admin
<ul class="sub-menu">
<li <?php if ($this->checkForActiveController($filename, "admin")) { echo ' class="active" '; } ?> >
</li>
</ul>
</li>
<?php endif; ?>
<?php if (Session::get('user_logged_in') == false):?>
<li class='right' <?php if ($this->checkForActiveControllerAndAction($filename, "login/index")) { echo ' class="active" '; } ?> >
Login
</li>
<?php endif; ?>
</ul>
</div>
<?php if (Session::get('user_logged_in') == true): ?>
<div class="header_right_box">
<div class="namebox">
Hello <?php echo Session::get('user_name'); ?>!
</div>
<div class="avatar">
<?php if (USE_GRAVATAR) { ?>
<img src='<?php echo Session::get('user_gravatar_image_url'); ?>'
style='width:<?php echo AVATAR_SIZE; ?>px; height:<?php echo AVATAR_SIZE; ?>px;' />
<?php } else { ?>
<img src='<?php echo Session::get('user_avatar_file'); ?>'
style='width:<?php echo AVATAR_SIZE; ?>px; height:<?php echo AVATAR_SIZE; ?>px;' />
<?php } ?>
</div>
</div>
<?php endif; ?>
<div class="clear-both"></div>
</div>
.header_left_box { }
ul#menu li:last-child {
float: right;
}
As I stated earlier, you need to restructure your menu code for this to work. This works http://jsfiddle.net/andyjh07/MVzR7/
Try adding float:right to ul#menu
ul#menu {
float:right;
}
If it'll not work then I have to see some working demo of your code.
UPDATE
http://jsfiddle.net/dwebexperts/fL3tG/
I think I got the issue. Your code is:-
<div class="header_left_box">
Your menu is here I think
</div>
<div class="header_right_box">
//Your other code
</div>
AND
Your CSS is:-
.header_left_box {
float: left;
}
.header_right_box {
float: right;
}
It shows that div containing your Menu will be on left side. You have to inter-change the classes of both the divs or you can take your menu our of this div <div class="header_left_box">
Remove width: 100%; from this:-
ul#menu li {
width: 100%;
text-align: center;
margin-left: 0;
}
Use this in your css menu field:
float:right;
I was wondering how I can achieve an effect similar to this website. When you scroll down the site the logo disappears but the menu remains fixed:
http://www.nowness.com/
This is my site: http://www.itsalifestylething.co.uk/quick-cupcake-catch-up/
PHP
<body <?php body_class(); ?>>
<div id="page" class="hfeed site">
<header id="masthead" class="site-header" role="banner">
<hgroup>
<h1 class="site-title"><img src="http://www.itsalifestylething.co.uk/wp-content/uploads/2013/11/logo-large.png" /></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</hgroup>
<nav id="site-navigation" class="main-navigation" role="navigation">
<h3 class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></h3>
<a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?></a>
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
</nav><!-- #site-navigation -->
<?php if ( get_header_image() ) : ?>
<img src="<?php header_image(); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />
<?php endif; ?>
</header><!-- #masthead -->
<div id="main" class="wrapper">
CSS
/* Header
------------------------------------------------------------ */
.site-header {
padding: 5px 0 !important;
}
hgroup {
width: 100%;
}
#masthead {
width: 960px;
margin: 0 auto;
position: relative;
}
h1.site-title {
margin: 0 auto;
width: 480px;
height: 123px;
}
.social img {
margin-right: 15px;
}
/* Nav
------------------------------------------------------------ */
.main-navigation {
width: 100%;
margin: 0px !important;
}
.main-navigation div.nav-menu > ul {
border: 0px !important;
margin: 0 auto;
width: 430px;
}
.main-navigation li {
margin: 0 25px 0 0;
}
.main-navigation li ul {
padding-top: 2px;
z-index: 10;
}
.main-navigation li a:hover, .main-navigation .current_page_item > a {
color: #33d898;
font-weight: normal;
}
.main-navigation li ul {
-webkit-box-shadow: 0px 5px 10px 1px rgba(0,0,0,0.2);
box-shadow: 0px 5px 10px 1px rgba(0,0,0,0.2);
width: 200px;
}
.main-navigation li ul li a {
background: #ffffff;
border-bottom: 1px solid #e7e7e7
}
.main-navigation li ul li a:hover {
background: #ffffff;
color: #33d898;
}
.nav-menu {
border-bottom: 1px solid #e7e7e7;
}
This is how I would go about it with html, css, and jQuery.
First this is how I would order my html,
<nav>
<span class="logo">Your Logo</span>
<ul>
<li id="logo">Your Logo</li>
<li>Link</li>
<li>Link</li>
<li>Link</li>
<li>Link</li>
<li>Link</li>
<li>Link</li>
<li>Link</li>
<li>Link</li>
<li>Link</li>
<li>Link</li>
</ul>
</nav>
Next the css,
html, body {
margin: 0;
padding: 0;
}
ul {
margin: 0;
padding: 0;
list-style-type: none;
}
nav {
width: 80%;
background: #c1c1c1;
position: fixed;
top: 0;
left: 50%;
margin-left: -40%;
}
nav li {
display: inline-block;
cursor: pointer;
}
#logo {
display: none;
}
#logo.scroll {
display: inline-block;
}
.logo {
font-size: 50px;
font-family: "century gothic";
}
and finally the little bit of jQuery,
$(window).scroll(function() {
$('.logo').hide();
$('#logo').addClass('scroll');
if ($(window).scrollTop() === 0) {
$('.logo').show();
$('#logo').removeClass('scroll');
}
});
Here is a jsfiddle, Link.
You have to use javascript to add a position: fixed to your header. Also you need to give your body an offset.
nav-menu-static {
position: fixed;
top: 0;
background: #fff;
width:960px
}
#masthead {
background: none repeat scroll 0 0 #FFFFFF;
margin: 0 auto;
position: fixed;
width: 960px;
}
Then set the margin-top for the .site-content class
I am trying to get three images to connect for my content box but for some reason there is some space between the second and the third. Any help would be appreciated.
here is the site: http://hyvhuynh.com/hyperbolical-blog
<?php get_header(); ?>
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class();?> id="post-<?php the_ID();?>">
<div id="mythreedivs">
<div id="top">
</div>
<div id="mid">
<h2 class="post-title"><?php the_title(); ?></h2>
<ul class="meta">
<li><?php the_time('F j, Y'); ?></li>
</ul>
<div class="postcontent">
<?php the_content(the_title('', '', false)." - continue reading"); ?>
</div>
<ul class="meta postfoot">
<?php if('open' == $post->comment_status) : ?><li class="comment_link"><?php comments_popup_link('Comment on '.$post->post_title, '1 Comment on '.$post->post_title, '% Comments on '.$post->post_title,'postcomment','Comments are off for '.$post->post_title); ?></li><?php endif;?>
<?php if(get_the_tag_list()) :?>
<li>Tags: <?php the_tags('<ul><li>',',</li> <li>','</li></ul>');?></li>
<?php endif;?>
</ul>
</div>
<?php endwhile; ?>
<ul class="prevnext">
<li><?php next_posts_link('« Older Posts'); ?></li>
<li><?php previous_posts_link('Newer Posts »');?></li>
</ul>
<div id="bottom">
</div>
<?php endif; ?>
</div>
</div>
<?php get_footer(); ?>
---------css---------------
#mid {
background-image:url('http://hyvhuynh.com/wp-content/themes/zenlite/images/bodymiddle.png');
width:806px;
}
#bottom {
background-image:url('http://hyvhuynh.com/wp-content/themes/zenlite/images/bodybottom.png');
width:806px;
height:27px;
}
#header {
width:800px;
float:right;
margin:0 0 50px 0;
}
/*
Navigation Bar Time!
*/
#jsddm
{ margin: 20px 0 0 0;
padding: 0;
font-weight:bold;
text-shadow: #000000;
}
#jsddm li
{ float: left;
list-style: none;
font: bold 12px Tahoma, Arial}
#jsddm li a
{ display: block;
background: #E7E7EF;
padding: 5px 12px;
text-decoration: none;
border: 1px solid #555555;
width: 70px;
color:#000000;
white-space: nowrap}
#jsddm li a:hover
{ background: #1A4473}
#jsddm li ul
{ margin: 0;
padding: 0;
position: absolute;
visibility: hidden;
}
#jsddm li ul li
{ float: none;
display: inline}
#jsddm li ul li a
{ width: auto;
background: #E7E7EF}
#jsddm li ul li a:hover
{ background: #1A4473}
/*
End Navigation Time!
*/
.logo {
float:right;
}
#content .post {
float:left;
width:800px;
}
#content .page,#content .attachment,.postcontent {
width:800px;
text-decoration:none;
}
.photo {
width: 250px;
height:700px;
background-color:#000000;
margin:0 0 0 880px;
}
.slideshow { height: 232px; width: 232px; margin:0 0 0 880px; }
.slideshow img { border: 5px solid #000; }
.post-title {
margin:0;
padding:0;
text-align:center;
}
.post-title a {
text-decoration:none;
color:#000000;
}
.post-title a:hover,.post-title a:active,.post-title a:focus {
text-decoration:underline;
color:#5F625F;
}
#content .meta li,#content .prevnext li,#content .gallery li {
list-style-image:none;
list-style:none;
}
.meta {
margin:5px 0 0;
padding:0;
font-size:.85em;
}
.meta ul,.meta li {
margin:0;
padding:0;
}
.meta ul {
display:inline;
}
.meta li li {
display:inline;
padding-right:.3em;
}
.postfoot {
clear:both;
padding-bottom:10px;
line-height:1.2em;
}
.author .posts-by {
padding-top:10px;
}
.clearfix {
display: inline-block; }
.clearfix:after {
content: " ";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
#footer {
clear:both;
margin:0 auto;
padding:0 0 5px;
text-align:center;
font-size:.8em;
border: 0;
width:800px;
height:200px;
}
#footer ul {
clear:both;
margin:0;
padding:0;
}
#footer li {
display:inline;
margin:0;
padding:0 5px;
}
#footer li.rss {
position:relative;
top:3px;
}
.copyright {
}
.copyright a
{
}
.copyright a:hover
{
}
.postcontent p {
text-decoration:none;
border:0;
border-style:none;
}
.postcontent p a:hover {
color:#fff;
}
The space is from the margin on your unordered list. Add this to your stylesheet
ul.prevnext {margin: 0px;}
And it'll correct it. I'm not sure what you're doing with it though, so you may want to just scrap it for now because once you add any items, it will pop up again. Or move it to a different position as mltsteeves mentioned.
<ul class="prevnext"> is causing the space between the two divs, try putting it inside the previous div.
You have nesting errors in your markup. I would sort them out first, from what I can see in Firebug, it might already sort it out.
end tag for "div" omitted, but OMITTAG NO was specified
end tag for "ul" which is not finished
The block below:
<ul class="prevnext">
<li></li>
<li></li>
</ul>
is not contained inside the proper <div> tag, it is between your mid and bottom divs.