Change language in Portfolio Meta in Themify and Polylang

Spice Grafix portfolio meta en

On this page I have chosen to have two languages, Swedish and English. I have used the Polylang plugin for translation and Themify Portfolio post to present my projects. But I’ve always thought it’s 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 plugin Polylang for translation. Then you need a child theme. In this example I have used English and Swedish.

  • The first thing you have to do is copy the portfolio-meta.php file from the folder (wp-content/themes/themify-ultra/includes/).
  • Create a folder in your child theme folder called includes and paste the portfolio-meta.php file in 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 above code 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 explanations:

Spice Grafix portfolio meta changed en

Save the file in (wp-content/themes/your-childtheme-name/includes) – folder as portfolio-meta.php. Everywhere where it says ”your-childtheme-name”, you change it to the name of your child theme, of course.

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

If you have any questions, leave a comment below.