Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1197332
    joenaab
    Participant

    I’d like to use a full-width blog (listing page, not individual posts) as the main reason I use a sidebar is to have a category dropdown to aid the visitor in finding what they are looking for.

    Is it possible to add a category dropdown above the list of blog posts and below the menu bar?

    Two examples would be:
    https://moz.com/blog
    https://blog.bufferapp.com/

    A large search field might also be nice, too.

    #1197531
    Joao
    Moderator

    Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    #1197565
    joenaab
    Participant

    I’m actively making edits to the live site, so you may see some oddities. Here’s the link:

    https://www.vocalnebula.com/blog

    #1197923
    Rue Nel
    Moderator

    Hello There,

    Since the child theme is set up, please add the following code in your child theme’s functions.php file

    // Dropdown categories
    // =============================================================================
    function add_dropdown_categories(){ ?>
      <?php if ( is_home() || is_category() ) : ?>
        <div id="categories" class="mbm" style="text-align: right;">
          <?php wp_dropdown_categories( 'show_option_none=Select category' ); ?>
          <script type="text/javascript">
            <!--
            var dropdown = document.getElementById("cat");
            function onCatChange() {
              if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
                location.href = "<?php echo esc_url( home_url( '/' ) ); ?>?cat="+dropdown.options[dropdown.selectedIndex].value;
              }
            }
            dropdown.onchange = onCatChange;
            -->
          </script>
        </div>
      <?php endif; ?>
    <?php }
    add_action('x_before_view_global__index', 'add_dropdown_categories');
    // =============================================================================

    And then you should have something like this: http://prntscr.com/codw3x

    Please let us know if this works out for you.

    #1199235
    joenaab
    Participant

    It worked, but then created a new problem, which probably existed before and I hadn’t thought about it. The moment you choose a category from the drop down the view becomes that of the category archive page, which I don’t like at all. I want to have all archive listings in the same format as the custom blog I’ve created (small thumb to left of title, meta and excerpt).

    Is there a way to make all archive pages the same format as my blog page? I’m guessing this might require custom development, right?

    For now I’ll have to revert back to showing the sidebar on the blog listing page and archive pages though I’d like to work this out somehow. At full-width and on a desktop, the theme stretches the featured image to gigantic proportions and it looks terrible.

    #1199269
    Christian
    Moderator

    Archives have the same settings as the Blog in Appearance > Customize > Blog so you can set it up like your blog (see attachment).

    Further customizations from here would be getting into custom development, which is outside the scope of support we can offer. If you need more in depth changes, you may wish to consult with a developer. X is quite extensible with child themes, so there are plenty of possibilities. Thanks for understanding.

  • <script> jQuery(function($){ $("#no-reply-1197332 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>