24

I've found that any WordPress theme uses this functions, but I don't understand what is the purpose of it and what is it, in this case 'themify'? Here are some examples in Themify functions.php:

1).

load_theme_textdomain( 'themify', TEMPLATEPATH.'/languages' );

2).

if (function_exists('register_nav_menus')) {
        register_nav_menus( array(
            'main-nav' => __( 'Main Navigation', 'themify' ),
            'footer-nav' => __( 'Footer Navigation', 'themify' ),
        ) );
    }

And in tempate file:

3). <?php _e( 'Sorry, nothing found.', 'themify' ); ?>

And many more! My doubt is what is 'themify' stand for? What is their purpose? Could I Change it or delete it? What is the place, 'themify', for?

0

1 Answer 1

26

In this case, 'themify' is the defined textdomain for the Theme, used to make the Theme translatable. (Codex reference: load_theme_textdomain()).

Making a Theme translation-ready requires a few steps.

  1. Define the Theme's textdomain:

    load_theme_textdomain( 'themify', TEMPLATEPATH.'/languages' );
    
  2. Define translatable strings in the template.

    This is done using one of a few translation functions: __() (for returned strings), _e() (for echoed strings), and _x()/_ex() (for gettext context strings). There are others, but you get the idea...

    A static text string, such as <p>Hello world!</p>, is wrapped in an appropriate translation function, such as <p><?php _e( 'Hello World!', 'themify' ); ?></p>, to make it available for translation.

  3. Generate the .mo/.po files
    reference on how to edit language files

7
  • @SokVanrithy, refer to this Q&A for how to handle .mo/.po files. (Chip, I haven't added the link into your Answer as you may have another recommendation:)
    – brasofilo
    Dec 11, 2012 at 19:51
  • 1
    @brasofilo feel free to add it if you'd like. I think it's out of scope for the question as-asked, but still useful information. Dec 11, 2012 at 19:55
  • Why would you change it? Are you forking the Theme? Dec 12, 2012 at 3:11
  • Yes, I want to get rid of them. I've downloaded a theme from Webdesigndepot, and it calls base theme. I asked the author that would I be able change the orginal codes? They're allowed because it is the base blank theme for whom who wanna have the structure for the custom theme. In addition, it's the present from the author there to give to the reader. My doubt is like above! Dec 12, 2012 at 7:45
  • 1
    Sure, you can get rid of them; but it also doesn't hurt just to leave them. You can even change the textdomain to a different string, to reference your forked Theme. Development best practices include making Themes translatable, so I would advise against removing them entirely. That said, you certainly can, if you choose to. Dec 12, 2012 at 13:20

Your Answer

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

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