Home Forums Porto Template I have some trouble with " index-corporate-law-office.html"

Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #10012394
    myyami
    Participant

    Hi,

    When i put the menu, if i left by example item “HOME” without sub-menu. the item “HOME” align to the top. I don’t know what solve this problem.

    In the template you make every item in the menu with submenu.


    #10012395
    Support
    Keymaster

    Hello, sorry about that bug, to fix that please add this:

    (css/custom.css)

    @media (min-width: 992px) 
    	#header .header-nav-bar .header-nav-main {
    		margin: 0;
    	}
    	#header .header-nav-bar .header-nav-main nav > ul > li {
    		margin-left: 0;
    	}
    	#header .header-nav-bar .header-nav-main nav > ul > li > a {
    		padding: 20px 21px;
    		font-size: 14px;
    		border-right: 1px solid rgba(0, 0, 0, 0.1);
    	}
    	#header .header-nav-bar .header-nav-main nav > ul > li > a.dropdown-toggle {
    		padding: 20px 37px 20px 21px;
    	}
    	#header .header-nav-bar .header-nav-main nav > ul > li > a.dropdown-toggle:after {
    		top: 18px;
    		right: 21px;
    	}
    	#header .header-nav-bar .header-nav-main nav > ul > li.dropdown .dropdown-menu {
    		margin-top: 0;
    	}
    	#header .header-nav-bar .header-nav-main nav > ul > li:last-child > a {
    		border-right: 0;
    	}
    }

    Please try that and let me know if you need further assistance.

    Kind Regards, Jonas


    #10012396
    myyami
    Participant
    This reply has been marked as private.
    #10012398
    Support
    Keymaster

    Hello, I just tested that code I sent you in the latest version and this was the result:

    Can you please clear the cache and try again? If the problem persists, please send me your URL so I can check.

    Kind Regards,

    Jonas


    #10012407
    myyami
    Participant
    This reply has been marked as private.
    #10012412
    Support
    Keymaster
    This reply has been marked as private.
    #10012414
    myyami
    Participant
    This reply has been marked as private.
    #10030457
    myyami
    Participant
    This reply has been marked as private.
    #10030468
    Support2
    Keymaster

    Hello,

    In that case you should print the active class on the <a>.

    Extending the Walker_Nav_Menu class you should use the method below to change the output of <a>:

    public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {

    Inside the start_el() you can have this code to change the output of <a>. Then you can create a custom code to check in what page you are (with PHP/WP conditions) and add the active class.

    /**
     * Filters a menu item's title.
     *
     * @since 4.4.0
     *
     * @param string   $title The menu item's title.
     * @param WP_Post  $item  The current menu item.
     * @param stdClass $args  An object of wp_nav_menu() arguments.
     * @param int      $depth Depth of menu item. Used for padding.
     */
    $title = apply_filters( 'nav_menu_item_title', $title, $item, $args, $depth );
    
    $item_output  = $args->before;
    $item_output .= '<a' . $attributes . '>';
    $item_output .= $args->link_before . $title . $args->link_after;
    $item_output .= '</a>';
    $item_output .= $args->after;

    Take a look on the Walker_Nav_Menu class: https://developer.wordpress.org/reference/classes/walker_nav_menu/

    We hope this helps.

    Kind Regards,

    Rodrigo.


    #10030472
    myyami
    Participant
    This reply has been marked as private.
    #10030475
    Support2
    Keymaster

    Hello,

    Please try with this code for the walker:
    https://pastebin.com/raw/x71C4gWr

    We hope this helps.

    Kind Regards,

    Rodrigo.


    #10030478
    myyami
    Participant
    This reply has been marked as private.
    #10030480
    myyami
    Participant
    This reply has been marked as private.
    #10030486
    Support2
    Keymaster

    Hello,

    You can identify the top parent menu items with the $depth variable.

    $depth == 0 is the identifier for top parent menu items, so you can use some PHP conditions to check when you are in those items and then print what you need.

    We hope this helps.

    Kind Regards,

    Rodrigo.


    #10030492
    myyami
    Participant
    This reply has been marked as private.
    #10030494
    Support2
    Keymaster

    Hello,

    Probably this code should works to not show the “dropdown-toggle” in top level menus:

    $dropdown_toggle_class = '';
    		if( $args->has_children && $depth != 0 ) {
    			$dropdown_toggle_class = 'dropdown-toggle';
    		}
    
    		if( $this->flag == true ) {
    			$attributes .= ($args->has_children) 	    ? ' class="dropdown-item '. $dropdown_toggle_class .' active"' : ' ';
    
    			$this->flag = false;
    		} else {
    			// I use classe dropdown-toggle to show the caret when the item has a children
    			$attributes .= ($args->has_children) 	    ? ' class="dropdown-item '. $dropdown_toggle_class .'"' : ' class="dropdown-item "';
    
    			$this->flag = false;
    		}

    Hope this helps.

    Kind Regards,

    Rodrigo.


    #10030495
    Support2
    Keymaster

    Hello,

    If you need further assistance please renew you support license.

    Also note that here is the HTML version of Porto.
    We repplied before some tips for you related to the Nav_Walker class of WP since I have some experience with it. So if you need assistance with any other type of issue related to WordPress we couldn’t help you. So please consider this before renew your support license.

    We hope you understand it.

    Kind Regards,

    Rodrigo.


    #10030497
    myyami
    Participant
    This reply has been marked as private.
Viewing 18 posts - 1 through 18 (of 18 total)