Blog layout with Sidenavigation

Hi X-Theme

question one
we have layouted the entry blog page with “WPBakery PageBuilder / PostGrid”
-> https://pibella.com/pibella-user-reviews/

clicking into a post shows the single post like this:
-> https://pibella.com/female-urinal-pibella-with-harness/

on this and every single post side we would like to have a sidebar with categories and slugs.
but we have no clou how to implement it.

question two
we have built a simple error side:
-> https://pibella.com/de/entschuldigung404/

now if anyone links to our site with a wrong url like:
-> https://pibella.com/yxz

strangely enough there apears the “previous button” which we created for the single post.
any idea why?

Thanks in advance for your help
ben

Hi There,

You can hide that button by adding this custom CSS under Theme Options > CSS:

.error404 .navigation.post-navigation {
    display: none;
}

Please add the following code under functions.php file locates in your child theme:

function x_get_content_layout() {

    $content_layout = x_get_option( 'x_layout_content' );

    if ( $content_layout != 'full-width' ) {
      if ( is_home() ) {
        $opt    = x_get_option( 'x_blog_layout' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_singular( 'post' ) ) {
        $meta   = get_post_meta( get_the_ID(), '_x_post_layout', true );
        $layout = ( $meta == 'on' ) ? 'full-width' : $content_layout;
      } elseif ( x_is_portfolio_item() ) {
        $layout = 'full-width';
      } elseif ( x_is_portfolio() ) {
        $meta   = get_post_meta( get_the_ID(), '_x_portfolio_layout', true );
        $layout = ( $meta == 'sidebar' ) ? $content_layout : $meta;
      } elseif ( is_page_template( 'template-layout-content-sidebar.php' ) ) {
        $layout = 'content-sidebar';
      } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) {
        $layout = 'sidebar-content';
      } elseif ( is_page_template( 'template-layout-full-width.php' ) ) {
        $layout = 'full-width';
      } elseif ( is_archive() ) {
        if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) {
          $opt    = x_get_option( 'x_woocommerce_shop_layout_content' );
          $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
        } else {
          $opt    = x_get_option( 'x_archive_layout' );
          $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
        }
      } elseif ( x_is_product() ) {
        $layout = 'full-width';
      } elseif ( x_is_bbpress() ) {
        $opt    = x_get_option( 'x_bbpress_layout_content' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( x_is_buddypress() ) {
        $opt    = x_get_option( 'x_buddypress_layout_content' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_404() ) {
        $layout = 'full-width';
      } else {
        $layout = $content_layout;
      }
    } else {
      $layout = $content_layout;
    }

    if ( is_singular( 'post' ) ) {
    	$layout = 'content-sidebar';
    }

    return $layout;

}

Then you can add your widgets to the main sidebar.

Hope it helps :slight_smile:

He thanks very much, so far almost perfect.

perhabs you could provide us with a layout for the categories
-> https://pibella.com/2018/03/
also here:
-> https://pibella.com/category/outdoor-en/
images should not blow up, and text placed on the right side like the layout we have on the single post
-> https://pibella.com/female-urinal-pibella-with-harness/

can we have the sidenav on these layouts us well

sidenav in general, now the sidenav is located besides form the main layout, I supose it is not posible to integrade it into the main content frame right?
similar to here: https://pibella.com/about-pibella/here-you-find-the-lists-of-our-retailers/

best regard and thanks, ben

Hi,

To make it the same as your single post, you can add the code below in Theme Options > CSS

@media screen and (min-width: 768px) {
.archive.entry-featured {
    float: left;
    margin-right: 2%;
    width: 20%;
}
}

with regards to sidenav, that could be possible with custom development, but this would be outside the scope of support we can offer. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.

Thanks for understanding. Take care!

thanks Paul

that didn’t change anything unfortunately.
I reduced the images by my self with (otherwise the images blow up 100%):

.entry-thumb img {
  min-width: 30%;
  min-height: 30%;
}

though the same layout like single blog would be nicer.

and: to have the sidenavigation on all blog layouts like categories and archies should be possible right? (like you provided us on the single post)

thanks alot, ben

Hi There,

Please update the provided code to this:

function x_get_content_layout() {

    $content_layout = x_get_option( 'x_layout_content' );

    if ( $content_layout != 'full-width' ) {
      if ( is_home() ) {
        $opt    = x_get_option( 'x_blog_layout' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_singular( 'post' ) ) {
        $meta   = get_post_meta( get_the_ID(), '_x_post_layout', true );
        $layout = ( $meta == 'on' ) ? 'full-width' : $content_layout;
      } elseif ( x_is_portfolio_item() ) {
        $layout = 'full-width';
      } elseif ( x_is_portfolio() ) {
        $meta   = get_post_meta( get_the_ID(), '_x_portfolio_layout', true );
        $layout = ( $meta == 'sidebar' ) ? $content_layout : $meta;
      } elseif ( is_page_template( 'template-layout-content-sidebar.php' ) ) {
        $layout = 'content-sidebar';
      } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) {
        $layout = 'sidebar-content';
      } elseif ( is_page_template( 'template-layout-full-width.php' ) ) {
        $layout = 'full-width';
      } elseif ( is_archive() ) {
        if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) {
          $opt    = x_get_option( 'x_woocommerce_shop_layout_content' );
          $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
        } else {
          $opt    = x_get_option( 'x_archive_layout' );
          $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
        }
      } elseif ( x_is_product() ) {
        $layout = 'full-width';
      } elseif ( x_is_bbpress() ) {
        $opt    = x_get_option( 'x_bbpress_layout_content' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( x_is_buddypress() ) {
        $opt    = x_get_option( 'x_buddypress_layout_content' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_404() ) {
        $layout = 'full-width';
      } else {
        $layout = $content_layout;
      }
    } else {
      $layout = $content_layout;
    }

    if ( is_singular( 'post' ) || is_archive() ) {
    	$layout = 'content-sidebar';
    }

    return $layout;

}

Hope it helps :slight_smile:

many thanks Thai, side navigation is perfect.
the remaining question is, whether it is possibe, to have the same layout in catogieres and archives, as we have in single post.
I appreciate your support, regards, ben

Hi There,

Please try adding this custom CSS:

@media screen and (min-width: 768px) {
    .archive .entry-featured {
        float: left;
        margin-right: 2%;
        width: 20%;
    }
}

Let us know how it goes!

awesome thanks, now it works.

last question, no there is en excerpt length. can be it set to show 100% of the text in archive and categories listing.
textcut we would have only at the entry blog page:
https://pibella.com/pibella-user-reviews/

best regars, ben

Hi Ben,

Unfortunately, this will require further theme development which is beyond our support scope, you might need to hire someone to do this task for you.

Thanks.

ok, disappointed though, aren’t these thing basic stuff within a blog theme? even a partial sidenav seems to be an issue with x-theme. with other themes I work with there is no need for support for these basic stuff.

I’m not unhappy with x-themes, don’t get me wrong. the idea buying x-themes licenses was to handle many sites with different looks, without having the work of getting into a new theme every time. howerver, I will consider choosing a more easier theme next time.

many thanks anyway, your support is great and fast, that’s awesome!!!
regards ben

Hi Ben.

There is a setting that you can find in X > Theme Options > Blog > Content : Full Post Content on Index but it would only display the full content of the posts for index pages like the blog page.

It won’t do the same for the archive and category pages, but you can always do a template override through the child theme.

I can give you some information as a starting point on how to achieve what you are aiming for.

First, you will need to have the child theme installed and activated.

Then login through FTP and go to the following directory: wp-content/themes/x/framework/views/global/ then you should find the _content.php file and copy the file.

Copy the file then go to the following directory: wp-content/themes/x-child/framework/views then create the directory global in the views directory. Place the _content.php file that you copied earlier in the global directory.

Edit the file and you should see the code in the file:

<?php

// =============================================================================
// VIEWS/GLOBAL/_CONTENT.PHP
// -----------------------------------------------------------------------------
// Display of the_excerpt() or the_content() for various entries.
// =============================================================================

$stack                     = x_get_stack();
$is_full_post_content_blog = is_home() && x_get_option( 'x_blog_enable_full_post_content' ) == '1';

?>

<?php

if ( is_singular() || $is_full_post_content_blog ) :
  x_get_view( 'global', '_content', 'the-content' );
  if ( $stack == 'renew' ) :
    x_get_view( 'renew', '_content', 'post-footer' );
  endif;
else :
  x_get_view( 'global', '_content', 'the-excerpt' );
endif;

?>

Change the line:

if ( is_singular() || $is_full_post_content_blog ) :

to

if ( is_singular() || $is_full_post_content_blog || is_archive() || is_category() ) :

Hope this helps you get started.

Cheers!

1 Like

ok, that’s absolutely awesome, really very kind, I implemented it alright, THANKS, ben

Hi again,

In addition to that you should check out WordPress conditional tags here https://codex.wordpress.org/Conditional_Tags and we’re glad we could help.

Cheers!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.