This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Activate WordPress Maintenance Mode | |
function wp_maintenance_mode(){ | |
if(!current_user_can('edit_themes') || !is_user_logged_in()){ | |
wp_die('<h1 style="color:red">Website under Maintenance</h1><br />We are performing scheduled maintenance. We will be back online shortly!'); | |
} | |
} | |
add_action('get_header', 'wp_maintenance_mode'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printf( | |
_n( | |
'One comment', | |
'%s comments', | |
get_comments_number(), | |
'sample-plugin' | |
), | |
number_format_i18n( get_comments_number() ) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'http://example.com'; | |
$link = sprintf( __( 'The link to my <a href="%s">website</a>.', 'sample-plugin' ), $url ); | |
echo $link; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="site-info"> | |
<a href="http://wordpress.org/" >< ?php _e( 'Proudly powered by WordPress.', 'sample-plugin' ); ?></a> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
printf( | |
__( 'Your color is %s.', 'sample-plugin' ), | |
$color | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function load_plugin_textdomain() { | |
load_plugin_textdomain( 'sample-plugin', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' ); | |
} | |
add_action( 'plugins_loaded', 'load_plugin_textdomain' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Sample Plugin | |
Plugin URI: http://samplepluginsite.com | |
Description: Sample plugin that's ready for translation | |
Author: John Doe | |
Version: 1.0 | |
Author URI: http://johndoe.com | |
Text Domain: sample-plugin | |
Domain Path: /languages/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fb_opengraph() { | |
global $post; | |
if(is_single()) { | |
if(has_post_thumbnail($post->ID)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doctype_opengraph($output) { | |
return $output . ' | |
xmlns:og="http://opengraphprotocol.org/schema/" | |
xmlns:fb="http://www.facebook.com/2008/fbml"'; | |
} |
NewerOlder