Hey so I have a problem, one I cant figure out. I cant seem to make it so only one sub menu to show up. Ex: When on About.php it has a constant submenu based on the code below. So when I click on Info for another submenu to pop up I want it to close the constant submenu and open the new. Not just write me another submenu below it. I do not care really what form it is in, javascript or php. Just would like it simple for me to do, and if you need my js file: JS FILE
CODE:
<div id="div_2" style="display:none">
<div id="sub-menu">
<ul class="menu">
<li>VIDEOS</li>
<li>PHOTOS</li>
<li>UPLOAD</li>
<li>FILES</li>
</ul>
</div>
</div>
<div id="div_3" style="display:none">
<div id="sub-menu">
<ul class="menu">
<li>ABOUT</li>
<li>CONTACT</li>
</ul>
</div>
</div>';
if ($sub == 'gallery')
echo '<div id="div_1" style="display:none"></div>
<div id="div_2">
<div id="sub-menu">
<ul class="menu">
<li>VIDEOS</li>
<li>PHOTOS</li>
<li>UPLOAD</li>
<li>FILES</li>
</ul>
</div>
</div>
<div id="div_3" style="display:none">
<div id="sub-menu">
<ul class="menu">
<li>ABOUT</li>
<li>CONTACT</li>
</ul>
</div>
</div>';
if ($sub == 'about')
echo '
<div id="div_1"></div>
<div id="div_2" style="display:none">
<div id="sub-menu">
<ul class="menu">
<li>VIDEOS</li>
<li>PHOTOS</li>
<li>UPLOAD</li>
<li>FILES</li>
</ul>
</div>
</div>
<div id="div_3">
<div id="sub-menu">
<ul class="menu">
<li>ABOUT</li>
<li>CONTACT</li>
</ul>
</div>
</div>';
?>
<?php
if ($bar == 'about')
echo '
<li>ABOUT</li>
<li>CONTACT</li>';
if ($bar == 'gallery')
echo '
<li>VIDEOS</li>
<li>PHOTOS</li>
<li>UPLOAD</li>
<li>FILES</li>';
?>
You're repeating id="sub-menu" in your HTML.
ID is supposed to be unique to ONE element.
CLASS can be repeated/reused on multiple elements.
Looking at your JS file...you're attempting to engage at least 2 or 3 elements simultaneously by using getElementById(elemId) - I've not tried running your code, but I'm betting it throws an error.
In your HTML - set a unique ID to one of your sub menus (id="sub_menu_1"). Then use that same ID in your JS getElementById('sub_menu_1'), and see if your situation improves.
you have to change this line like this
<a id="a_title_3" onclick="SetCurrent(3);return false;"><span>INFO</span></a>
there are two "a_title_2" id named objects.
<a id="a_title_2" onclick="SetCurrent(2);return false;" href="#" class=""><span>GALLERY</span></a>
<a id="a_title_2" onclick="SetCurrent(3);return false;" class="current"><span>INFO</span></a>
it will work fine when you change it to '3'.
Related
i try apply theme gentelella with my project using framework yii 1.1. Here i use extension Yii 1.1 that is CMenu, when I want to match the original code template i have a problem with my project in side-bar ( my menu ), which should (template menu)
for my code:
code
!-- sidebar menu -->
<div id="sidebar-menu", class="main_menu_side hidden-print main_menu">
<div class="menu_section">
<?php
if(!Yii::app()->user->isGuest)
{
$this->widget('zii.widgets.CMenu',array(
'htmlOptions'=>array('class'=>'nav side-menu'),
'submenuHtmlOptions'=>array('class'=>'nav child_menu'),
'encodeLabel'=>false,
'items'=>Yii::app()->user->getState('menu'),
));
}
else
echo '<div id=\'footer\'></div>';
?>
</div>
</div>
<!-- /sidebar menu -->
for the template code: code template
<!-- sidebar menu -->
<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
<div class="menu_section">
<h3>General</h3>
<ul class="nav side-menu">
<li><a><i class="fa fa-home"></i> Home <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li>Dashboard</li>
<li>Dashboard2</li>
<li>Dashboard3</li>
</ul>
</li>
</ul>
</div>
<!-- <div class="menu_section"> -->
<ul class="nav side-menu">
<li><a><i class="fa fa-bug"></i> Additional Pages <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li>E-commerce</li>
<li>Projects</li>
<li>Project Detail</li>
<li>Contacts</li>
<li>Profile</li>
</ul>
</li>
</div>
</div>
<!-- /sidebar menu -->
i have try to insert <ul class="nav child_menu"> under <div class="menu_section"> but what happens is that the menu does not appear :(
please help,
thanks
Initially I had a bootstrap navbar, and I hard coded the navbar code into every one of my html files. I set the active class of the tab of whatever page the user was currently viewing manually like this:
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>About</li>
<li>View Map</li>
<li>Submit Document<li>
<li>Contact</li>
</ul>
This worked fine, but I realized it was bad practice to repeat code like this, so I put the navbar code into a separate file, turned all my html files into php files, and used the php include statement to load the navbar in each page. I then used JavaScript in an attempt to dynamically set the active class. However, I can't get the active class to show at all when clicking on my tabs.
<head>
<link href="../css/navbar.css" type="text/css" rel="stylesheet" />
</head>
<!-- JAVASCRIPT TO TOGGLE ACTIVE CLASS-->
<script type="text/javascript">
$(".nav a").on("click", function(){
$(".nav").find(".active").removeClass("active");
$(this).parent().addClass("active");
});
</script>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <!-- Mobile collapse-->
<span class="icon icon-bar"></span>
<span class="icon icon-bar"></span>
<span class="icon icon-bar"></span>
</button>
<a class="navbar-brand" href="homepage.html">
<img src="../images/pksoilogo.png" id="logo">
</a>
</div>
<div class="collapse navbar-collapse"> <!-- Mobile collapse/Dropdown-->
<ul class="nav navbar-nav">
<li>Home</li>
<li>About</li>
<li>View Map</li>
<li>Submit Document<li>
<li>Contact</li>
</ul>
</div>
</div>
</nav>
Any thoughts on how to correct the JavaScript to fix this?
EDIT - Sorry, I hadn't read the part about you wanting a Javascript fix. Hopefully someone can give a JS solution to your problem soon enough!
Here's one way to go about it.
<ul class="nav navbar-nav">
<li <?php if (basename($_SERVER['PHP_SELF']) == 'homepage.php') echo 'class="active"' ?>>Home</li>
<li <?php if (basename($_SERVER['PHP_SELF']) == 'about.php') echo 'class="active"' ?>>About</li>
<li <?php if (basename($_SERVER['PHP_SELF']) == 'map.php') echo 'class="active"' ?>>View Map</li>
<li <?php if (basename($_SERVER['PHP_SELF']) == 'index.php') echo 'class="active"' ?>>Submit Document</li>
<li <?php if (basename($_SERVER['PHP_SELF']) == 'contact.php') echo 'class="active"' ?>>Contact</li>
</ul>
Obviously that's not the cleanest of ways, but it's quite easy. You could also make a function that you could call to make it look a bit better.
I'm working on http://pizzli.com/ephraimwp/inner-page-1/. I'm trying to get the content of #innernav (which contains the ul) to float to the left edge of the column it is in, so that it is even with #bannerbar. Please see my code below.
<div id="bannerbar"><?php the_title();?></div>
<div class="row" style="padding-top:35px;">
<div class="col-md-4">
<div id="innernav">
<ul>
<li>Our Purpose</li>
<li>Why Choose PSP</li>
<li>Our Process</li>
<li>Our History</li>
<li>Blog</li>
<li>Glossary</li>
<li>Contact</li>
</ul>
</div>
</div>
<div class="col-md-8">
<h2 style="font-size:20px;color:#2c4276;"><?php the_title();?></h2>
<div style="color:#a2a2a2;font-size:18px;">
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
the_content();
} // end while
} // end if
?>
</div>
</div>
</div>
You need to remove some padding from elements surrounding the menu.
I recommend wrapping this section with a class of left-container (or something similar), and also adding a class to the innernav. Classes are better than IDs for styling.
<div class="left-container">
<div class="col-md-4">
<div id="innernav" class="innernav">
<ul>
<li>Our Purpose</li>
<li>Why Choose PSP</li>
<li>Our Process</li>
<li>Our History</li>
<li>Blog</li>
<li>Glossary</li>
<li>Contact</li>
</ul>
</div>
</div>
</div>
Then, you can remove the padding with CSS, and your menu will be aligned.
.left-container > .col-md-4,
.left-container .innernav ul {
padding-left:0;
}
You can achieve in many ways first in your custom css .no-gutter{padding:0!important; margin:0!important;} add these lines
then in your html <div class="col-md-4 no-gutter">.
Now you can use no-gutter where ever you dont need padding from bootstrap.
for ul #innernav ul{padding-left:0px;}
you have padding that you have to get rid of on the col-md-4 and the <ul> :
<div class="col-md-4" style="padding-left: 0px;"> // here padding taken out
<div id="innernav">
<ul style="padding-left: 0px;"> // here padding taken out
<li>Our Purpose</li>
<li>Why Choose PSP</li>
<li>Our Process</li>
<li>Our History</li>
<li>Blog</li>
<li>Glossary</li>
<li>Contact</li>
</ul>
</div>
</div>
i'm new in wordpress and i'd like to replace the footer with a pure html code.
i mean, i till want the "container" generated by wp, but inside i want to use pure html code.
i tried changing the content of "partials/footer-layout.php" to this code, and i'm able to see the code, but not to click the links...
any ideas?
<?php
/**
* #package Make
*/
// Footer Options
$footer_layout = (int) get_theme_mod( 'footer-layout', ttfmake_get_default( 'footer-layout' ) );
?>
<footer id="site-footer" class="site-footer footer-layout-<?php echo esc_attr( $footer_layout ); ?>" role="contentinfo">
<div class="footer-text">
<!-- CUSTOM FOOTER CODE STARTS HERE -->
<div class="footer-custom-container">
<div class="footer-column-one">
<h6>Title</h6>
<ul>
About us
<li>Contact us</li>
<li> </li>
<li>Careers</li>
</ul>
</div>
<div class="footer-column-two">
<h6>first column</h6>
<ul>
<li>Support</li>
<li>FAQ</li>
<li>User guides</li>
<li>Download app</li>
</ul></div>
<div class="footer-column-three">
<h6>Social & media</h6>
<ul>
<li>Facebook</li>
<li>Twitter</li>
<li> </li>
<li>Press</li>
</ul></div>
<div class="footer-column-four">
<h6> </h6>
<ul>
<li> </li>
</ul></div>
<div class="footer-column-five">
<h6>Title</h6>
<ul>
<li>For business</li>
<li>For installers</li>
<li>Terms & conditions</li>
<li>Privacy policy</li>
</ul></div>
<div class="footer-column-six">
<h6>first column</h6>
<ul>
<li>Store</li>
<li>Login</li>
</ul></div>
</div>
<!-- CUSTOM FOOTER CODE ENDS HERE -->
</div>
</footer>
Your HTML code isn't XHTML-compliant. There's a missing <li>...</li>.
Some possible solutions:
1- try to add links to the anchor tags and check if it works.
2- check if there's a HTML element which overlaps the anchor tags. Use firebug or any other developer tool to check if there's an overlapping element.
3- check if there's a Javascript event which is called once you click on the anchor. Use a Javascript debugger (Firebug etc.).
Here's the updated code:
<?php
/**
* #package Make
*/
// Footer Options
$footer_layout = (int) get_theme_mod( 'footer-layout', ttfmake_get_default( 'footer-layout' ) );
?>
<footer id="site-footer" class="site-footer footer-layout-<?php echo esc_attr( $footer_layout ); ?>" role="contentinfo">
<div class="footer-text">
<!-- CUSTOM FOOTER CODE STARTS HERE -->
<div class="footer-custom-container">
<div class="footer-column-one">
<h6>Title</h6>
<ul>
<li>About us</li>
<li>Contact us</li>
<li> </li>
<li>Careers</li>
</ul>
</div>
<div class="footer-column-two">
<h6>first column</h6>
<ul>
<li>Support</li>
<li>FAQ</li>
<li>User guides</li>
<li>Download app</li>
</ul>
</div>
<div class="footer-column-three">
<h6>Social & media</h6>
<ul>
<li>Facebook</li>
<li>Twitter</li>
<li> </li>
<li>Press</li>
</ul>
</div>
<div class="footer-column-four">
<h6> </h6>
<ul>
<li> </li>
</ul>
</div>
<div class="footer-column-five">
<h6>Title</h6>
<ul>
<li>For business</li>
<li>For installers</li>
<li>Terms & conditions</li>
<li>Privacy policy</li>
</ul>
</div>
<div class="footer-column-six">
<h6>first column</h6>
<ul>
<li>Store</li>
<li>Login</li>
</ul>
</div>
</div>
<!-- CUSTOM FOOTER CODE ENDS HERE -->
</div>
</footer>
Often when you can't click a link, it is a case that a layer is positioned on top of it.
Use a code inspector such as Firebug, and see if there are any 'invisible layers' above that area.
There is also the chance that css has cursor:none applied so it doesn't look like you can click it, but it can. Try replacing your # links with real links.
Also, About us needs li tags around it, but I doubt that is the issue.
I posted this question on the wordpress forum but got no hits. Perhaps one of you might be able to point me in the right direction.
I am putting together a wp theme for a site I am working on. I want to get the layout to match the rest of the site as closely as possible and am running into trouble using the wp_list_pages/categories/bookmarks/etc() methods. I read through the documentation, but really don't see how to translate that into something that will work for me.
Calling the function with no args I get:
<li class="pagenav">Pages
<ul>
<li class="page_item page-item-2">About</li>
<li class="page_item page-item-5">Parent 1
<ul>
<li class="page_item page-item-10">Child 1
<ul>
<li class="page_item page-item-26">Grandchild 1</li>
</ul>
</li>
<li class="page_item page-item-16">Child 2</li>
</ul>
</li>
<li class="page_item page-item-7">Parent 2
<ul>
<li class="page_item page-item-22">Child 3</li>
<li class="page_item page-item-24">Child 4</li>
</ul>
</li>
<li class="page_item page-item-14">Parent 3
<ul>
<li class="page_item page-item-18">Child 5</li>
<li class="page_item page-item-20">Child 6</li>
</ul>
</li>
</ul>
</li>
Whereas I would like something more like:
<div class="nav-link">Pages
<div id="Pages_children">
<div class="nav-link">About</div>
<div class="nav-link">Parent 1
<div id="Parent 1_children">
<div class="nav-link">Child 1
<div id="Child 1_children">
<div class="nav-link">Grandchild 1</div>
</div>
</div>
<div class="nav-link">Child 2</div>
</div>
</div>
<div class="nav-link">Parent 2
<div id="Parent 2_children">
<div class="nav-link">Child 3</div>
<div class="nav-link">Child 4</div>
</div>
</div>
<div class="nav-link">Parent 3
<div id="Parent 3_children">
<div class="nav-link">Child 5</div>
<div class="nav-link">Child 6</div>
</div>
</div>
</div>
</div>
Is there a way for me to accomplish that with the args system? If not, is it possible for me to request an array from wp_list_TYPE() with the links and titles?
Is there a better way entirely to go about doing something like this?
Try looking at get_posts, which returns an array instead. Then you can loop through the array and print whatever you want from it.
For example:
<?php $posts = get_posts("numberposts=5&order=DESC&orderby=date"); ?>
<h5>Latest posts</h5>
<?php foreach($posts as $post): ?>
<?php setup_postdata($post); ?>
<div class="content">
<a class="title" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<span style="float:right" class="date"><?php the_time(__('F jS, Y', 'inove')); ?></span>
</div>
<?php endforeach; ?>