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
//unset Storefront templates | |
function theme_name_disable_page_template($post_templates, $theme, $post, $post_type) | |
{ | |
unset($post_templates['template-fullwidth.php']); | |
unset($post_templates['template-homepage.php']); | |
return $post_templates; | |
} | |
add_filter('theme_templates', 'theme_name_disable_page_template', 10, 4); |
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
//convert string to a slug | |
function get_slug_from_string($atts, $content = '') | |
{ | |
extract(shortcode_atts(array( | |
'text' => '' | |
), $atts)); | |
$slug = strtolower($text); | |
$slug = str_replace(' ', '-', $slug); | |
// replace special chars |
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
//blockquote source shortcode | |
function bs_quote_source_shortcode($atts, $content, $tag){ | |
$output = '<span class="source">' . $content . '</span>'; | |
return $output; | |
} | |
add_shortcode('source','bs_quote_source_shortcode'); |
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
//remove some widget areas | |
function lt_remove_some_widget_areas(){ | |
// Unregister some of the TwentyTen sidebars | |
unregister_sidebar( 'footer-1' ); | |
unregister_sidebar( 'footer-2' ); | |
unregister_sidebar( 'footer-3' ); | |
unregister_sidebar( 'footer-4' ); | |
} | |
add_action( 'widgets_init', 'lt_remove_some_widget_areas', 11 ); |
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
ul { | |
list-style: none; | |
li::before { | |
content: "\2022"; /* Add content: \2022 is the CSS Code/unicode for a bullet */ | |
color: red; /* Change the color */ | |
font-weight: bold; /* If you want it to be bold */ | |
display: inline-block; /* Needed to add space between the bullet and the text */ | |
width: 20px; /* Also needed for space (tweak if needed) */ | |
margin-left: -2px; /* Also needed for space (tweak if needed) */ | |
} |
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
add_action( 'pmxi_saved_post', 'post_saved', 10, 1 ); | |
function post_saved( $id ) { | |
$comma_values = get_post_meta($id, 'my_custom_field', true); | |
$explode_comma_values = explode( ',', $comma_values ); | |
delete_post_meta( $id, 'my_custom_field', $comma_values ); //Clear custom field first | |
foreach($explode_comma_values as $v){ | |
add_post_meta( $id, 'my_custom_field', $v ); | |
} | |
} |
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
add_shortcode('isbn-13to10', 'ISBN13toISBN10_shortcode'); | |
// Converts ISBN-13 to ISBN-10 | |
// Leaves ISBN-10 numbers (or anything else not matching 13 consecutive numbers) alone | |
function ISBN13toISBN10_shortcode($atts) { | |
extract( shortcode_atts( array( | |
'isbn' => '' | |
), $atts ) ); | |
if (preg_match('/^\d{3}(\d{9})\d$/', $isbn, $m)) { | |
$sequence = $m[1]; | |
$sum = 0; |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
/* portrait */ | |
@media screen and (orientation:portrait) { | |
/* portrait-specific styles */ | |
} | |
/* landscape */ | |
@media screen and (orientation:landscape) { | |
/* landscape-specific styles */ | |
} |
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
html { | |
font-size: 62.5%; | |
} | |
body { | |
font: 1.6em/1.4 'Roboto', sans-serif; | |
} | |
NewerOlder