Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1083665
    luxmedesigner
    Participant

    Hi there,

    I use the Project Link to invite people to get a quote. It works fine for English, but when I add the link to the Spanish translation, which includes “/?lang=es”, it removes it. I tried multiple times, but it keeps removing the last part of the code. Since both pages are named the same, it’s sending people to the English page, when it’s supposed to the sending them to the Spanish page.

    How can I get it to work properly?

    Thanks!

    #1084178
    Darshana
    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.

    #1084752
    luxmedesigner
    Participant

    Hi there,

    This is one of the pages in Spanish: http://www.tubularchainconveyors.com/portfolio-item/video-brush-stations/?lang=es

    The idea is that the Blue Button (Project Link) goes to the Quote page: http://www.tubularchainconveyors.com/quote/?lang=es

    But, as I explained, when I add the link, the last part is removed (?lang=es) sending the user to the English version instead.

    Let me know if you can figure this one out!

    Thanks!

    #1084885
    Thai
    Moderator

    Hi There,

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link login to your site
    – WordPress Admin username / password

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thanks.

    #1084959
    luxmedesigner
    Participant
    This reply has been marked as private.
    #1085047
    luxmedesigner
    Participant

    BTW: I tried adding a Project Link to this page: http://www.tubularchainconveyors.com/portfolio-item/installation-24/?lang=es

    and in this case, the link is deleted completely. I think the Project Link field, in general, has a problem.

    #1085761
    Friech
    Moderator

    Hi There,

    You can not do that, that has some security concerns. You need to append the parameter ?lang=es on output, not on save.

    Because this requires a template change, I’d advise that you setup 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.

    Then on your child theme navigate to this directory \x-child\framework\views\integrity\ and create a file named content-portfolio.php and paste the code below.

    <?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 x_portfolio_item_project_link2(); ?>
            <?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>

    Then add this on your child theme functions.php file.

    // Output Portfolio Item Project Link
    // =============================================================================
    
    function x_portfolio_item_project_link2() {
    
      $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 (isset($_GET['lang'])) {
       $xlang = '/?lang=' . $_GET['lang'];
      } else {
        $xlang = null;
      }
    
      if ( $project_link ) :
    
      ?>
    
      <h2 class="h-extra launch"><?php echo $launch_title; ?></h2>
      <a href="<?php echo $project_link . $xlang; ?>" title="<?php echo $launch_button; ?>" class="x-btn x-btn-block" target="_blank"><?php echo $launch_button; ?></a>
    
      <?php
    
      endif;
    
    }
    

    Hope it helps, Cheers!

    #1086719
    luxmedesigner
    Participant

    Hi there,

    The child theme already exists. The file content-portfolio.php already exists. I added the code to the functions.php page, but it didn’t work. Not sure what else I can do at this point. Any ideas?

    #1087048
    Jade
    Moderator

    Hi there,

    Would you mind providing your FTP details so that we could check this further? Thank you.

    #1087433
    luxmedesigner
    Participant
    This reply has been marked as private.
    #1087991
    Friech
    Moderator

    Hi There,

    Thanks for the credentials. Are you sure you’re looking on the child theme? I did not see a content-portfolio.php file on /wp-content/themes/x-child/framework/views/integrity/ directory, so I did go ahead and created it.

    And also you did not copy the entire code for functions.php file. I did go ahead and update that as well.

    Your button should work as you want it now.

    Cheers!

    #1088383
    luxmedesigner
    Participant

    Hi there,

    Yeah, I installed the X child-theme and have been working on it from the beginning. That is so weird!

    Anyway, I checked and the language code at the end is now appearing, so thank you so much!

    I supposed this will work for any additional languages we add in the future, correct?

    Cheers!

    #1088387
    luxmedesigner
    Participant

    FYI: This is a screenshot of the FTP configuration and the file is there. Not sure why you didn’t see it. I’m still confused!

    Thanks again!

    #1089069
    Friech
    Moderator

    Hi There,

    Yes, it should work with the future language you added assuming you implement it the same way as the Spanish.

    I think you are looking on a different site files. Here’s what I have and the content-portfolio.php is the one I’ve added.


    screenshot

    However, I saw the function I’ve given on the child theme’s functions.php file so yeah that is weird. Please contact your hosting support and ask them which files are for which site, they can help you better on this matter.

    Thanks.

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