0

When I use Joomla I can change a core string using the language files. So where it would say "Cart" you would go into the language file and change it to what you want it to say.

I want to be able to do this for one of our client's websites which uses WordPress. Is this possible? I am using the wpex-adapt theme.

The exact bit I want to change is on the Portfolio page on the individual item page where it says "newer" and "older" which I want to change to "previous" and "next".

Any suggestions will be greatly appreciated.

2 Answers 2

0

This really depends on how your theme has been built, some themes supply a "Translations" file where you can edit most strings. These are usually .po files and can be found in the translations folder within your theme.

If that doesn't help out I would suggest grepping for the string you want to change, and manually editing the files then uploading them to the server.

5
  • I found a file called "en_US.po" but the words I want to change are not in there. What do you mean by "grepping"?
    – Jim Leeder
    Commented Feb 27, 2015 at 16:21
  • There is a tool called grep that allows you to search for strings within files, if you're on Windows you could use wingrep. Basically download the wp-content folder through FTP (or just the theme folder) then search for the string Newer or a class in the surrounding html. Really you can search for anything that would uniquely identify that piece of code. Then edit the file to what you would like to be and replace it on the FTP. Commented Feb 27, 2015 at 16:28
  • I downloaded the Grep tool and searched for "newer". In two files it has this code - "<?php next_post_link('<div id="single-nav-left">%link</div>', '<span class="fa fa-chevron-left"></span> '.__('Newer','wpex').'', false); ?> <?php previous_post_link('<div id="single-nav-right">%link</div>', ''.__('Older','wpex').' <span class="fa fa-chevron-right"></span>', false); ?>" - Should I change where it says "Older" and "Newer" or will it not work?
    – Jim Leeder
    Commented Mar 2, 2015 at 9:51
  • Yep, give it a shot!! If you're worried, take a back up. Commented Mar 2, 2015 at 9:52
  • No problem, take heed of what @vancoder said though, a theme update will overwrite your changes if you are not using a child theme. Commented Mar 2, 2015 at 10:04
0

Changing the code directly in your theme is a bad idea. What happens when that theme is next updated? Your changes are over-written.

If the theme is a decent one, it will have been written in such a way as to allow Child Themes. Build one, with the only deviation from the parent being the file with the buttons.

Alternatively, this is something you can probably achieve with JavaScript and CSS, which you could safely house inside a functionality plugin.

2
  • So from what you're saying, if the theme is updated then will the changes I make to style.css be overwritten?
    – Jim Leeder
    Commented Mar 2, 2015 at 9:41
  • Correct. This is why child themes exist.
    – vancoder
    Commented Mar 2, 2015 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.