Portfolio customizations: Sidebar for integrity

Hi,

I’m hoping you can help me make some changes to my portfolio index page. I would like to:

  1. Add a sidebar to the existing page

  2. Is it possible to add archive to portfolio in this sidebar?

Please see attached image and info in secure note. Thanks so much!

Hello @Brad_B_1,

Thanks for asking. :slight_smile:

Please take a look at the solution mentioned in following thread to add sidebar in portfolio page:

Please note that above step will require changes in theme file. I suggest you to please install and setup child theme. I am sharing the resources that you can use to download and setup child theme:

https://theme.co/apex/child-themes

Upon adding the sidebar, you can add widgets from Appearance > Widgets.

Thanks.

Thanks for the reply! I added the file, but it only added a sidebar to the portfolio item pages. I want to add the sidebar to the main portfolio ‘index’ page. Is this possible? Thanks!

Hello @Brad_B_1,

Thanks for updating the thread. :slight_smile:

You can add following code in child theme function.php file to display sidebar on portfolio index page:

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() ) {
        $layout = 'content-sidebar';
      } 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;
    }
    return $layout;
  }

Thanks.

Thank you! That worked perfectly!

A couple issues, though:

  1. The Archive widget isn’t showing my portfolio items for some reason.

  2. How can I move the filters from the top of the page to the sidebar? I tied adding the “Categories” widget, but it isn’t showing my portfolio categories.

  3. Can I make the portfolio items excerpts display fewer words?

Thanks so much!

Hello There,

Thanks for updating in!

1.) The Archive widget will only display posts. It will not display portfolio items. You would need a 3rd party plugin to display the portfolio items in the sidebar because it is a custom post type and none of the default widgets will display custom post type. By default, all the widgets will only display post items. Perhaps you need this widget plugin: https://wordpress.org/plugins/recent-posts-widget-extended/

2.) The portfolio filters are designed and built for the Portfolio page. You can not move it to the sidebar.

3.) The excerpts can be adjusted in X > Theme Options > Blog > Content and reduce the Excerpt Length. This is the same settings being used for the portfolio.

Hope this helps.

Thanks for your reply. This is a long shot, but is there a way to automatically convert all my portfolio items to posts? Or does it have to be done manually? Thanks!

Hey There,

The portfolio items is a different post type. It is better that you have to create it as a post manually.

Best Regards.

Thank you!

You’re welcome.

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