Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1001566
    SMASolutions
    Participant

    I would like to make a very small tweak the portfolio layout; to do so; I’ve copied /framework/functions/global/portfolio.php to the same folder structure in the child theme; but it isn’t getting picked up.

    Any suggestions?

    Thanks

    X Version: 4.4.2
    WP Version: 4.5.2

    #1001602
    SMASolutions
    Participant

    So to help; I dug around already and read https://community.theme.co/kb/customization-best-practices/

    The problem is I’d like to edit the Project Link (I just want to add a class to it so it’ll open in a lightbox).

    I may toy around and add it via javascript; but curiosity has me now and I’d like to know what I’m doing wrong.

    #1001615
    SMASolutions
    Participant

    I’ve tried tossing:

    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' );
      $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;
    
    }

    Into my child theme’s functions.php; but that ruins everything 🙁

    #1001676
    SMASolutions
    Participant

    I’ve added the class via javascript for now; but I’d like to have a better understanding of how I would do this using child functions.php. Thanks.

    #1001805
    Nabeel A
    Moderator

    Hi there,

    Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    #1005102
    SMASolutions
    Participant
    This reply has been marked as private.
    #1005107
    SMASolutions
    Participant
    This reply has been marked as private.
    #1005203
    Paul R
    Moderator

    Hi,

    The functions in portfolio.php cannot be overridden.

    You can create your function.

    eg.

    
    function my_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' );
      $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;
    
    }
    

    Then create file content-portfolio.php in wp-content/themes/x-child/framework/views/integrity
    and copy the code below into that file.

    
    <?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">
            <?php x_portfolio_item_tags(); ?>
            <?php my_portfolio_item_project_link(); ?>
            <?php x_portfolio_item_social(); ?>
          </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>
    

    Notice that I change x_portfolio_item_project_link() with the custom function my_portfolio_item_project_link()

    Hope that helps

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