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
// --------------------------------------------------------- | |
// ---------- WordPress functions.php boilerplate ---------- | |
// --------------------------------------------------------- | |
<?php | |
// ---------------------------------------------------------------------------- | |
// ---------- Translations can be filed in the /languages/ directory ---------- | |
// ---------------------------------------------------------------------------- | |
load_theme_textdomain( 'html5reset', TEMPLATEPATH . '/languages' ); |
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
// ---------------------------------------------- | |
// ---------- Create custom taxonomies ---------- | |
// ---------------------------------------------- | |
<?php | |
function custom_taxonomies() { | |
register_taxonomy('collection', 'post', array( | |
'hierarchical' => true, | |
'label' => 'Collections', | |
'query_var' => true, | |
'rewrite' => true |
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 customer user fields in wp admin ---------- | |
// ---------------------------------------------------------- | |
<?php | |
function modify_contactmethods( $contactmethods ) { | |
// Remove unwanted fields // | |
unset($contactmethods['aim']); | |
unset($contactmethods['yim']); | |
unset($contactmethods['jabber']); | |
// Add new fields // |
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
// ------------------------------------------------------------------- | |
// ---------- Change default [...] string for post excerpts ---------- | |
// ------------------------------------------------------------------- | |
<?php | |
function new_excerpt_more($more) { | |
return '{...}'; | |
} | |
add_filter('excerpt_more', 'new_excerpt_more'); | |
?> |
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
// -------------------------------------------------- | |
// ---------- Create custom loop shortcode ---------- | |
// -------------------------------------------------- | |
// usage: [loop cat="17" posts_per_page="6" ] | |
// -------------------------------------------------- | |
<?php | |
add_shortcode('loop', 'shortcode_query'); | |
function shortcode_query($atts, $content){ | |
extract(shortcode_atts(array( // a few default values. more query params at http://codex.wordpress.org/Class_Reference/WP_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
// ------------------------------------------------------------------------------ | |
// ---------- Remove the paragraph wrapper on the category description ---------- | |
// ------------------------------------------------------------------------------ | |
<?php | |
remove_filter('term_description','wpautop'); | |
?> |
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 | |
for($i=0; $i<10; $i++) { | |
include("file.php"); | |
} | |
?> |
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 | |
$i=0; | |
while($i<10) { | |
include("test.php"); | |
$i++; | |
} | |
?> |
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
// If "i" is equal to 10, break out of the loop and ignore the echo statement below. | |
<?php | |
for($i=0; $i<=10; $i++) { | |
echo $i; | |
if($i==10) { | |
break; | |
} | |
echo ", "; | |
} |
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
// If "i" is equal to 5, skip the echo statement below and continue evaluating the condition. | |
<?php | |
for($i=0; $i<=10; $i++) { | |
echo $i; | |
if($i==10) { | |
continue; | |
} | |
echo ", "; | |
} |
OlderNewer