WordPress.org

Ready to get started?Download WordPress

Forums

Custom admin bar (21 posts)

  1. flojack
    Member
    Posted 8 months ago #

    Hi,

    I'm trying to custom admin bar. Everything's ok and well explained on different sources, but I still have two problems :
    - I really want to have a central search bar with a text in as "search for member, an event, an article" which should be the main research in my website, and not a little icon on the right
    - I can't delete the theme's link (magazine basic) in the admin bar (I want to let it in the footer with a thanks to….)

    Does anybody have a solution for one of these issues ?

    Thanks a lot,

  2. CKemp
    Member
    Posted 8 months ago #

    Adding custom text to search forms is easy enough, as is removing a search bar from your header, and removing a link.

    But I can't really help without seeing your theme files. Can you post them in pastebin or something?

  3. flojack
    Member
    Posted 8 months ago #

    // admin bar
    
    function wps_admin_bar() {
    
    global $wp_admin_bar;
    
    $wp_admin_bar->remove_menu('wp-logo'); // Cette ligne désactive le logo WP et le menu associé
    
    $wp_admin_bar->remove_menu('about'); // Cette ligne désactive le menu d'acces " A propos de WordPress "
    
    $wp_admin_bar->remove_menu('wporg'); // Cette ligne désactive le menu d'acces a WordPress.org
    
    $wp_admin_bar->remove_menu('documentation'); // Cette ligne désactive le menu d'acces a la documentation de WordPress
    
    $wp_admin_bar->remove_menu('support-forums'); // Cette ligne désactive le menu d'acces au forum de WordPress
    
    $wp_admin_bar->remove_menu('feedback'); // Cette ligne désactive le menu d'acces au Remarque
    
    $wp_admin_bar->remove_menu('view-site'); // Cette ligne désactive le lien vers le tableau de bord de WordPress
    
    $wp_admin_bar->remove_menu('dashboard'); // Cette ligne désactive le lien associé au nom du blog vers le tableau de bord de WordPress
    
    $wp_admin_bar->remove_menu('themes'); // Cette ligne désactive le lien vers les options du thème.
    
    $wp_admin_bar->remove_menu('widgets'); // Cette ligne désactive le lien vers les options des widgets
    
    $wp_admin_bar->remove_menu('menus'); // Cette ligne désactive le lien vers l'option menus
    
    $wp_admin_bar->remove_menu('menus'); // Cette ligne désactive le lien vers l'option menus
    
    $wp_admin_bar->remove_menu('updates'); // Cette ligne désactive l'icon des mise à jours
    
    $wp_admin_bar->remove_menu('comments'); // Cette ligne désactive l'icon des commentaires
    
    }
    
    add_action( 'wp_before_admin_bar_render', 'wps_admin_bar' );
    
    ?>
  4. flojack
    Member
    Posted 8 months ago #

    Thanks for your fast answer. My first message has failed. you can see in the code the admin bar part of my child theme functions.php. is this what you wanted ?

    Thanks,

  5. CKemp
    Member
    Posted 8 months ago #

    Is there no markup in your header.php for the menu?

    I can't really even try to help without seeing everything. All I can figure to do from those functions is to remove the admin bar all together or add a filter or something.

    Can you link me to the exact theme you are using?

    Is it this one?

  6. flojack
    Member
    Posted 8 months ago #

    Yes it is magazine basic, free version. I can paste you what you need, tell me ?

    if I paste everything, should be quite long…

    Thanks

  7. flojack
    Member
    Posted 8 months ago #

    Here is the header.php :

    <?php
    /**
     * The Header for our theme.
     *
     * Displays all of the <head> section and everything up till <div id="main">
     * and the left sidebar conditional
     *
     * @since 3.0.0
     */
    ?><!DOCTYPE html>
    <!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" <?php language_attributes(); ?>><![endif]-->
    <!--[if IE 7]><html class="no-js lt-ie9 lt-ie8" <?php language_attributes(); ?>><![endif]-->
    <!--[if IE 8]><html class="no-js lt-ie9" <?php language_attributes(); ?>><![endif]-->
    <!--[if gt IE 8]><!--><html class="no-js" <?php language_attributes(); ?>><!--<![endif]-->
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title><?php wp_title( '|', true, 'right' ); ?></title>
    <link rel="profile" href="http://gmpg.org/xfn/11" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    <?php wp_head(); ?>
    </head>
    
    <body <?php body_class(); ?>>
    	<div id="page" class="grid<?php echo ' ' . mb_theme_options( 'width' ); ?>">
    		<header id="header" class="row" role="banner">
    			<div class="c12">
    				<div id="mobile-menu">
    					<a href="#" class="left-menu"><i class="icon-reorder"></i></a>
    					<a href="#"><i class="icon-search"></i></a>
    				</div>
    				<div id="drop-down-search"><?php get_search_form(); ?></div>
    
    				<?php
    				$logo = mb_theme_options( 'logo' );
    				$text_color = get_header_textcolor();
    				$alignment = mb_theme_options( 'header_alignment' );
    				$header_class = ( $alignment ) ? $alignment : '';
    				$header_class2 = ( ! $logo && 'blank' == $text_color ) ? 'remove' : $header_class;
    				$class = ( $logo ) ? ' class="remove"' : '';
    				?>
    				<div class="title-logo-wrapper <?php echo $header_class2; ?>">
    					<?php
    					if ( $logo ) {
    						?>
    						<a href="<?php echo esc_url( home_url() ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" id="site-logo"  rel="home"><img src="<?php echo $logo; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" /></a>
    					<?php } ?>
    					<div class="header-group">
    						<h1 id="site-title"<?php echo $class; ?>><a href="<?php echo esc_url( home_url() ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    						<?php if ( mb_theme_options( 'tagline' ) ) { ?><h2 id="site-description"><?php bloginfo( 'description' ); ?></h2><?php } ?>
    					</div>
    				</div>
    
    				<?php
    				if ( is_active_sidebar( 'header-area' ) ) { ?>
    					<div id="header-widgets" class="<?php echo $header_class; ?>">
    						<?php dynamic_sidebar( 'header-area' ); ?>
    					</div>
    					<?php
    				}
    
    				$header_image = get_header_image();
    				if ( $header_image ) {
    					?>
    					<a href="<?php echo esc_url( home_url() ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img id="header-img" src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a>
    					<?php
    				}
    				?>
    
    				<nav id="site-navigation" role="navigation">
    					<h3 class="assistive-text"><?php _e( 'Main menu', 'magazine-basic' ); ?></h3>
    					<a class="assistive-text" href="#primary" title="<?php esc_attr_e( 'Skip to content', 'magazine-basic' ); ?>"><?php _e( 'Skip to content', 'magazine-basic' ); ?></a>
    					<?php echo str_replace( '</li>', '', wp_nav_menu( array( 'theme_location' => 'primary', 'echo' => false ) ) ); ?>
    				</nav><!-- #site-navigation -->
    
    				<nav id="site-sub-navigation" role="navigation">
    					<h3 class="assistive-text"><?php _e( 'Sub menu', 'magazine-basic' ); ?></h3>
    					<?php echo str_replace( '</li>', '', wp_nav_menu( array( 'theme_location' => 'secondary', 'menu_class' => 'secondary-menu', 'echo' => false, 'fallback_cb' => false ) ) ); ?>
    				</nav><!-- #site-sub-navigation -->
    			</div><!-- .c12 -->
    		</header><!-- #header.row -->
    
    		<div id="main" class="row">
    			<div id="left-nav"></div>
    			<?php
    			/* Do not display sidebars if full width option selected on single
    			   post/page templates */
    			if ( 5 == mb_theme_options( 'layout' ) )
    				get_sidebar();
  8. CKemp
    Member
    Posted 8 months ago #

    Ok and where do you want the search to appear? to the right of the site title? why don't you just insert a search form in a div, or insert a custom widget area?

  9. flojack
    Member
    Posted 8 months ago #

    Actually I want the search form in the admin bar, but not as a little icon on the right. I want a large search area on the center of admin bar

  10. CKemp
    Member
    Posted 8 months ago #

    I just installed the theme. It has a widgitized header.

    Insert this in a text widget and put it in that widget area.

    <form method="get" id="searchform" action="http://YOURSITE.com">
    <input type="text" name="s" id="searchbar" value="CUSTOM TEXT" onblur="if (this.value == '') {this.value = 'CUSTOM TEXT';}" onfocus="if (this.value == 'CUSTOM TEXT') {this.value = '';}" /><input type="submit" id="searchsubmit" value="Search" /></form>

    Exchange "CUSTOM TEXT" with what you want the search bar to say.

  11. CKemp
    Member
    Posted 8 months ago #

    oh in the admin bar...wait up a sec. I'll be back in a minute.

    I just installed it and I don't know what you mean by the icon on the right. I;m not seeing it.

  12. flojack
    Member
    Posted 8 months ago #

    It s just wordpress admin bar, you have in the front end part an icon (magnifying glass), little, on the right. When you click, it opens an area of search. I want it big, in the center, as this members will use it as the main search. The main advantage is that this admin bar is still there when you scroll ! better than a widgetized area.

    Sorry if I don t explain well but i m not really easy with english language

  13. CKemp
    Member
    Posted 8 months ago #

    Here is one solution.

    Post the following markup directly below :

    <nav id="site-navigation" role="navigation">

    <div style="float:right">
    <form method="get" id="searchform" action="http://YOURSITE.com">
    <input type="text" name="s" id="searchbar" value="CUSTOM TEXT" onblur="if (this.value == '') {this.value = 'CUSTOM TEXT';}" onfocus="if (this.value == 'CUSTOM TEXT') {this.value = '';}" /><input type="submit" id="searchsubmit" value="Search" /></form>
    </div>

    You can change the <div style> to a <div id> and style it properly that way.

  14. CKemp
    Member
    Posted 8 months ago #

    Oh and that thing on the right you are talking about is not viewable to people that aren't logged in. It's the WP Admin bar.

  15. flojack
    Member
    Posted 8 months ago #

    Ok thanks, looks great but where do I put this code ?

  16. flojack
    Member
    Posted 8 months ago #

    That s it ! I want to make it viewable for everybody, in the wp admin bar ! and big, and centered !

  17. flojack
    Member
    Posted 8 months ago #

    In my site, the admin bar is already viewable by logged out too.

  18. CKemp
    Member
    Posted 8 months ago #

    Just make your own top nav area that spans the page and give it the

    position:fixed;

    CSS attribute.

    And then you can make it widgitized or what ever you like.

    But if you haven't got time or don't want to learn about that stuff then look for a plugin that round about suits your needs.

    WP-TopBar or something.

  19. CKemp
    Member
    Posted 8 months ago #

    That's strange. I tested the theme and that wasn't the case for me.

    Anyway, look at the actual demo page for the theme.

    http://demos.bavotasan.com/magazine-basic/

    See the fixed top-bar? you can make something like that.

    It's not hard at all.

  20. flojack
    Member
    Posted 8 months ago #

    Oh thanks a lot that 's exactly what I want to do. I'll look after that, and will choose between plugin or code…

    Have a good day !

  21. flojack
    Member
    Posted 8 months ago #

    Hi,

    still have not fixed this issue.

    I ve tried those solutions but they aren't ok with my poor php level, my wishes or my theme. Plugins don't fit me too.

    The solution to have a search bar on admin bar would resolve my problem.

    does anybody know how to do ?

    thanks,

    flo

Reply

You must log in to post.

About this Topic