Tagged: x
-
AuthorPosts
-
January 24, 2017 at 4:01 am #1342832
FreshnousParticipantHi
Im hoping you can provide details of how to Add a sidebar to portfolio page (which list recent portfolios)
Many thanks
January 24, 2017 at 4:01 am #1342833
FreshnousParticipantThis reply has been marked as private.January 24, 2017 at 6:01 am #1342957
LelyModeratorHello There,
Thanks for posting in. The link you have share is a single portfolio page. But then on initial post you said it portfolio page that list portfolios. To clarify where exactly do you want to add sidebar? Is it just on single portfolio item? or just portfolio listing page? or both? On Appearance > Customize > Layout and Design > Content Layout: We cant choose content with sidebar here. That settings will give you sidebar on portfolio listing page, single portfolio item page, blog index page, post pages and archive pages too. If the sidebar you want to achieve is specific please clarify so we can help you better.
January 24, 2017 at 7:40 am #1343085
FreshnousParticipantApologies
I meant have a sidebar on the single portfolio page. I would like the sidebar to list the recent portfolios.
Thanks
January 24, 2017 at 9:50 am #1343282
ThaiModeratorHi There,
Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
Then navigate to your child theme’s /framework/views/integrity directory create a file named content-portfolio.php and paste the code below:<?php // ============================================================================= // VIEWS/INTEGRITY/CONTENT-PORTFOLIO.PHP // ----------------------------------------------------------------------------- // Portfolio post output for Integrity. // ============================================================================= $archive_share = x_get_option( 'x_integrity_portfolio_archive_post_sharing_enable' ); ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="entry-featured"> <?php x_portfolio_item_featured_content(); ?> </div> <div class="entry-wrap cf"> <?php if ( x_is_portfolio_item() ) : ?> <div class="entry-info"> <header class="entry-header"> <h1 class="entry-title entry-title-portfolio"><?php the_title(); ?></h1> <?php x_integrity_entry_meta(); ?> </header> <?php x_get_view( 'global', '_content', 'the-content' ); ?> </div> <div class="entry-extra thai"> <?php x_portfolio_item_tags(); ?> <?php x_portfolio_item_project_link(); ?> <?php x_portfolio_item_social(); ?> <?php get_sidebar(); ?> </div> <?php else : ?> <header class="entry-header"> <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> <?php if ( $archive_share == '1' ) : ?> <?php x_portfolio_item_social(); ?> <?php endif; ?> </header> <?php endif; ?> </div> </article>After that 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 = '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; }Then add the following under Customizer > Custom > Global CSS:
.single-x-portfolio .x-sidebar.right { width: 100%; margin-top: 25px; }Hope it helps 🙂
January 26, 2017 at 6:37 am #1346220
FreshnousParticipantHi Thanks
I shall do this.
Cant I add it to my functions php file rather then the one above which I dont seem to have in my child theme?
January 26, 2017 at 7:59 am #1346307
LelyModeratorHello There,
Each code should be added on the file that was indicated. This folder: /framework/views/integrity is not accessible on your wordpress admin. But you have those folder on your child theme. You can access these using FTP like Filezilla or WinSCP. You can find it on this folder wordpress-installation-folder/wp-content/themes/x-child.
Hope this helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1342832 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
