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 | |
/** | |
* WordPress shortcode for e-mail link | |
* [email_link address="user@domain.tld" text="E-Mail me!"] | |
* | |
* @param address (required) E-Mail address | |
* @param text (required) Link text | |
* @param before (optional) HTML to go before the <a> tag | |
* @param after (optional) HTML to go after the </a> tag | |
* @param before_text (optional) HTML to go before the link text |
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 | |
/* flush all theme modifications; check via get_theme_mods() */ | |
// remove_theme_mods(); | |
/* flush all but menus */ | |
// remove_theme_mod('header_textcolor'); | |
// remove_theme_mod('background_color'); | |
// remove_theme_mod('background_image'); | |
// remove_theme_mod('background_position_x'); | |
// remove_theme_mod('background_attachment'); |
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 | |
/* Create an array of data to pass */ | |
$obj = array( | |
'foo' => $foo, | |
'bar' => $bar, | |
'multifoo' => array( 'foo1', 'foo2' ) | |
); | |
/* Enqueue javascript (assuming jQuery has been enqueued already) */ |
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
# Allow direct access to video and image files in a protected directory | |
# Props http://stackoverflow.com/a/9078460?stw=2 | |
<FilesMatch "\.(mp4|ogv|webm|jpg|png)$"> | |
Satisfy any | |
order allow,deny | |
allow from all | |
</FilesMatch> |
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 | |
/** | |
* Removes file version queries from script/stylesheet calls. | |
* http://wordpress.stackexchange.com/a/96325/23011 | |
* | |
* Enhanced to keep query of google font stylesheets: | |
* Removes “?ver=3.5.1” from http://domain.tld/wp-content/themes/theme/stlye.css?ver=3.5.1 | |
* Leaves http://fonts.googleapis.com/css?family=MyFont untouched. | |
*/ | |
add_filter( 'script_loader_src', 'gp130419_remove_script_version', 15, 1 ); |
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
/** | |
* Prepend a selector to the first level of nested selectors. | |
* Comments demonstrate compiled CSS. | |
*/ | |
.foo { | |
/* .foo */ | |
.bar { | |
/* .foo .bar */ | |
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 | |
/** | |
* Dynamic copyright date. | |
* | |
* Dynamic copyright date depending on | |
* when the first post was published on your site. | |
* | |
* Derived from: http://alex.leonard.ie/2010/07/27/wordpress-tip-get-the-date-of-your-first-post/ | |
* | |
*/ |
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 | |
/** | |
* Read first, otherwise the following will make no sense at all: | |
* http://kau-boys.de/1747 | |
* | |
* | |
* WordPress’s built-in conditional comment syntax allows | |
* for conditional comments like this: | |
* | |
* <!--[if gt IE 8]> |
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
<form class="ordering" method="get"> | |
<select name="name"> | |
<option value="value">Option</option> | |
<option value="value">Option</option> | |
<option value="value">Option</option> | |
</select> | |
</form> |
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 | |
/** | |
* Translate text strings in WordPress programmatically. | |
* | |
* Assuming plugin intorduces "Foo_Plugin" class, has text domain "foo-plugin". | |
* | |
* @param mixed $translated | |
* @param mixed $original | |
* @param mixed $domain | |
* @return string |