Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4325272
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:14:39+00:00 2026-05-21T09:14:39+00:00

I’ve just built my first plugin for WordPress, and even if it’s not a

  • 0

I’ve just built my first plugin for WordPress, and even if it’s not a great "code poetry" it works as it should. It’s a plugin that transform the default wp gallery using the GalleryView 3.0 jQuery plugin (http://spaceforaname.com/galleryview).

The only thing I’m not able to do is localization.
Localization for this plugin in means translating the admin interface, where someone can configure the jQuery plugin options to change the aspect of the resulting gallery.

I’ve tried to follow the millions of tutorials present on the web, read a lot of posts about this issue on forums and followed the guidelinees of codex… but still with no luck.

this is what I’ve done:

  1. every text line is inside a gettext function ( __ and _e )
  2. using poedit I created the .po and .mo file scanning the plugin directory (everything went ok), then i added translations on that file.
  3. I named the .po file like that NAME-OF-THE-PLUGIN-it_IT.po (the .mo file was generated with the same name)
  4. I’ve put the translations files inside the plugin folder/languages (name of the folder is the same of the plugin and of the translations files)
  5. then I’ve tried to add the load_plugin_textdomain function inside the main plugin file. I’ve tried because there’s no way to get it working.

The only thing on which I’m not sure is the fact that the plugin I’ve created is not under a class+constructor functions… just because I’m still not so good in coding.

But I’ve put the load_plugin_textdomain inside an init add_action, like this:

add_action('init', 'gw_load_translation_file');

function gw_load_translation_file() {
// relative path to WP_PLUGIN_DIR where the translation files will sit:
$plugin_path = dirname(plugin_basename( __FILE__ ) .'/languages' );
load_plugin_textdomain( 'gallery-view-for-wordpress', false, $plugin_path );
}

the lines above are not inside a logic, they are just in the main plugin file, like that.

this is an example of my use of gettext functions:

<h3><?php _e('Panel Options','gallery-view-for-wordpress') ?></h3>

What did I not understand?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T09:14:40+00:00Added an answer on May 21, 2026 at 9:14 am

    My mistake was on language files path declaration.

    this fixed:

    $plugin_path = dirname( plugin_basename( __FILE__ ) ) . '/languages/';
    

    this was wrong:

    $plugin_path = dirname(plugin_basename( __FILE__ ) .'/languages' );
    

    I was answered on WordPress Stack Exchange

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.