Skip to content

Instantly share code, notes, and snippets.

@ambdk
Forked from sareiodata/empty-wp-plugin.php
Created August 30, 2020 07:11
Show Gist options
  • Select an option

  • Save ambdk/bd126e2ddd97cb0a5361488f8f45fea8 to your computer and use it in GitHub Desktop.

Select an option

Save ambdk/bd126e2ddd97cb0a5361488f8f45fea8 to your computer and use it in GitHub Desktop.
Empty WordPress plugin
<?php
/**
* Plugin Name: Name Of The Plugin
* Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
* Description: A brief description of the Plugin.
* Version: The Plugin's Version Number, e.g.: 1.0
* Author: Name Of The Plugin Author
* Author URI: http://URI_Of_The_Plugin_Author
* License: A "Slug" license name e.g. GPL2
*/
/* Copyright YEAR PLUGIN_AUTHOR_NAME (email : PLUGIN AUTHOR EMAIL)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// Start writing code after this line!
/**
* Change flags folder path for certain languages.
*
* Add the language codes you wish to replace in the list below.
* Make sure you place your desired flags in a folder called "flags" next to this file.
* Make sure the file names for the flags are identical with the ones in the original folder located at 'plugins/translatepress/assets/images/flags/'.
* If you wish to change the file names, use filter trp_flag_file_name .
*
*/
add_filter( 'trp_flags_path', 'trpc_flags_path', 10, 2 );
function trpc_flags_path( $original_flags_path, $language_code ){
// only change the folder path for the following languages:
$languages_with_custom_flags = array( 'en_US', 'es_ES' );
if ( in_array( $language_code, $languages_with_custom_flags ) ) {
return plugin_dir_url( __FILE__ ) . '/flags/' ;
}else{
return $original_flags_path;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment