Changing Framework for Portfolio

I’d like to make my portfolio alphabetical. I’ve found the code to do this through the forum, as the question has been asked before.

However. I don’ t know where to go inside the Dashboard to edit the .php framework. I can’t seem to find the portfolio related page. Could you tell me how to get to the page where I can insert that code?

Thanks!

Hello There,

Thanks for writing in! Because what you are trying to accomplish requires a template customization, we would highly to suggest that you use 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.

Once you have your child theme active and ready, please follow the following 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/GLOBAL/_PORTFOLIO.PHP
// -----------------------------------------------------------------------------
// Includes the portfolio output.
// =============================================================================

$stack    = x_get_stack();
$entry_id = get_the_ID();

global $sitepress;

if ( function_exists( 'icl_object_id' ) && is_callable( array( $sitepress, 'get_current_language' ) ) ) {
	$wpml_post = get_post( icl_object_id( $entry_id, 'page', false, $sitepress->get_current_language() ) );
	$entry_id = $wpml_post->ID;
}

$paged    = ( is_front_page() ) ? get_query_var( 'page' ) : ( ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1 );
$cols     = get_post_meta( $entry_id, '_x_portfolio_columns', true );
$count    = get_post_meta( $entry_id, '_x_portfolio_posts_per_page', true );
$filters  = get_post_meta( $entry_id, '_x_portfolio_category_filters', true );

switch ( $cols ) {
  case 'One'   : $cols = 1; break;
  case 'Two'   : $cols = 2; break;
  case 'Three' : $cols = 3; break;
  case 'Four'  : $cols = 4; break;
}

?>

<?php x_get_view( 'global', '_script', 'isotope-portfolio' ); ?>

<div id="x-iso-container" class="x-iso-container x-iso-container-portfolio cols-<?php echo $cols; ?>">

  <?php

  if ( count( $filters ) == 1 && in_array( 'All Categories', $filters ) ) {

    $args = array(
      'post_type'      => 'x-portfolio',
      'posts_per_page' => $count,
      'paged'          => $paged,
      'order'		   => 'ASC',
      'orderby'        => 'title'
    );

  } else {

    $args = array(
      'post_type'      => 'x-portfolio',
      'posts_per_page' => $count,
      'paged'          => $paged,
      'order'		   => 'ASC',
      'orderby'        => 'title'
      'tax_query'      => array(
        array(
          'taxonomy' => 'portfolio-category',
          'field'    => 'term_id',
          'terms'    => $filters
        )
      )
    );

  }

  $wp_query = new WP_Query( $args );

  ?>

  <?php if ( $wp_query->have_posts() ) : ?>
    <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
      <?php if ( $stack != 'ethos' ) : ?>
        <?php x_get_view( $stack, 'content', 'portfolio' ); ?>
      <?php else : ?>
        <?php x_ethos_entry_cover( 'main-content' ); ?>
      <?php endif; ?>
    <?php endwhile; ?>
  <?php endif; ?>

</div>

<?php pagenavi(); ?>
<?php wp_reset_query(); ?>

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

You will need to create the folder names because it does not exist in your child theme yet.

Hope this helps. Please let us know how it goes.

Thanks for your help and clear instructions.

So I followed all of those steps, but now nothing is appearing on my portfolio page (ie. none of the items are populating). Help!

The only folder I had to create was the ‘global’ one under ‘view’ - could I have messed something up here? Was I supposed to copy the path from the x theme (because right now it isn’t associated to a stack), and if so, there isn’t a global folder under: /home/lake3180275962/html/wp-content/themes/x/framework/views

This is the page: http://lakecountryartwalk.org/artists/#

Hi There,

The file should be on this folder: /home/lake3180275962/html/wp-content/themes/x-child/framework/views/global/. Make sure that folder names are correct. If that is settled and still having issue, would you mind providing us with login credentials so we can take a closer look? Please provide following information:

Set it as Secure Note

  • Link to your site
  • WordPress Admin username / password
  • FTP credentials

All the best!

HI Lely,

I’m still having issues, if you can have a look, I would appreciate it!

@Lely - a couple more things - if I remove the file from the folder, I can then see the categories, but still can’t see the individual listings.

My goal is to have them sort alphabetical, but I do also want them to fill the page (ie. not have a limit to the number listed by page) - is this possible to do in the same .php file? Thanks

Hi,

Sorry, there is a missing comma in the code we provided.

I went ahead and fix it.

Kindly check in your end.

Thanks