Need to Add a Portfolio Menu

I have multiple categories set up in my portfolio. These correspond to pages in my physical, paper portfolio. Being that there’s no arrows set up for ‘previous / next’ navigation, I need a way for people to get back to the root level of the category they’re currently in.

I need a menu in the sidebar of each portfolio item. I have the portfolio set to global view, which gives me a sidebar. This sidebar only has a tags list (which I like) and share icons (which I couldn’t care less about) I want to add a menu, which I’ve already created and added to the category pages, to each portfolio item. Please help.

The top-level page of the portfolio is

http://nicschultz.com/cliffkeen/

Thanks in advance for your assistance.

Hello There,

Thanks for writing in!

Since the child theme is set up, please add the following code in your child theme’s functions.php file

// Custom Output Portfolio Item Tags with Custom Menu
// =============================================================================

function x_portfolio_item_tags() {

  // your custom menu here ?>

  <ul class="x-ul-icons">
      <li class="x-li-icon"><a href="#"><i class="x-icon-chevron-right" data-x-icon="&#xf054;"></i> Menu item 1</a></li>
      <li class="x-li-icon"><a href="#"><i class="x-icon-chevron-right" data-x-icon="&#xf054;"></i> Menu item 2</a></li>
      <li class="x-li-icon"><a href="#"><i class="x-icon-chevron-right" data-x-icon="&#xf054;"></i> Menu item 3</a></li>
  </ul>


<?php

  $stack     = x_get_stack();
  $tag_title = x_get_option( 'x_portfolio_tag_title' );

  if ( has_term( NULL, 'portfolio-tag', NULL ) ) :

    echo '<h2 class="h-extra skills">' . $tag_title . '</h2>';
    call_user_func( 'x_' . $stack . '_portfolio_tags');

  endif;

}

Feel free to add your menu item and its links to specific pages. You can even add your own menu code in the code above.

We would loved to know if this has work for you. Thank you.

That looks good, but I’d rather not have to hard code my menu into the php. Is there a way to use the menu I’ve already setup, from the ‘appearance > menu’ section? Can we just set up a new display location for it?

Hello There,

You can replace the menu with this line:

<?php wp_nav_menu(); ?>

This will display a menu you have created in Appearance > Menus. For full details, you can check this codex out: <?php wp_nav_menu(); ?>

Please understand that this is customization, so once the menu is displayed, you will still need to style it. Or you also need to use custom css to display the menu nicely.

Hope this helps.

When I add the code you provided, each portfolio item displays the following error:

Fatal error: Cannot redeclare x_portfolio_item_tags() (previously declared in /home/content/29/2714929/html/wp-content/themes/x-child/functions.php:41) in /home/content/29/2714929/html/wp-content/themes/x/framework/functions/global/portfolio.php on line 266

Hi,

Sorry, please change the function name.

eg.

// Custom Output Portfolio Item Tags with Custom Menu
// =============================================================================

function my_portfolio_item_tags() {

  // your custom menu here ?>

  <ul class="x-ul-icons">
      <li class="x-li-icon"><a href="#"><i class="x-icon-chevron-right" data-x-icon="&#xf054;"></i> Menu item 1</a></li>
      <li class="x-li-icon"><a href="#"><i class="x-icon-chevron-right" data-x-icon="&#xf054;"></i> Menu item 2</a></li>
      <li class="x-li-icon"><a href="#"><i class="x-icon-chevron-right" data-x-icon="&#xf054;"></i> Menu item 3</a></li>
  </ul>


<?php

  $stack     = x_get_stack();
  $tag_title = x_get_option( 'x_portfolio_tag_title' );

  if ( has_term( NULL, 'portfolio-tag', NULL ) ) :

    echo '<h2 class="h-extra skills">' . $tag_title . '</h2>';
    call_user_func( 'x_' . $stack . '_portfolio_tags');

  endif;

}

Then copy the file framework/views/{STACK}/content-portfolio.php to your child theme on the same path
x-child/framework/views/{STACK}/content-portfolio.php and change this line <?php x_portfolio_item_tags(); ?> to
<?php my_portfolio_item_tags(); ?>

Hope that helps.

Great, that works! Thanks.

I’m not sure how it knew to use the correct menu, as there was no display location set up. It still says the theme only supports two menu locations. But it’s in there, so I guess I shouldn’t overthink it.

Now I just have to style it to fit in.

You are most welcome. :slight_smile:

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