Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1025103
    vendinimarketing
    Participant

    Hi!

    I’m wondering if there’s a way to add content inputs to the “Portfolio Item” pages? The ability to set a custom project link for each item is great and I would really like to be able to do that with the rest of the sidebar area.

    Specifically, I need to edit the Launch Project h2 text and the CTA button text for each item. I know I can edit these for all item pages in the “Customize” area, but some CTAs lead to videos or .pdf downloads or other types of resources and one global CTA doesn’t work for all cases.

    An example of one of my item pages: http://vendini.com/resources/the-villages-entertainment

    Is there a way to edit the template’s php to add more editable fields? I’ve included a screenshot of where I would like these fields to appear.

    Thanks so much for any direction you can give!
    Cheers,
    Joan

    #1025457
    Nabeel A
    Moderator

    Hi Joan,

    Thanks for writing in! Please refer to the following thread https://community.theme.co/forums/topic/portfolio-right-side-customization/

    Hope this helps!

    #1028436
    vendinimarketing
    Participant

    Thanks so much for pointing me to that thread! The ability to add text is awesome.

    Is there a way I can edit the text that’s already showing up dynamically? For example, can I create a custom field that would edit the button text of the project link? I’ve set the global button text to be “Get It!”, but if I wanted the button on a specific page to say “Watch It!”, what would the code look like for that?

    Thanks!

    #1029194
    Lely
    Moderator

    Hi Joan,

    That would need a little more customization. Please add the following code on your child theme’s functions.php file:

    
    // Output Portfolio Item Project Link
    // =============================================================================
    
    function x_portfolio_item_project_link() {
    
      $project_link  = get_post_meta( get_the_ID(), '_x_portfolio_project_link', true );
      $launch_title  = x_get_option( 'x_portfolio_launch_project_title' );
      if(is_single(5)){ // Custom Button Text
      $launch_button = 'Watch it';
      }else{
      $launch_button = x_get_option( 'x_portfolio_launch_project_button_text' );
      }
      if ( $project_link ) :
    
      ?>
    
      <h2 class="h-extra launch"><?php echo $launch_title; ?></h2>
      <a href="<?php echo $project_link; ?>" title="<?php echo $launch_button; ?>" class="x-btn x-btn-block" target="_blank"><?php echo $launch_button; ?></a>
    
      <?php
    
      endif;
    
    }
    

    Check this line if(is_single(5)){ from above. Change 5 to your own portfolio ID where you want to use Watch it.

    Further customizations from here would be getting into custom development, which is outside the scope of support we can offer. If you need more in depth changes, you may wish to consult with a developer. X is quite extensible with child themes, so there are plenty of possibilities. Thanks for understanding.

    #1030856
    vendinimarketing
    Participant

    I totally understand about the future customizations and thanks for providing the above code snippet!

    I’m having trouble adding it however…when I add it to my child theme’s function.php file, half the time it pulls up the single portfolio page correctly and half the time I get a fatal error message.

    The message says “Fatal error: cannot redeclare x_portfolio_item_project_link() (previously declared …/wp-content/themes/x-child/functions.php:176) in /wp-content/x/framework/functions/global/portfolio.php on line 243”

    Am I missing something? I removed the code for now as I don’t want people getting an error message half the time. I’ve included a screenshot of the error message below.

    Also, is it possible to use a body class of some kind instead of the portfolio ID so I don’t have to adjust the functions.php file every time I add a new portfolio item that needs the alternate text?

    Thanks so much!

    #1031631
    Paul R
    Moderator

    Hi,

    Sorry, the x_portfolio_item_project_link function can’t be overridden in your child theme’s functions.php

    You will have to edit the function directly in /wp-content/x/framework/functions/global/portfolio.php

    but please note that it will get overwritten on theme update.

    With regards body class, it could be possible with custom development, but this would be outside the scope of support we can offer. You may wish to consult a developer to assist you with this. Thanks

  • <script> jQuery(function($){ $("#no-reply-1025103 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>