Custom Fields
Re-Envisioned
Support MB Views My Archive view gets ignored by the theme

  • Creator
    Topic
  • #20597
    Resolved EddyPiV
    Participant

    Hi,

    I have created a view on individual posts, and that works great.
    But the view on the post archive seems completely ignored, if I render it for “Only the post content area”. And I want to render it that way, to keep the widgets in place.

    How can I have it working with my theme? I use the Materialis Pro theme from ExtendThemes.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #20610
    Long Nguyen
    Moderator

    Hi Eddy,

    If you use the option Only the post content area, it will render the view in each post content of the archive page.

    If you want to build your own archive page with the option The layout between header and footer, you can use the function dynamic_sidebar() to show the sidebar.

    <div class="gridContainer gridContainer content">
        <div class="row">
          <div class="col-xs-12 col-sm-8 col-md-9">
              Content of archive page
          </div>
          <div class="sidebar col-sm-4 col-md-3">
              <div class="sidebar-row">
                  {{mb.dynamic_sidebar('sidebar-1')}}
              </div>
          </div>
        </div>
    </div>

    See more in my screen record https://www.loom.com/share/be68732059e5426b99266e6295d1d53a.

    #20620
    EddyPiV
    Participant

    Hi Long,

    This is really helpful! I managed to get the view exactly as I wanted.
    Except for 1 thing: under the sidebar there is always the number “1” shown, and I have no idea why that is.
    https://share.getcloudapp.com/RBuqBxy6

    Any clou?

    #20624
    Long Nguyen
    Moderator

    Hi,

    Because the function dynamic_sidebar() returns the ID number of the sidebar so when we echo this function, it will show the ID after. Please add this code to the file functions.php in the child theme folder to remove the ID of the sidebar.

    add_filter( 'dynamic_sidebar_has_widgets', function( $did_one, $index ) {
        $index = '';
        return $index;
    }, 99, 2 );
    #20625
    EddyPiV
    Participant

    Thanks Long, it disappeared.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.