Change languages ​​on Portfolio Meta in Themify and Polylang

Spice Grafix portfolio meta

On this page I have chosen to have two languages, Swedish and English. I have used the extension Polylang for translation and Themify Portfolio entry to present my projects. But I’ve always found it annoying that portfolio meta at the top of the page is in English, so I decided to change that.

For this to work, you need Themify Ultra as the theme and the extension Polylang. Then you need a child theme.

  • The first thing you need to do is copy the file portfolio-meta.php into the folder (wp-content / themes / themify-ultra / includes / portfolio-meta.php).
  • Create a folder in your child theme called includes and paste porfolio-meta.php there.

The file looks like this:

Spice Grafix portfolio meta original

<div class="project-meta">
<?php if ($client) : ?>
<div class="project-client">
<strong><?php _e('Client', 'themify'); ?></strong>
<?php echo wp_kses_post($client); ?>
</div>
<?php endif; ?>

<?php if ($services) : ?>
<div class="project-services">
<strong><?php _e('Services', 'themify'); ?></strong>
<?php echo wp_kses_post($services); ?>
</div>
<?php endif; ?>

<?php if ($date): ?>
<div class="project-date">
<strong><?php _e('Date', 'themify'); ?></strong>
<?php echo wp_kses_post($date); ?>
</div>
<?php endif; ?>

<?php if ($launch) : ?>
<div class="project-view">
<strong><?php _e('View', 'themify'); ?></strong>
<a href="<?php echo esc_url($launch); ?>"><?php _e('Launch Project', 'themify'); ?></a>
</div>
<?php endif; ?>
</div>
<?php
endif; // $client || $services || $date || $launch ?>

  • Edit the file either directly on the server or download it to your computer and edit. Upload when done.
  • What you need to do is replace the code above with the following:

<div class="project-meta">
<?php if ($client) : ?>
<div class="project-client">
<strong><?php _e(pll_current_language() == "en" ? ' Client' : 'Klient') ;?></strong>
<?php echo wp_kses_post($client); ?>
</div>
<?php endif; ?>

<?php if ($services) : ?>
<div class="project-services">
<strong><?php _e(pll_current_language() == "en" ? ' Services' : 'Tjänster') ; ?></strong>
<?php echo wp_kses_post($services); ?>
</div>
<?php endif; ?>

<?php if ($date): ?>
<div class="project-date">
<strong><?php _e(pll_current_language() == "en" ? ' Date' : 'Datum') ; ?></strong>
<?php echo wp_kses_post($date); ?>
</div>
<?php endif; ?>

<?php if ($launch) : ?>
<div class="project-view">
<strong><?php _e(pll_current_language() == "en" ? ' View' : 'Till Projektet') ; ?></strong>
<a href="<?php echo esc_url($launch); ?>"><?php _e(pll_current_language() == "en" ? ' Launch Project' : 'Till Webbsidan') ; ?></a>
</div>
<?php endif; ?>
</div>
<?php
endif; // $client || $services || $date || $launch ?>

See image below for explanation:

 

Save the file in the (wp-content / themes / name-of-your-child theme / includes) folder as portfolio-meta.php. Wherever it says “name-of-your-child-theme” you replace it with the name of your child-theme, of course.

Now the information will remain even if you update the theme.

If you have any questions, feel free to leave a comment below.