Renew 5, categories in portfolio-item to the right?

Hi,
I’m using the Renew 5 stack. I would like to move the categories in a portfolio-item to the column on the right, above the tags.
Is there an easy way to do this?

Hello @amarseille,

Thanks for writing in!

Can you please share your website portfolio URL. I tried looking at your website but I am not sure about the portfolio page. To check about the changes you are looking to make, I also checked the Renew 5 demo page but I am a bit confused with the changes you looking for. Please share the exact page URL so we can point you in right direction.

Thanks.

Sorry, forgot that it’s a different language :grinning:

This is the url https://www.lijm-lab.nl/site/staging/kunstproject/
Portfolio is called ‘Kunstprojecten’

This is a portfolio item: https://www.lijm-lab.nl/site/staging/kunstproject/water-naar-de-zee-dragen/
I’d like the categories, (gymnasium, in de buurt etc.) above the tags (ontwerpen, techniek op school, etc.).
In a list, like the tags. But without the heading ‘categories’.

In the demo it’s http://demo.theme.co/renew-5/portfolio-item/do-you-droid/
And then i would like the categories (creative, technology) not next to the author, but to the right, above the tags (green, tan)

Hello @amarseille,

Thanks for the URL. Regretfully we cannot check your site because it will ask us to login first.

meanwhile, to achieve what you have in mind, 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 the child theme is set up, please add the following code in your child theme’s functions.php file

// Custom Renew Entry Meta
// =============================================================================

if ( ! function_exists( 'x_renew_entry_meta' ) ) :
  function x_renew_entry_meta() {

    //
    // Author.
    //

    $author = sprintf( '<span>%s</span>',
      get_the_author()
    );


    //
    // Date.
    //

    $date = sprintf( '<span><time class="entry-date" datetime="%1$s">%2$s</time></span>',
      esc_attr( get_the_date( 'c' ) ),
      esc_html( get_the_date() )
    );


    //
    // Categories.
    //

    if ( get_post_type() == 'x-portfolio' ) {
      if ( has_term( '', 'portfolio-category', NULL ) ) {
        $categories        = get_the_terms( get_the_ID(), 'portfolio-category' );
        $separator         = ', ';
        $categories_output = '';
        foreach ( $categories as $category ) {
          $categories_output .= '<a href="'
                              . get_term_link( $category->slug, 'portfolio-category' )
                              . '" title="'
                              . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                              . '"> '
                              . $category->name
                              . '</a>'
                              . $separator;
        }

        $categories_list = sprintf( '<span>%s</span>',
          trim( $categories_output, $separator )
        );
      } else {
        $categories_list = '';
      }
    } else {
      $categories        = get_the_category();
      $separator         = ', ';
      $categories_output = '';
      foreach ( $categories as $category ) {
        $categories_output .= '<a href="'
                            . get_category_link( $category->term_id )
                            . '" title="'
                            . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                            . '">'
                            . $category->name
                            . '</a>'
                            . $separator;
      }

      $categories_list = sprintf( '<span>%s</span>',
        trim( $categories_output, $separator )
      );
    }


    //
    // Comments link.
    //

    if ( comments_open() ) {

      $title  = apply_filters( 'x_entry_meta_comments_title', get_the_title() );
      $link   = apply_filters( 'x_entry_meta_comments_link', get_comments_link() );
      $number = apply_filters( 'x_entry_meta_comments_number', get_comments_number() );


    $text = ( 0 == $number ) ? __( 'Leave a Comment', '__x__' ) : sprintf( _n( '%s Comment', '%s Comments', $number, '__x__' ), $number );


    $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments">%3$s</a></span>',
        esc_url( $link ),
        esc_attr( sprintf( __( 'Leave a comment on: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
        $text
      );

    } else {

      $comments = '';

    }


    //
    // Output.
    //

    if ( x_does_not_need_entry_meta() ) {
      return;
    } else {

      if ( get_post_type() == 'x-portfolio' ) {

        printf( '<p class="p-meta">%1$s%2$s%3$s</p>',
          $author,
          $date,
          $comments
        );

      } else {
        printf( '<p class="p-meta">%1$s%2$s%3$s%4$s</p>',
          $author,
          $date,
          $categories_list,
          $comments
        );
      }

    }

  }
endif;

This code will remove the categories next to the author.

And to display the categories above the tags, 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">
        <h2 class="h-extra skills">Categories</h2>
        <?php
          if ( has_term( '', 'portfolio-category', NULL ) ) {
            $categories        = get_the_terms( get_the_ID(), 'portfolio-category' );
            $separator         = ', ';
            $categories_output = '';
            foreach ( $categories as $category ) {
              $categories_output .= '<a href="'
                                  . get_term_link( $category->slug, 'portfolio-category' )
                                  . '" title="'
                                  . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                                  . '"> '
                                  . $category->name
                                  . '</a>'
                                  . $separator;
            }

            $categories_list = sprintf( '<span>%s</span>',
              trim( $categories_output, $separator )
            );

            echo $categories_list;
          }
        ?>
        <?php x_portfolio_item_tags(); ?>
        <?php x_portfolio_item_project_link(); ?>
        <?php x_portfolio_item_social(); ?>
      </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/

Off course, you will have to create the folder path since it does not exist in your child theme yet.

Please let us know if this works out for you.

Yes, that works fine, thank you very much!

Only, I want to make an unnumbered list, instead of categories separated by comma’s.
I think that’s something I have to do in the css, right?

I’ll just try, if I can’t work it out I’ll be back. Thanks again.

I have an unnumbered list now. No idea what I’m doing, but it looks fine. :grinning:

You’re welcome!
We’re glad we were able to help you out.

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