Change Portfolio Sidebar?

Hi I’m using portfolio pages for testimonials in the Renew stack.

I would like to add recent posts and other widget items to the side bar that shows up on this page and all the other portfolio pages:

Can you please let me know what I need to do in order to make that happen?

Thanks.

1 Like

Hi Matt,

Thanks for writing in. To achieve that, you can create a new sidebar under Appearance > Sidebars then assign all portfolio pages to that sidebar.

After that, you can add the necessary widget items to that sidebar under Appearance > Widgets

Please note that every time you add a new porfolio, you need to assign that portfolio to your sidebar under Appearance > Sidebars

Hope this helps

Thanks Paul.

The issue is that in assigning sidebars I’m not able to assign it to the individual pages, like this:

I can assign it to categories, but not this individual page and every portfolio page.

Also, I would like to KEEP what is currently there and ADD more things to it… like Search, Recent Posts, etc…

Hi Matt,

That page is a portfolio without a sidebar placement, assigning will not work. Please go to Theme Options > Layout and Design > CONTENT LAYOUT and change its layout to Content Left, Sidebar Right. It should add a sidebar area where your sidebars will be displayed as you assigned it.

Right now, your content layout is set to full-width.

Thanks!

Here’s what I’m looking at now. I’m not sure what you want me to change?

My site layout is fullwidth but my content layout is content left, sidebar right.

Hi Matt,

Sorry for the confusion, portfolio post page layout is not designed to have a sidebar because it has already that entry-extra div in the left side.

If you need sidebar on the portfolio post page please follow the solution provided on the following thread.

Hope it helps,
Cheers!

This doesn’t seem to work like I want it to. Here’s a loom video of what I want.

Hello Matt,

Thanks for the very informative loom video.

  • First, please update the X theme to the latest version. X 6.5.5 is now available in automatic updates! This release contains fixes for several issues so be sure to check out the changelog (https://theme.co/changelog/). Please do update to the latest version. After doing the updates, always remember to clear all caches when updating so that the code from the latest release is always in use. This will help you to avoid any potential errors.

  • Second, please revert or remove any changes you may have added as suggested in the thread given by Friech. We just need to start over since you want the sidebar to display underneath the extra element area.

  • And lastly, assuming you have your child theme active and ready, please follow these steps below:
    1] Using Notepad or TextEdit or Sublime Text or any text editor, please create a new file in your local machine.
    2] Insert the following code into that new file

<?php

// =============================================================================
// VIEWS/RENEW/CONTENT-PORTFOLIO.PHP
// -----------------------------------------------------------------------------
// Portfolio post output for Renew.
// =============================================================================

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

  <?php if ( ! x_is_portfolio_item() ) : ?>

    <div class="entry-featured">
      <?php x_portfolio_item_featured_content(); ?>
      <div class="entry-cover">
        <div class="entry-cover-content">
          <span><?php echo get_post_meta( get_the_ID(), '_x_portfolio_media', true ); ?></span>
          <h2 class="entry-title entry-title-portfolio">
            <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php x_the_alternate_title(); ?></a>
          </h2>
          <span><?php echo get_the_date( 'm.d.y' ); ?></span>
        </div>
      </div>
    </div>

  <?php endif; ?>

  <div class="entry-wrap cf">

    <?php if ( is_singular() ) : ?>

      <div class="entry-info">
        <div class="entry-featured">
          <?php x_featured_portfolio( 'cropped' ); ?>
        </div>
        <header class="entry-header">
          <h1 class="entry-title entry-title-portfolio"><?php the_title(); ?></h1>
          <?php x_renew_entry_meta(); ?>
        </header>
        <?php x_get_view( 'global', '_content', 'the-content' ); ?>
      </div>
      <div class="entry-extra">
        <?php x_portfolio_item_tags(); ?>
        <?php x_portfolio_item_project_link(); ?>
        <?php x_portfolio_item_social(); ?>



        <?php // Here is the sidebar ?>
        <?php get_sidebar(); ?>


        
      </div>

    <?php endif; ?>

  </div>
</article>

3] Save the file named as content-portfolio.php
4] Upload this file to your server in the child theme’s folder wp-content/themes/x-child/framework/views/renew/

5] If the sidebar still does not display, please add the following code in your child theme’s functions.php file

// Custom Portfolio Layout
// =============================================================================
if ( ! function_exists( 'x_get_content_layout' ) ) :
  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 = 'content-sidebar';
      } 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;
    }

    return $layout;

  }
endif;
// =============================================================================

We would love to know if this has worked for you. Thank you.

We’re making progress. Just need to fix the spacing on that somehow. I tried a few things but couldn’t figure it out…

What do I do to make that look better?

I tried setting the width of that sidebar element to 100% but that messes up the Blog sidebar and puts it beneath the content.

Hello Matt,

It may seem that all of my suggestions were not being applied to your site? To save us time, please provide us access to site so that we can apply it and be able to display your sidebar in your portfolio item right underneath the extra section area. Please provide us the url of your site with login credentials so we can take a closer look.
To do this, you can create a secure note with the following info:
– Link to your site
– WordPress Admin username / password

To know how to create a secure note, please check this out: https://theme.co/apex/forum/t/how-to-get-support/288

Thank you.

See my above secure note attached to my post from earlier.

Hi Matt,

Thanks for reaching out.

The CSS should be this

.single-x-portfolio .x-sidebar  {
width: 100%;
}

It will not affect other pages sidebar.

Thanks!

Thanks. Got it all working. Really appreciate the help.

You’re most welcome!

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