View shortcode_in_text_widget
This file contains 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 | |
// To be able to use shortcode in text widget, add this line into functions.php | |
add_filter('widget_text', 'do_shortcode'); | |
?> |
View Easy Download Media Counter
This file contains 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: Easy Download Media Counter | |
Plugin URL: http://remicorson.com | |
Description: This plugin allows you to easily count downloads for a wordpress media and display it | |
Version: 1.0 | |
Author: Rémi Corson | |
Author URI: http://remicorson.com | |
*/ |
View Translation in WordPress
This file contains 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
// String with a variable | |
printf(__("This string contains %d words."), $count); | |
// string with many variables | |
printf(__('Your city is %1$s, and your zip code is %2$s.'), $city, $zipcode); | |
// plural / singular | |
printf(_n("We deleted %d spam message.", "We deleted %d spam messages.", $count), $count); |
View GitHub Gist WP Shortcodes Plugin
This file contains 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: Easy GitHub Gist Shortcodes | |
Plugin URI: http://www.remicorson.com/easy-github-gist-shortcodes | |
Description: Insert easily GitHub Gist within shortcodes this way [gist id="xxxxxx"] | |
Version: 1.0 | |
Author: Remi Corson | |
Author URI: http://www.remicorson.com/ | |
*/ |
View Shortcode outside the loop
This file contains 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
// Just place this line where you want the shortcode to be | |
echo do_shortcode('[shortcode option1="value1" option2="value2"]'); |
View Wordpress selected()
This file contains 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
<!-- Testing the values with if() --> | |
<select name="options[foo]"> | |
<option value="1" <?php if ( $options['foo'] == 1 ) echo 'selected="selected"'; ?>>1</option> | |
<option value="2" <?php if ( $options['foo'] == 2 ) echo 'selected="selected"'; ?>>2</option> | |
<option value="3" <?php if ( $options['foo'] == 3 ) echo 'selected="selected"'; ?>>3</option> | |
</select> | |
<!-- Using selected() instead --> | |
<select name="options[foo]"> | |
<option value="1" <?php selected( $options['foo'], 1 ); ?>>1</option> |
View cpt icon
This file contains 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 | |
/* ------------------------------------------------------------------*/ | |
/* CUSTOM CPTs ICONS */ | |
/* ------------------------------------------------------------------*/ | |
// let's say you custom post type is : portfolio | |
add_action( 'admin_head', 'cpt_icons' ); | |
function cpt_icons() { |
View db-error.php code
This file contains 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 | |
// Tell Search Engine | |
$protocol = $_SERVER["SERVER_PROTOCOL"]; | |
if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) $protocol = 'HTTP/1.0'; | |
header( "$protocol 503 Service Unavailable", true, 503 ); | |
header( 'Content-Type: text/html; charset=utf-8' ); | |
header( 'Retry-After: 600' ); | |
// Get Variables | |
$temp = mysql_error(); |
View Custom CRON interval
This file contains 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
/* ---------------------------------------- | |
* ADD CRON CUSTOM INTERVALS | |
----------------------------------------- */ | |
add_filter('cron_schedules', 'xxx_cron_every_two_days'); | |
// add a cron interval every 2 days | |
function xxx_cron_every_two_days( $schedules ) { | |
$schedules['every_two_days'] = array( | |
'interval' => 172800, // in seconds |
View Device-Pixel-Ratio Media Query
This file contains 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
@media (min--moz-device-pixel-ratio: 1.5), | |
(-o-min-device-pixel-ratio: 3/2), | |
(-webkit-min-device-pixel-ratio: 1.5); | |
(min-resolution: 1.5dppx) { | |
/* your retina rules here */ | |
} |
OlderNewer