Home Forums Archived Forums Weaver II Theme Category sort clobbers main menu

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18234
    cobra
    Participant

    I am using Weaver II 2.1.12. I have a function in functions.php to sort my Events Category.  The function works properly but the main menu is clobbered in the process.  Here is the function:

      // Reorder Events by start date
      //  For more info see http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
      function sort_events($query) {
        if (is_category(‘events’)) {
          $query->set(‘meta_key’,’event start’);
          $query->set(‘orderby’,’meta_value’);
          $query->set(‘order’,’ASC’);
        }
      }
      add_action(‘pre_get_posts’,’sort_events’);

    Below is partial html for the Events page: /archives/category/events

    As you can see, the menu is missing <ul> and <li> items.  The menu is displayed correctly on every other page.

    <div class=”skip-link”><a class=”assistive-text” href=”#content” title=””>Skip to primary content</a></div>


    <div class=”skip-link”><a class=”assistive-text” href=”#sidebar_primary” title=””>Skip to secondary content</a></div>


    <div id=”nav-bottom-menu”><nav id=”access” class=”menu_bar” role=”navigation”>


    </nav></div><!– #access –>

    I don’t understand how the function is interfering with the generation of the menu items.  Anyone have ideas?

    Thanks much.

    #24447
    Weaver
    Keymaster

     I don’t know the answer, and it is a bit beyond the normal level of support to debug very technical custom code like that.

    But, the theme (any theme) will deliver whatever WordPress core delivers. And since the filter is applied to all pre get posts, it likely is interacting with the code that would generate the menu.

    Just looking at your code, I see “$query->set(‘meta_key’,’event start’);”. The value ‘event start’, with a blank, is not a “normal” WP value for such things. Are you sure that is correct, with the space?

    #24448
    cobra
    Participant

    Oh, I see.  I traced the html back to nav-bottom.php but I think you are saying that WP core is not giving the expected menu to Weaver to process and I had not considered that.

    ‘event start’ is the name of a custom field and it could very well be that the space is causing some problem upstream but the sorting function is doing what I expect with a side effect of no menu.  Perhaps I will look in the WP core files.

    Thanks much.

    Also, great theme, the most flexible one I’ve found so far!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘ Weaver II Theme’ is closed to new topics and replies.