Tagged: x
-
AuthorPosts
-
August 3, 2016 at 10:52 am #1115572
hello
i was searching for a way to add a classic menu to topbar.
A menu that i can create from Appearance > Menui found this forum post but after trying it, it was not working, and as i see it was s bit old (from 2014), i would like to ask if you have a cleaner new way of doing this?
i have my child theme ready to roll!!
Thanks for all!
August 3, 2016 at 11:18 am #1115616Hey There,
Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:
– WordPress Admin username / password
Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.
Thanks.
August 3, 2016 at 12:43 pm #1115762here is the topic i was talking about
August 3, 2016 at 1:18 pm #1115818Hey There,
In the latest version of the X theme you can find the _topbar.php file in x/framework/views/global/ directory. You can get it from there. Give it a try and let us know how it goes.
August 3, 2016 at 6:59 pm #1116249Hello,
I tried but did not workedAugust 3, 2016 at 11:48 pm #1116716Hi There,
On your child theme navigate to this directory: \x-child\framework\views\global\ from there create a file named _topbar.php and paste the code below on it.
<?php // ============================================================================= // VIEWS/GLOBAL/_TOPBAR.PHP // ----------------------------------------------------------------------------- // Includes topbar output. // ============================================================================= ?> <?php if ( x_get_option( 'x_topbar_display' ) == '1' ) : ?> <div class="x-topbar"> <div class="x-topbar-inner x-container max width"> <?php if ( x_get_option( 'x_topbar_content' ) != '' ) : ?> <p class="p-info"><?php echo x_get_option( 'x_topbar_content' ); ?></p> <?php wp_nav_menu( array( 'theme_location' => 'topbar-menu' ) ); ?> <?php endif; ?> <?php x_social_global(); ?> </div> </div> <?php endif; ?>
Then add this code on your child theme’s functions.php file.
/*REGISTER A NEW MENU*/ function register_my_menu() { register_nav_menu('topbar-menu',__( 'Topbar Menu' )); } add_action( 'init', 'register_my_menu' );
After doing this you should get a new location for menu under Appearance > Menus > Manage Locations.
Then style the menu with this Custom CSS on your Customizer.
.x-topbar .menu li { display: inline-block; padding: 15px; }
Further customizations from here would be getting into custom development, which is outside the scope of support we can offer. If you need more in depth changes, you may wish to consult with a developer. X is quite extensible with child themes, so there are plenty of possibilities.
Hope it helps, Cheers!
August 4, 2016 at 5:32 am #1117086hello
I have followed all steps but still not able to see a new location for menu under Appearance > Menus > Manage Locations.August 4, 2016 at 6:58 am #1117150can you help solve this?
August 4, 2016 at 8:09 am #1117210Hi There,
Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / password
– FTP credentialsDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
August 4, 2016 at 8:54 am #1117290Oh Sorry!!
Sorry! Your code IS working!!
there was an error on my side: i didn’t activated the child theme… the main theme was still running
so it is ok!!! Thnaks a lot
by the way, any css hints or style copy you have at hand that will give a real menu feelling to that new menu? or to apply the same current x theme menu styling to it?
August 4, 2016 at 9:20 am #1117320I was thinking about a simpler way to do this.
Instead of adding a menu to the topbar, can i add php code into topbar content?? i mean is there a way to enable topbar content from customizer to accept php code??
or if no way, where can i add my php code that will be rendered in topbar?in fact i just wan to display some links in topbar depending on user been logged in or logged out, like this:
Logged out visitors will see:
Welcome Visitor | Login | JoinLogged IN users will see:
Welcome Username | Logout | My AccountAugust 4, 2016 at 10:08 am #1117365i think i am in the way finding how to do it
First step; copied _topbar from \x\framework\views\global\ to \x-child\framework\views\global\then find the code
<?php echo x_get_option( 'x_topbar_content' ); ?>
and replace it with<?php if ( is_user_logged_in() ) { ?> <a href="<?php echo wp_logout_url( get_permalink() ); ?>">Logout</a> | <a class"#" href="#">another link if you need</a> <?php } else { ?> <a class="loginmodal" href="#">Log In</a> <?php };
August 4, 2016 at 10:10 am #1117367in my case i am calling a convertplug modal that contains itself an ultimate member shortocde
still working on it… wil update as soon i got some cool result
August 4, 2016 at 11:38 am #1117482That’s great!
Thanks for your support and research. Appreciated!
If you have anything else, let us know. We’d be happy to assist you with everything.
August 5, 2016 at 2:18 pm #1119269Hello all,
I finally got it working as i wanted. Here are all the steps.
Set up your child theme before:From front End
1- Goto Customizer > Header > enable Topbar
2- enter some dummy text in Topbar ContentBackend dirty job..do it carefully
3- copy the _topbar.php file from \x\framework\views\global\ to \x-child\framework\views\global\
4- Open this file from your cpanel editor…Or any other mean you want wordpress theme editor could also handle this.
5- in this _topbar.php file, search for:<?php echo x_get_option( 'x_topbar_content' ); ?>
and replace it withif ( is_user_logged_in() ) { ?> Welcome <?php $current_user = wp_get_current_user(); echo $current_user->display_name; ?>, | <a href="<?php echo wp_logout_url( get_permalink() ); ?>">Logout</a> | <a href="http://www.yoursite.com/my-account">My Account</a> <?php } else { ?> Welcome Visitor<a href="<?php echo wp_login_url(get_permalink()); ?>">Login or Join</a> <?php }; ?>
Take care to replace http://www.yoursite.com/my-account with your custom url
-
AuthorPosts