Skip to content

Instantly share code, notes, and snippets.

@ann71727
Last active October 28, 2017 23:33
Show Gist options
  • Save ann71727/c1028080a7b9f2f28aeb6396f1fe3207 to your computer and use it in GitHub Desktop.
Save ann71727/c1028080a7b9f2f28aeb6396f1fe3207 to your computer and use it in GitHub Desktop.
WordPress Plugin Header
<?php
/*
Plugin Name: Plug Name v123 DEV
Plugin URI: https://v123.tw
Description: 插件簡述
Version: 1.01.0
Author: v123 DEV
Author URI: https://v123.tw
License: GPL2
License URI: https://v123.tw
Text Domain: v123-dev-plug-example
Domain Path: /languages
*/
//Add some links on the plugin page
function plugin_add_settings_link( $links ) {
$link = '<a href="'.esc_url( get_admin_url(null, 'options-general.php?page=gpaisr') ).'">' . __('Settings', 'General') . '</a>';
array_unshift($links,$link);
$link = '<a href="#" target="_blank">Support</a>';
array_push( $links, $link );
return $links;
}
add_filter( "plugin_action_links_".plugin_basename( __FILE__ ), 'plugin_add_settings_link' );
//Add some links on the plugin page
function v123_plugin_row_meta($links, $file) {
if ( $file == plugin_basename(dirname(__FILE__).'/admin.php') ) {
$links[] = '<a href="https://v123.tw">' . esc_html__('Documentation', 'duplicate-post') . '</a>';
$links[] = '<a href="https://v123.tw">' . esc_html__('Donate', 'duplicate-post') . '</a>';
}
return $links;
}
add_filter('plugin_row_meta', 'v123_plugin_row_meta', 10, 2);
/**
* Initialise the internationalisation domain
*/
function v123_post_load_plugin_textdomain() {
load_plugin_textdomain( 'v123-textdomain', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
}
add_action( 'plugins_loaded', 'v123_post_load_plugin_textdomain' );
// textdomain 初始化
function v123_post_load_plugin_textdomain() {
load_plugin_textdomain( 'v123-textdomain', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
}
add_action( 'plugins_loaded', 'v123_post_load_plugin_textdomain' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment