Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #303028

    asdad34213
    Participant

    I have a custom theme for a category using the file category-25.php in a child theme.
    My menu isn’t appearing in this custom category theme but it appears fine in my single post customised theme file. single-destination.php that i use for a custom post type.

    How can i get it to appear? I’m using the Ethos framework.

    #303031

    asdad34213
    Participant
    This reply has been marked as private.
    #303310

    Thai
    Moderator

    Hi There,

    Thanks for writing in.

    Please try testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

    If it doesn’t work, 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

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thanks.

    #303720

    asdad34213
    Participant
    This reply has been marked as private.
    #303747

    asdad34213
    Participant
    This reply has been marked as private.
    #303874

    asdad34213
    Participant
    This reply has been marked as private.
    #303875

    asdad34213
    Participant
    This reply has been marked as private.
    #304209

    Christian
    Moderator

    Hey there,

    Since X is a multi-design theme, its structure is not the same as a typical theme. Please see https://community.theme.co//kb/customization-best-practices/ to learn how to customize X. We’d love to help you with this however, this involves custom development and a plugin therefore it falls outside the scope of our support. You might want to contact our trusted partners who caters X setup and customization needs. Please see https://theme.co/x/member/custom-development/.

    Thank you for understanding.

    #304264

    asdad34213
    Participant

    ok fixed it.

    For anyone having problems with menu’s not appearing on custom category theme pages or child category themes using this plugin

    https://wordpress.org/plugins/category-template-hierarchy/

    and the Ethos layout

    Here’s a solution.

    function getMainMenu($menulocation){
      $locations = get_nav_menu_locations();
      $menuItems = wp_get_nav_menu_items( $locations[ $menulocation ] );
        if(empty($menuItems))
          return false;
        else{
          wp_nav_menu(array('theme_location' => $menulocation,  'container'=> false, 'menu_class'=> 'x-nav sf-menu'));
          return true;
        }
    }

    in your functions.php and i’m calling a custom header in my theme
    <?php get_header('custom');?>

    in header-custom.php
    <?php x_get_view( x_get_stack(), 'wp', 'headercustom' ); ?>

    in wp-headercustom.php in my child ethos i’m using

    <?php
    
    // =============================================================================
    // VIEWS/ETHOS/WP-HEADERCUSTOM.PHP
    // -----------------------------------------------------------------------------
    // Header output for Ethos.
    // =============================================================================
    
    ?>
    
    <?php x_get_view( 'global', '_header' ); ?>
    
      <?php x_get_view( 'global', '_slider-above' ); ?>
    
      <header class="<?php x_masthead_class(); ?>" role="banner">
        <?php x_get_view( 'ethos', '_post', 'carousel' ); ?>
        <?php x_get_view( 'global', '_topbar' ); ?>
        <?php x_get_view( 'global', '_navbarcustom' ); ?>
        <?php x_get_view( 'ethos', '_breadcrumbs' ); ?>
    </header>
    
      <?php x_get_view( 'global', '_slider-below' ); ?>
      <?php x_get_view( 'ethos', '_landmark-header' ); ?>
    

    and then the same _nav-primarycustom.php in global

    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_NAV-PRIMARYCUSTOM.PHP
    // -----------------------------------------------------------------------------
    // Outputs the primary nav.
    // =============================================================================
    if(!getMainMenu('primary')){
      $backup = $wp_query;
      $wp_query = NULL;
      $wp_query = new WP_Query(array('post_type' => 'post'));
      ?>
     <a href="#" class="x-btn-navbar collapsed" data-toggle="collapse" data-target=".x-nav-wrap.mobile">
      <i class="x-icon-bars"></i>
      <span class="visually-hidden"><?php _e( 'Navigation', '__x__' ); ?></span>
    </a>
    <nav class="x-nav-wrap desktop" role="navigation">
    <?php getMainMenu('primary'); ?>
      <?php /*wp_nav_menu( array(
    	  'theme_location' => 'primary',
    	  'container'      => false,
    	  'menu_class'     => 'x-nav sf-menu'
    	) );*/
    ?>
      </nav>
      <div class="x-nav-wrap mobile collapse">
     <?php /* wp_nav_menu( array(
    	  'theme_location' => 'primary',
    	  'container'      => false,
    	  'menu_class'     => 'x-nav sf-menu'
    	) );*/
    ?>
    <?php getMainMenu('primary'); ?>
    </div>
      <?php
      $wp_query = $backup;
    }
    ?>

    adapted from this forum post.
    https://wordpress.org/support/topic/wp-nav-menu-dissapears-in-category-pages-1

    Still no idea why this isn’t working with Ethos by default but it is with this fix.

    #304607

    Christopher
    Moderator

    Thanks for sharing.