Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #852613

    abrightdesign
    Participant

    Hi Guys,

    Thank you for this great theme.

    I’ve almost finished my website but there’s one change I’d like to try and make if possible.

    On single portfolio entries I’d like to remove the “share this” box and have my sidebar from my blog running down this side.

    I’ve managed to remove the share this box using the following CSS

    .single-x-portfolio .x-entry-share {
    display: none;
    }

    .x-portfolio .entry-extra {
    display: none;
    }

    But from searching around it seems I need to edit the PHP in a child theme to add the sidebar. I’ve just installed the X premade child theme but I’m not sure what alternations I need to make now. Could you please help out?

    The stack I’m using is renew.

    Thank you πŸ™‚

    #852906

    Rad
    Moderator

    Hi there,

    Thanks for writing in.

    Sure, that’s possible. Please add this code to your child themes functions.php

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

    This will display a sidebar for all portfolio items, and that would be the main sidebar (default sidebar). If you wish to implement specific sidebar other than the main sidebar, then you can optionally add this code too.

    add_filter( 'ups_sidebar', 'ups_display_sidebar_portfolio_item', 99 );
    
    function ups_display_sidebar_portfolio_item ( $sidebar ) {
    
    return x_is_portfolio_item() ? 'YOUR-SIDEBAR-IDE-HERE' : $sidebar;
    
    }

    Just replace YOUR-SIDEBAR-IDE-HERE with the sidebar’s ID you created at Admin > Appearance > Sidebars.

    Hope this helps.

    #854206

    abrightdesign
    Participant

    Hi there,

    Thanks for your help. unfortunately this does not seem to be working for me.

    I located functions.php and pasted in the code and nothing seems to of changed. I just to be sure that the child theme was activated and it all seems in order.

    I’m trying to just add the default sidebar so I’ve only added your first code. I’ve attached a screenshot to make sure I’ve added this correctly.

    Thanks

    #854222

    Thai
    Moderator

    Hi There,

    In this case, would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link login to your site
    – WordPress Admin username / Password
    – FTP Account

    Don’t forget to select Set as a private reply. This ensures your information is only visible to our staff.

    Thanks.

    #854230

    abrightdesign
    Participant
    This reply has been marked as private.
    #854262

    Thai
    Moderator

    Hi There,

    I was unable to access your website:

    View post on imgur.com

    Could you please double check on it?

    Thank you.

    #854272

    abrightdesign
    Participant
    This reply has been marked as private.
    #854419

    Rad
    Moderator

    Hi there,

    I checked and it’s not really going to work since sidebar are intentionally removed from portfolio single page.

    <?php
    
    // =============================================================================
    // VIEWS/RENEW/WP-SINGLE-X-PORTFOLIO.PHP
    // -----------------------------------------------------------------------------
    // Single portfolio post output for Renew.
    // =============================================================================
    
    ?>
    
    <?php get_header(); ?>
      
      <div class="x-container max width offset">
        <div class="x-main full" role="main">
    
          <?php while ( have_posts() ) : the_post(); ?>
            <?php x_get_view( 'renew', 'content', 'portfolio' ); ?>
            <?php x_get_view( 'global', '_comments-template' ); ?>
          <?php endwhile; ?>
    
        </div>
      </div>
    
    <?php get_footer(); ?>

    If you like to implement a sidebar, then please copy this file \wp-content\themes\x\framework\views\renew\wp-single-x-portfolio.php to your child theme (eg. \wp-content\themes\x-child\framework\views\renew\wp-single-x-portfolio.php)

    Then change its entire code to this,

    <?php
    
    // =============================================================================
    // VIEWS/RENEW/WP-SINGLE-X-PORTFOLIO.PHP
    // -----------------------------------------------------------------------------
    // Single portfolio post output for Renew.
    // =============================================================================
    
    ?>
    
    <?php get_header(); ?>
      
      <div class="x-container max width offset">
        <div class="<?php x_main_content_class(); ?>" role="main">
    
          <?php while ( have_posts() ) : the_post(); ?>
            <?php x_get_view( 'renew', 'content', 'portfolio' ); ?>
            <?php x_get_view( 'global', '_comments-template' ); ?>
          <?php endwhile; ?>
    
        </div>
    
    <?php if ( $fullwidth != 'on' ) : ?>
          <?php get_sidebar(); ?>
        <?php endif; ?>
    
      </div>
    
    <?php get_footer(); ?>

    Hope this helps.