Menu to P2 theme
-
Hi, I really love this theme and is using this for my church and community web sites.
My only complain is missing “menu” feature.
I modified theme like https://mgmkorean.org by adding stylesheet based drop-down menu.
But, I’d like theme owner to integrate this.Thank you.
-
Did you add the menu as a child theme? If so, any chance you’d share the child theme? I’d love to add a menu to one of my P2 based sites.
I did add menu by adding below code to header.php
<?php $locations = get_nav_menu_locations(); if ($locations[ 'primary-menu' ]) { wp_nav_menu( array( 'container' => 'div', 'container_id' => 'madmenu', 'theme_location' => 'primary-menu' ) ); } else { ?> <ul class='simplemenu'> <?php echo wp_list_pages('exclude=;&depth=1&sort_column=menu_order&title_li=' . ('') . '' ); ?> </ul> <?php } ?>
And add below codes to functions.php
add_action( 'init', 'register_my_menu' ); function register_my_menu() { register_nav_menu( 'primary-menu', __( 'Primary Menu' ) ); } add_theme_support( 'menus' );
Here is css for drop down menu.
WP 3.0 has bug on current selected menu item.
You should have full URL with “/” ending, then current selected menu item will work fine.#madmenu{float:left;padding:0;margin-top:5px;clear:both;width:100%;font-weight:bold;font-size:11px;text-transform:uppercase;background:#909090;} #madmenu a,#madmenu a:visited,#madmenu a:link{padding:7px 14px;margin:0;display:block;color:#ffffff;text-decoration:none;} #madmenu a:hover,#madmenu a:active{background:#5b5b5b;color:#fff;} #madmenu li{float:left;margin:0;padding:0;border-right:1px solid #303030;BACKGROUND:#909090;} #madmenu li a,#madmenu li a:visited{margin:0;padding:7px 14px;display:block;color:#eeeeee;} #madmenu li li{float:none;margin:0;padding:0;border-right:0px solid #303030;} #madmenu li li a,#madmenu li li a:link,#madmenu li li a:visited{padding:5px 14px;float:none;margin:0;color:#fff;background:#5b5b5b url(images/dots_nav.gif) repeat-x top;} #madmenu li li a:hover,#madmenu li li a:active{background:#909090;color:#fff;} #madmenu li li li a{padding:5px 14px;background:#909090;} #madmenu li li li a:hover{color:#fff;} #madmenu li li li a:active{color:#fff;background:#909090;} #madmenu li ul{width:154px;padding:0;display:none;text-transform:none;position:absolute;left:-999em;} #madmenu li ul ul{margin:-22px 0 0 154px;} #madmenu li:hover{background:#5b5b5b;} #madmenu li:hover ul ul,#madmenu li:hover ul ul ul,#madmenu li.sfhover ul ul,#madmenu li.sfhover ul ul ul{left:-999em;} #madmenu li:hover ul,#madmenu li li:hover ul,#madmenu li li li:hover ul,#madmenu li.sfhover ul,#madmenu li li.sfhover ul,#madmenu li li li.sfhover ul{display:block;left:auto;} #madmenu ul{float:left;padding:0;margin:0;list-style-type:none;} #madmenu li.current-menu-item a { background: #fff; /*url(images/primary-menu-active.png) repeat-x 0 0; */ border-top: 1px solid #5b5b5b; color:#000; border-bottom: 2px solid #fff; }
Thank you. That’s very kind of you to share. Maybe Automattic will be able to just implement your code in their upcoming update of P2.
As discussed before there’s no plan to add menus to P2. The design of the theme is such that menus are meant to be placed in the sidebar. You can add a custom menu widget or pages widget to the sidebar to achieve this.
Can you tell me how did you all the flash party at the top fo the post?
why I can`t got it ?
https://test.freezhao.comThank you very much! That took 2 seconds to integrate. Awesome.
As for the lack of nav menus in the first place, not everyone wants to spit into the wind that is standardization. I wanted to integrate P2 into my pre-existing theme (I have a multi-site installation) and got everything modified except for the nav menu.
I guess if you’re doing heavy theme customization, you should be able to add in the right code for page navigation. I hack things to pieces and make it work, but I’ve never actually written my own php code.
Why not make it a checkbox option or something? The theme options seem very minimal… it’s a very powerful tool, but it could really have some more theme options.
Ultimately, I used the “Page Links To” plugin to create navbar pages as if the P2 installation was actually a page of my main site. Worked wonderfully… especially if you want to add P2 capabilities to an existing site.
See thecarrfamily.org/chat for the modified version of P2. Then “Page Links To” redirects all of the P2 navbar items to the main site’s individual pages.
You’d need a multi-site installation and a pretty heft amount of hacking know-how but the end solution worked out perfectly. I’ll be doing this for all of my P2 installations from now on. Thanks again, choibc!!
Choi BC…..I tried, but the menu is all messed up. I’m sorry I’m not quite a code person. How did you also archive the custom footer? And the flash header? Please I really need this. Do you do custom job? I hope you respond. Here is my site wwww.newspectator.com
Hi, GodspowerOboido
Your site looks nice.
I moved to different theme for mgmkorean.org
Instead, https://montgomerykmc.org still has P2 modified theme.
Header in mgmkorean.org is not flash, it is based on jQuery+CSS.
Below php are added to main index page.<!-- slideshow --> <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/includes/slideshow.css" type="text/css" media="screen" /> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/includes/jquery.cycle.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/includes/slideshow.js"></script> <div id="home-top" class="clearfix"> <div id="slideshow" class="clearfix"> <div class="slides"> <?php query_posts("showposts=5&category_name=Headline"); ?> <ul class="clearfix"> <?php $i = 0; while (have_posts()) : the_post(); $i++;?> <li id="main-post-<?php echo $i;?>" onclick="location.href='<?php the_permalink()?>';" style="cursor: pointer; background:url(<?php echo get_the_thumb(540, 250);?>) top left no-repeat;"> <div class="entry"> <h2><a href="<?php the_permalink()?>" rel="bookmark" class="title"><?php the_title();?></a></h2> </div> </li> <?php endwhile;?> </ul> </div> <!--slide--> <?php rewind_posts(); ?> <ul class="slides-nav"> <?php $i = 0; while (have_posts()) : the_post(); $i++;?> <li class="<?php if ($i == 1) echo "on"; ?> clearfix" id="post-<?php echo $i;?>"> <a href="#main-post-<?php echo $i;?>" title="<?php the_title();?>"> <?php echo the_thumb("post_thumbnail thumbnail thumbnail post_thumbnail", 150, 150);?><?php the_title();?><br /> <?php the_time('j M Y')?> | <?php if (function_exists('the_views')) { the_views();}?> </a> </li> <?php endwhile;?> </ul> </div> </div>
Thanks ChoiBc for the comment about my site. Thanks for the code too, unfortunately, it didn’t get to work on my site. When I used it, and checked my site, I found no updates yet on the homepage. I still love the menu on your https://montgomerykmc.org site. I want it. I had tried your code in the previous comments in this thread, but didn’t get it to work well….Many regards
Hi, GodspowerOboido.
I attach file for you.
Please use carefully since I made this long time ago…Thanks ChoiBC {andy} It had a fatal error in the header and site was dead….so i had to revert back to my original p2 theme. I appreciate your generosity, thanks again. Let me not disturb you further more
Thanks, choibc!
Choibc and GodspoerOboido,
Very nice work! i wish i knew what i am doing with P2 theme. Is it possible you guys can post a video tutorial? i would really appreciated. I love both of your website.
thank you kindly,
Hai
- The topic ‘Menu to P2 theme’ is closed to new replies.