Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter sameh.serag

    (@samehserag)

    Thanks a lot Tim for your help.

    I already did debugging for the path but not with this hook. I tried it relative and absolute (in my hook)

    Now It’s working! i debugged it in your hook and get the right path now

    Thanks again for your help

    Thread Starter sameh.serag

    (@samehserag)

    I established my plugin without existing of translation files. My plugin is just file called wp-kildo.php contain this code

    <?php
    /*
      Plugin Name: wp kildo
      Description: wp kildo
      Version: 1.0
      Text Domain: wp-kildo
      License: GPL
     */
    
    if (!defined('ABSPATH')) {
        exit; // Exit if accessed directly
    }
    
    define('wp_kildo_PLUGIN_URL', plugin_dir_url(__FILE__));
    define('wp_kildo_PLUGIN_PATH', plugin_dir_path(__FILE__));
    
    //create 'wp-kildo' custom post type
    add_action('init', 'wp_kildo_init');
    function wp_kildo_init() {
        $labels = array(
            'name' => __('Kildo', 'wp-kildo'),
            'singular_name' => __('Kildo', 'wp-kildo'),
            'menu_name' => __(' Kildo', 'wp-kildo'),
            'name_admin_bar' => __('Kildo', 'wp-kildo'),
            'add_new' => __('Add New Kildo', 'wp-kildo'),
            'add_new_item' => __('Add New Kildo', 'wp-kildo'),
            'new_item' => __('New Kildo', 'wp-kildo'),
            'edit_item' => __('Edit Kildo', 'wp-kildo'),
            'view_item' => __('View Kildo', 'wp-kildo'),
            'all_items' => __('Kildo List', 'wp-kildo'),
            'search_items' => __('Search Kildo', 'wp-kildo'),
            'parent_item_colon' => __('Kildo Kildo:', 'wp-kildo'),
            'not_found' => __('No Kildo found.', 'wp-kildo'),
            'not_found_in_trash' => __('No Kildo found in Trash.', 'wp-kildo')
        );
    
        $args = array(
            'labels' => $labels,
            'description' => __('Description.', 'wp-kildo'),
            'public' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'query_var' => true,
            'rewrite' => array('slug' => 'wp-kildo'),
            'capability_type' => 'post',
            'has_archive' => true,
            'hierarchical' => false,
            'menu_position' => null,
            'menu_icon' => "dashicons-location-alt",
            'supports' => array('thumbnail')
        );
    
        register_post_type('wp-kildo', $args);
    }
    
    // Load translation files if exists
    add_action( 'plugins_loaded', 'wp_kildo_load_plugin_textdomain' );
    function wp_kildo_load_plugin_textdomain() {
        load_plugin_textdomain( 'wp-kildo', false, wp_kildo_PLUGIN_URL );
    }

    After installing the plugin i use your loco plugin to create translation files (Spanish) and i added translation to spanish and save.

    But nothing appeared in spanish for my plugin.

    You can install these code and test as you wish.
    I hope you can find the issue

    Thanks in advance

    Thread Starter sameh.serag

    (@samehserag)

    Yes it looked at the correct path

    Thread Starter sameh.serag

    (@samehserag)

    Thanks for your reply

    Sorry it’s a mistake while coping the code to test plugin to simplify the plugin code

    It should be wp-kildo_PLUGIN_URL instead of STORE_LOCATOR_PLUGIN_URL
    It should all hyphen not underscore as in example files.

    Also i tried relative path and absolute path for function “load_plugin_textdomain”

    Thanks in advance

    Thread Starter sameh.serag

    (@samehserag)

    And here is sample of my plugin just to test translation
    https://drive.google.com/file/d/0B0LLr-wdE_T6TlRTUE5MUVlkV0U/view?usp=sharing

    Thanks in advance

    Thread Starter sameh.serag

    (@samehserag)

    Yes Tim, it’s created
    wp_kildo-es_ES.mo and wp_kildo-es_ES.po under <DomainPath>/languages/

    And i am loading it like that

    // Load translation files
    add_action( ‘plugins_loaded’, ‘wp_kildo_load_plugin_textdomain’ );
    function wp_kildo_load_plugin_textdomain() {
    load_plugin_textdomain( ‘wp_kildo’, false, plugin_dir_url(__FILE__) . ‘/languages’ );
    }

    Can you please post a screenshots of the plugin to ba able to see the interface and how it’s work before i try the plugin on my website.
    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)