Quantcast
Channel: Question and Answer » menus
Viewing all 80 articles
Browse latest View live

Active menu item post detail

$
0
0

I’m trying to make the menu item active in WordPress when clicking on a a post item. The way im matching it is based on the browser url and the url of the menu item. However it is making all my menu items active. Instead of only the one that should be highlighted. See below my code, i hope someone can point out what i need to do to make only the menu item active that passes this if statement:

if($menu_item_name[3] == $segment) {
        array_push($classes, 'current-menu-item');
}

Here is the full code:

# Custom menu active
function current_type_nav_class($classes){

    $url =  "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
    $escaped_url = htmlspecialchars( $url, ENT_QUOTES, 'UTF-8' );

    # Split the URL in parts
    $parts = explode("/", $escaped_url);

    if (count($parts) > 2) {
        $segment = $parts[3];
    } else {
        return false;
    }

    $menu = wp_get_nav_menu_object('main-menu');
    $menu_items = wp_get_nav_menu_items($menu->term_id);

    foreach($menu_items as $menu_item) {
        $menu_item_name = explode("/", $menu_item->url);
        if($menu_item_name[3] == $segment) {
            array_push($classes, 'current-menu-item');
        }
    }
    return $classes;

} add_filter('nav_menu_css_class' , 'current_type_nav_class' , 10 , 2);

Issues adding icon(s) to menu items

$
0
0

I am trying to add icons as additional items in the menu.

So for example, it should look output as follows:
Home | About | Blog | Contact | ICON | ICON | ICON

I installed the Menu Icons plugin which allows me to add any icon from several icon libraries such as Font Awesome directly in the Appearance > Menu panel.

Unfortunately, it’s not working and I suspect it’s because of the theme I’m using. The plugin developer suggests that:

“Make sure that your active theme is using the default walker for displaying the nav menu. If it’s using its own custom walker, make sure that the menu item titles are filterable.”

Where and how can I make these changes?

The theme developer hasn’t been responding to any threads on their forum, any help would be greatly appreciated.

Cheers!

Counting top level items in a custom menu walker

$
0
0

I am creating a split menu (half the items on the left, logo in the middle, remaining items on the right). I don’t really understand Walkers all that well, but I found this code snippet.

This was working well for me until my client wanted to add child items. The current code is counting all the menu items (10) when I want it to just count the top level items (currently 7).

How do I adjust this code so that it only counts the top level items?

class Split_Menu_Walker extends Walker_Nav_Menu {

    var $current_menu = null;
    var $break_point  = null;

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

        global $wp_query;

        if( !isset( $this->current_menu ) )
            $this->current_menu = wp_get_nav_menu_object( $args->menu );

        if( !isset( $this->break_point ) )
            $this->break_point = ceil( $this->current_menu->count / 2 ) + 1;

        $indent = ( $depth ) ? str_repeat( "t", $depth ) : '';

        $class_names = $value = '';

        $classes = empty( $item->classes ) ? array() : (array) $item->classes;
        $classes[] = 'menu-item-' . $item->ID;

        $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
        $class_names = ' class="' . esc_attr( $class_names ) . '"';

        $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
        $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';

        if( $this->break_point == $item->menu_order )
            $output .= $indent . '</li></ul><ul><li' . $id . $value . $class_names .'>';
        else
            $output .= $indent . '<li' . $id . $value . $class_names .'>';

        $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';
        $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';
        $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
        $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';

        $item_output = $args->before;
        $item_output .= '<a'. $attributes .'>';
        $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
        $item_output .= '</a>';
        $item_output .= $args->after;

        $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
    }
}

Issue in adapted Twentyfourteen-child Functions.js (add toggles)

$
0
0

I am trying to add one (and maybe more) toggle buttons and menus on a Twentyfourteen-child theme. As the behaviour of search toggle is defined in twentyfourteen/js/functions.js I copied and adapted the related js function as per following (see left-toggle just after the native search-toggle)

( function( $ ) {
var body    = $( 'body' ),
    _window = $( window );
/* Enable menu toggle for small screens.*/

( function() {
    var nav = $( '#primary-navigation' ), button, menu;
    if ( ! nav ) {
        return;
    }

    button = nav.find( '.menu-toggle' );
    if ( ! button ) {
        return;
    }

    /* Hide button if menu is missing or empty.*/
    menu = nav.find( '.nav-menu' );
    if ( ! menu || ! menu.children().length ) {
        button.hide();
        return;
    }

    $( '.menu-toggle' ).on( 'click.twentyfourteen', function() {
        nav.toggleClass( 'toggled-on' );
    } );
} )();

/*
 * Makes "skip to content" link work correctly in IE9 and Chrome for better
 * accessibility.
 *
 * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
 */
_window.on( 'hashchange.twentyfourteen', function() {
    var element = document.getElementById( location.hash.substring( 1 ) );

    if ( element ) {
        if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
            element.tabIndex = -1;
        }

        element.focus();

        /* Repositions the window on jump-to-anchor to account for header height.*/
        window.scrollBy( 0, -80 );
    }
} );

$( function() {
    /* Search toggle.*/
    $( '.search-toggle' ).on( 'click.twentyfourteen', function( event ) {
        var that    = $( this ),
            wrapper = $( '.search-box-wrapper' );

        that.toggleClass( 'active' );
        wrapper.toggleClass( 'hide' );

        if ( that.is( '.active' ) || $( '.search-toggle .screen-reader-text' )[0] === event.target ) {
            wrapper.find( '.search-field' ).focus();
        }
    } );
    $( function() {
        /* left toggle.*/
        $( '.left-toggle' ).on( 'click.twentyfourteen', function( event ) {
            var that    = $( this ),
                wrapper = $( '.left-box-wrapper' );

            that.toggleClass( 'active' );
            wrapper.toggleClass( 'hide' );

            if ( that.is( '.active' ) || $( '.left-toggle .screen-reader-left' )[0] === event.target ) {
                wrapper.find( '.left-field' ).focus();
            }
        } );

        /*
         * Fixed header for large screen.
         * If the header becomes more than 48px tall, unfix the header.
         *
         * The callback on the scroll event is only added if there is a header
         * image and we are not on mobile.
         */
        if ( _window.width() > 781 ) {
            var mastheadHeight = $( '#masthead' ).height(),
                toolbarOffset, mastheadOffset;

            if ( mastheadHeight > 48 ) {
                body.removeClass( 'masthead-fixed' );
            }

            if ( body.is( '.header-image' ) ) {
                toolbarOffset  = body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0;
                mastheadOffset = $( '#masthead' ).offset().top - toolbarOffset;

                _window.on( 'scroll.twentyfourteen', function() {
                    if ( ( window.scrollY > mastheadOffset ) && ( mastheadHeight < 49 ) ) {
                        body.addClass( 'masthead-fixed' );
                    } else {
                        body.removeClass( 'masthead-fixed' );
                    }
                } );
            }
        }

        /* Focus styles for menus.*/
        $( '.primary-navigation, .secondary-navigation' ).find( 'a' ).on( 'focus.twentyfourteen blur.twentyfourteen', function() {
            $( this ).parents().toggleClass( 'focus' );
        } );
    } );

    _window.load( function() {
        // Arrange footer widgets vertically.
        if ( $.isFunction( $.fn.masonry ) ) {
            $( '#footer-sidebar' ).masonry( {
                itemSelector: '.widget',
                columnWidth: function( containerWidth ) {
                    return containerWidth / 4;
                },
                gutterWidth: 0,
                isResizable: true,
                isRTL: $( 'body' ).is( '.rtl' )
            } );
        }

        /* Initialize Featured Content slider.*/
        if ( body.is( '.slider' ) ) {
            $( '.featured-content' ).featuredslider( {
                selector: '.featured-content-inner > article',
                controlsContainer: '.featured-content'
            } );
        }
    } );
} )( jQuery );

/* Scroll le sommaire.*/
jQuery(document).ready(function($){
    $(document).on('click','.sommaire-article a',function(){
        var h = $(this).attr('href');

        $('body,html').animate({  
            scrollTop:$(h).offset().top  
        }, 500); 
        return false;
    });
});

I then set the new functions.js in my childtheme/js and enqueued-dequeued the original functions.js with the code suggested here (Remove sticky behavior from top navigation on twenty fourteen theme?) But both toggle don’t work anymore. I have checked the code and there is apparently a problem with { or } I am not used to js and I guess an expert would find it right away (even more as I don’t manage to put it in one big code here, sorry).

I am then asking your help.

Many thanks in advance,

Yours Sincerely,

Tche

How to override the theme home page?

$
0
0

I’m using a theme that has it’s own home page layout but I want to use a normal page instead. I can’t find a way to change it because in Settings> Reading, the home page is already set to ‘Home’ (a page which already exists for my mobile theme). It seems like the desktop theme home page is just overriding this setting.

custom walker class

$
0
0

I’m trying to make a navigation that has a similar structure of this website: https://grannys.ca/
But I got struck in the logic of how can I implement an if statements which determine several things:

1- if the the link has a class of logo then add before it a container for this link.

2- a container for the rests of links should be made and devide the links in a half and contain a container for each half.

Here’s the prefered output:

<ul>
        <div class="col-sm-2 col-sm-push-5 text-center">
              <a href="index.php" id="main-nav-link" class="logo"><img src="img/image.png" width="100" height="100" alt="Logo"></a>
              <button id="menu-trigger" class="menu-trigger visible-xs"><i class="fa fa-bars fa-2x"></i></button>
        </div>
       <div class="mob-menu-bg">
              <div class="col-sm-5 col-sm-pull-2 left text-center">
                    <li><a href="portrait.php" id="main-nav-link">Portrait</a></li>
                    <li><a href="repertoire.php" id="main-nav-link">Repertoire</a></li>
                    <li><a href="kundenresumes.php" id="main-nav-link">Kundenresumés</a></li>
              </div>
              <div class="col-sm-5 col-sm-push-0 col-sm-pull-0 right text-center">
                    <li><a href="duo.php" id="main-nav-link">Duo</a></li>
                    <li><a href="referenzen.php" id="main-nav-link">Referenzen</a></li>
                    <li><a href="kontakt.php" id="main-nav-link">Kontakt</a></li>
              </div>
      </div>
  </ul>

and here’s the walker class that I’m trying to implement:

class Walker_Main_Nav extends Walker_Nav_Menu {

  function start_lvl( &$output, $depth = 0, $args = array() )  {
        $indent = str_repeat("t", $depth);
        $output .= "n$indent<ul>n";
  }

  function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
        $indent = ($depth) ? str_repeat("t", $depth) : '';
        // $li_attributes = '';
        // $class_names = $value = '';
        $current_indicators = array('');
        $classes = empty( $item->classes ) ? array() : (array) $item->classes;
        $classes[] = ($args->walker->has_children) ? 'dropdown' : '';
        $classes[] = ($item->current || $item->current_item_anchestor) ? 'active' : '';
        if ($depth && $args->walker->has_children) {
              $classes[] = 'dropdown-submenu';
        }
        $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter( $classes ), $item, $args ) );
        $class_names = ' class="' . esc_attr($class_names) . '" ';

        $id = apply_filters('nav_menu_item_id', 'menu_item_'.$item->ID, $item, $args);
        $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';
        $output .= $indent . '<li' . $id . $class_names . '>';
        $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
        $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr($item->target) . '"' : '';
        $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
        $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr($item->url) . '"' : '';
        $attributes .= ( $args->walker->has_children ) ?  ' class="dropdown-toggle" data-toggle="dropdown"' : '';
        $item_output = $args->before;
        $item_output .= '<a' . $attributes . '>';
        $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
        $item_output .= ( $depth == 0 && $args->walker->has_children ) ? '<b class="caret"></b></a>' : '</a>';
        $item_output .= $args->after;

        $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
  }}

Note: I’m a very beginner to wordpress custom theme development.

Please help with this.

How to divide wordpress menu with sub-items on two ul's (using Walker Class)?

$
0
0

There is a great answer http://wordpress.stackexchange.com/a/36407 for splitting menu on two, and there are other great examples on web explaining how to do this, but no answer explains how to do this when there are sub items (sub-menu) in menu.

Above answer uses start_el() function and counts items with

$this->break_point = ceil( $this->current_menu->count / 2 ) + 1;

and then it splits menu. This however in example of menu with 4 parent items with second item containing 6 sub items will count all menu items and split menu between 3rd and 4th sub item.

What I want is to split menu on two ul elements between 2nd and 3rd parent item (in above example), and from what I discovered it is not possible within start_el(), and I am not that familiar with Walker Class to come up with solution on my own (To count parent items and determine position to split).

NOTE: I dont need to use solution from http://wordpress.stackexchange.com/a/36407.

IMAGE EXPLANATION:

walker split

Add dynamic Sitemap to footer

$
0
0

I’m trying to create a footer menu/sitemap of sorts in WordPress. (It’s also worth a mention this is my fist attempt at anything WordPress/PHP related.

Context:

I’ve hosted it here for the time being.
(context. We’re making use of a template called Jupiter, which in turn makes used of a style of WYSIWYG editor to construct the layout)

On the footer of the page (in the skyline), I’d like to add something to this effect. (This was our old footer)

enter image description here

The (my) requirement is that I make use of the WordPress menu structure so that our marketing department can alter the footer as they need to eventually without any (trickier) changes (EG. via the menu GUI editor.)

I’ve managed to add the menu (via dragging it onto a footer widget), but there seems to be something that causing the newly created footer to act like an accordion. (EG. ul & li‘s are expanding and collapsing)

Hovering on the first menu node causes the accordion effect.

enter image description here

Questions:

  1. Is this the best way of attempting to add a sitemap, or is the fact that I’m using a menu the reason why I’m struggling. If so whats the alternative? (Hard-coding is not going to happen).
  2. My thinking so far is I need to add some JavaScript & CSS to try and nullify whatever is causing the collapse, and then attempt to style it. Where would be the best place to add said code?

(I don’t have any code samples yet because I’m still investigating if this can be done via the admin portal at all)


Uber menu, manual integration, disable Mobile

$
0
0

i use uber menu plugin for my theme.
my theme (pointfinder) require manual integration code.It works perfectly, but I would turn it off completely on the mobile
I used the following form (if else)to disable it and got an error. sorry I’m not a dev.

<?php
function pointfinder_menucolumn_get(){
?>
    <div class="col-lg-9 col-md-9" id="pfmenucol1">
        <div class="pf-menu-container">


    if ( wp_is_mobile() ) {
            <nav id="pf-primary-nav" class="pf-nav-dropdown clearfix">
                <ul class="pf-nav-dropdown pfnavmenu pf-topnavmenu">
                    <?php pointfinder_navigation_menu ();?>
                    <?php 
                        if (PFPBSIssetControl('general_postitembutton_status','','1') == 1) {
                    ?>
                    <li id="pfpostitemlink" class="main-menu-item  menu-item-even menu-item-depth-0 menu-item menu-item-type-post_type menu-item-object-page current-menu-ancestor current-menu-parent current_page_parent current_page_ancestor menu-item-has-children">
                      <a class="menu-link main-menu-link">
                          <div class="postanitem-inner">
                              <span class="pfadmicon-glyph-478"></span><?php echo PFPBSIssetControl('general_postitembutton_buttontext','','Post an Item');?>
                          </div>
                      </a>
                    </li>
                    <?php 
                        }; 
                    ?>
                </ul>
            </nav>  
    <?php                                               
    }
    else {

        if ( function_exists( 'ubermenu' ) ): 
            if ( PFPBSIssetControl('general_postitembutton_status','','1') == 1) { ?>
                <div id="pfpostitemlink" >
                    <a class="menu-link main-menu-link">
                        <div class="postanitem-inner">
                            <span class="pfadmicon-glyph-478"></span><?php echo PFPBSIssetControl('general_postitembutton_buttontext','','Post an Item');?>
                        </div>
                    </a>
                </div>
            <?php 
            };

            ubermenu( 'main' , array( 'theme_location' => 'pointfinder-main-menu' ) ); 

            else: 

            ?>
                <nav id="pf-primary-nav" class="pf-nav-dropdown clearfix">
                    <ul class="pf-nav-dropdown pfnavmenu pf-topnavmenu">
                        <?php 
                            pointfinder_navigation_menu ();
                            if (PFPBSIssetControl('general_postitembutton_status','','1') == 1) {
                        ?>
                        <li id="pfpostitemlink" class="main-menu-item  menu-item-even menu-item-depth-0 menu-item menu-item-type-post_type menu-item-object-page current-menu-ancestor current-menu-parent current_page_parent current_page_ancestor menu-item-has-children">
                            <a class="menu-link main-menu-link">
                                <div class="postanitem-inner">
                                    <span class="pfadmicon-glyph-478"></span><?php echo PFPBSIssetControl('general_postitembutton_buttontext','','Post an Item');?>
                                </div>
                            </a>
                        </li>
                        <?php 
                            };
                        ?>
                    </ul>
                </nav>   
<?php       
    endif; 
    }
?>

for manual integration use this:

http://sevenspark.com/docs/ubermenu-3/theme-integration/pointfinder

thk a lot

How to keep state of custom menu?

$
0
0
<div class="menu-main-container">
<ul id="menu-main" class="menu">
<li id="menu-item-1">
    <a href="/category-a/">Category A</a>
    <ul class="sub-menu">
        <li id="menu-item-2" class="menu-item-2">
            <a href="/post-1/">Post 1</a>
        </li>
        <li id="menu-item-3" class="menu-item-3">
            <a href="/post-2/">Post 2</a>
        </li>
    </ul>
</li>
<li id="menu-item-14">
    <a href="/category-b/">Category B</a>
    <ul class="sub-menu">
        <li id="menu-item-4" class="menu-item-4">
            <a href="/post-4/">Post 4</a>
        </li>
        <li id="menu-item-5" class="menu-item-5">
            <a href="/post-5/">Post 5</a>
        </li>
    </ul>
</li>

Hello everyone, today I need for your help.

I have the ul/li list as above. Would you please help me make the sub-menus that can be toggled and keep state when reload page or click to link?

The other problem is how can we get all posts from a category with pagination?

I want to create a custom menu that shows all posts title with link for all categories.

Many thanks.

How to Add to Each Menu Link with link text to data-attr?

$
0
0

how do i get something like below
my code is like this.

wp_nav_menu(
     array(
       'theme_location' => 'header_menu',
       'container_id' => 'menu',
       'link_before' => '<span data-hover="link-text-here">',
       'link_after' => '</span>',
     )
  );

I want to get this result below.

<nav class="main-nav">
    <li><a href="#"><span data-hover="Home">Home</span></a></li>
    <li><a href="#"><span data-hover="Proyects">Proyects</span></a></li>
</nav>

Please advaice me.

Is there a way to retrieve post meta data from wp_get_nav_menu_object?

$
0
0

I am trying to integrate flexslider into my theme. I want all my post to default to flexslider post and I want to be able to customize the order of these post/slides using custom menus on the dashboard. I am having trouble extracting post data from the menu objects.

Here is my code:

<?php

//Enqueue Flexslider Files

  function wptuts_slider_scripts() {
  wp_enqueue_script( 'jquery' );
  wp_enqueue_script( 'flex-script', get_template_directory_uri() .  '/js/jquery.flexslider-min.js', array( 'jquery' ), false, true ); 
}
add_action( 'wp_enqueue_scripts', 'wptuts_slider_scripts' );

// Initialize Slider
?>
<?php  function wptuts_slider_initialize() { ?>
    <script type="text/javascript" charset="utf-8">
        jQuery(window).load(function() {
            jQuery('.flexslider').flexslider({
                animation: "fade",
                direction: "horizontal",
                slideshowSpeed: 700,
                animationSpeed: 600
            });
        });
    </script>
 <?php }
 add_action( 'wp_head', 'wptuts_slider_initialize' );
?>

<?php
 function wptuts_slider_template(){

 //the name of the custom menu I want to retrieve
 $menu_name = 'slider';

 //get all of the menus
 $locations = get_nav_menu_locations();

 //Check to see if the menu in the location is empty
 if ( isset( $locations[ $menu_name ] ) ) {

 //get the actual menu object by the same name
 $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );

 //retrieve menu items
 $menu_items = wp_get_nav_menu_items($menu);

 //echo var_dump($menu_items); 

 //Start the Slider ?>
<div class="flexslider">
 <ul class="slides">
   <?php

 foreach( $menu_items as $slide ){
  //var_dump($slide);
  //echo $slide ->ID;

//retrieve the id of the post from the menu_items of the slider menu
  var_dump(get_post($slide ->ID));

 //if the slider has a thumbnail then display it
  if ( has_post_thumbnail() )

  ?>
  <li>
<?php echo the_post_thumbnail() ?>
            </li>

<?php }?>
<?php }?>
<?php }?>

Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error

$
0
0

This is a bug in my WP install that has crept up unknowingly; I can’t say for sure when it began.

To describe it: there were menus created in the Appearance -> Menus page early in the site’s history, and they work perfectly, as in:

  • They have menu items
  • They can be assigned to menu locations
  • They can be renamed

As of recently, as new menus need to be created, I’ve noticed the following problems when creating a new menu:

New menus can be created, but after clicking “Create Menu”, the sidebar with Posts and Pages to use as menu items, is still grayed out
The menu cannot be renamed:

  1. The menu name does not show up in the “Menu Name” text field, and subsequent clicks to “Create Menu” simply duplicates these new-yet-unusable menus each again per new click (ex: I create Test1, then create Test2.. now there are 2 Test1 entries, and 2 Test2 entries… creating Test3 repeats the effect, creating 3 of each)
  2. Clicking “Manage in Customizer” next to the “Menus” heading results in the following error:
    Fatal error: Uncaught exception 'Exception' with message 'Illegal widget setting ID: nav_menu_item[]' in /Applications/MAMP/htdocs/discoverlongisland/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php:179 
    Stack trace: #0 /Applications/MAMP/htdocs/discoverlongisland/wp-includes/class-wp-customize-nav-menus.php(551): WP_Customize_Nav_Menu_Item_Setting->__construct(Object(WP_Customize_Manager), 'nav_menu_item[]', Array) 
    #1 [internal function]: WP_Customize_Nav_Menus->customize_register(Object(WP_Customize_Manager)) 
    #2 /Applications/MAMP/htdocs/discoverlongisland/wp-includes/plugin.php(525): call_user_func_array(Array, Array) 
    #3 /Applications/MAMP/htdocs/discoverlongisland/wp-includes/class-wp-customize-manager.php(583): do_action('customize_regis...', Object(WP_Customize_Manager)) 
    #4 [internal function]: WP_Customize_Manager->wp_loaded('') 
    #5 /Applications/MAMP/htdocs/discoverlongisland/wp-includes/plugin.php(525): call_user_func_array(Array, Array) 
    #6 /Applications/MAMP/htdocs/discoverlongisland/wp-settings. in /Applications/MAMP/htdocs/discoverlongisland/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php on line 179

I’ve disabled all plugins and the problem persists.

Has anyone run into this before?

How do I put my Blog posts on two or three different pages?

$
0
0

So my site has a static front page and a blog page on my website, but I would like to show my blog on both the blog page and the static front page. Also, I have several pages representing several categories, such as my artwork, my writing, and writing tools and I would like to have the blog fully displayed under their specific title.

In other words, I want my blog to appear in two places, and blog posts under specific categories to appear under their menu title and I know this is just adding more agony to my dilemma but I hope there is a way to do this with a widget last time I did coding my site crashed.

Where am I doing wrong in my theme menu?

$
0
0

Every thing works fine out of WordPress but the theme’s dropdown menu doesn’t work.

Here is my functions.php code :

register_nav_menus(array(
    'primary' => esc_html__('Primary', 'codeha'),
));

My header.php file :

    <?php
    wp_nav_menu(array(
        'theme_location' => 'primary',
        'menu_id' => 'primary-menu',
        'container' => 'div',
        'container_class' => 'primary_nav_div',
        'container_id' => 'primary_menu',
        'menu_class' => 'menu',
        'menu_id' => 'primary_menu_ul'));
    ?>

My JavaScript code:

$(document).ready(function () {
    $("#primary_menu ul li").hover(function () {
        $(this).find("ul").stop().slideToggle(400);
    });
});

And my stylesheet:

#primary_menu ul{
    margin:0;padding:0;list-style:none;background:#252525;text-align:center;position:relative;
}

#primary_menu ul li{display:inline-block;}

#primary_menu ul li a{display:block;height:45px;width:150px;color:#fff;font-family:helvetica;line-height:43px;text-decoration:none;transition: background 0.5s linear 0s, color 0.5s linear 0s}

#primary_menu ul li a:hover{background:#f0300b;color:#781705;}

#primary_menu ul ul{position:absolute;width:150px;display:none;}
#primary_menu ul ul li{display:block;background:#252525;}

get_query_var('post_type') not returning in a filter

$
0
0

Trying to highlight custom taxonomy pages in the main nav, so I am trying to get the post_type of the current rendered page (to compare to the menu item):

add_filter('nav_menu_css_class', 'current_tax_nav_class', 10, 2);
function current_tax_nav_class($classes, $item) {
    $post_type = get_query_var('post_type');

    echo ">>>";
    print_r( $post_type );
    echo "<<<";

    return $classes;
}

But cannot get post_type var to return anything. This code is in functions.php

Using WP Version 4.4.1

Menu items suddenly are displayed all over the page [closed]

$
0
0

Strange things are happening :( When you take a look at the site:
www.handelbijvanandel.nl you will see that all menu- and submenu items are shown on the page.

At first I didn’t pay much attention to it and did a backup restore.
This solves the issue for a little while, but then the problem pops-up again :(

Any ideas where to look?

Best regards,
Hielke

Responsive menu gone on wordpress Responsive theme

$
0
0

The responsive menu on my website is gone (homepage only). I am not sure what caused that and don’t know how to fix it. Can you please help? I will really appreciate it. The website is http://www.loenne.info/ . Thank you very much.

How to undo the last changes to a custom menu?

$
0
0

I have a wordpress site with a custom menu. When I want to add a page or something to the menu, I click appearance, add the item, then drag it to the right location. This time when I did it the menu only saved about 30% of what was originally there. Normally, I would be just a little annoyed to have to rebuild the menu, but in this case, it is a pretty extensive menu with over a hundred items.

Is there a way to undo the most recent menu save?


Possibly necessary details:

  • WordPress 4.4.1
  • Custom theme, custom menu
  • site. Menu that pops up when you click “lectures”

how to made customize wp_nav_menu walker with search box

$
0
0

how to made customize wp_nav_menu walker with search box.

<ul class="main-navigation">
                    <li class="course">
                        <!-- <a href="#">Course</a> -->
                        <a href="#">Courses</a>
                    </li>
                    <li class="library ">
                        <a href="#">Library</a>
                        <ul class="category-list">
                        <li class="cat-item cat-item-1"><a href="#">Experiments</a>
    </li>
        <li class="cat-item cat-item-2"><a href="#">Navigations</a>
    </li>
        <li class="cat-item cat-item-3"><a href="#">Templates</a>
    </li>
        <li class="cat-item cat-item-4"><a href="#">UX Patterns</a>
    </li>
        <li class="cat-item cat-item-5"><a href="#">Web Components</a>
    </li>
                        </ul>
                    </li>
                    <li class="search">
                        <form action="#" id="search-form" method="get">
        <input type="search" name="s" placeholder="Search...">
        <input type="hidden" value="submit">
    </form>             </li>
                </ul>
Viewing all 80 articles
Browse latest View live