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 my_nav_menu_css_class($classes) { | |
| $custom_classes = array(); | |
| foreach($classes as $class) { | |
| if($class=='menu-item') return $custom_classes; | |
| $custom_classes[] = $class; | |
| } | |
| } | |
| function my_nav_menu_css_id($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
| <?php | |
| // Remove links from images on Wordpress posts | |
| add_filter( 'the_content', 'attachment_image_link_remove_filter' ); | |
| function attachment_image_link_remove_filter( $content ) | |
| { | |
| $content = | |
| preg_replace(array( | |
| '{<a(.*?)(wp-att|wp-content/uploads)[^>]*><img}', | |
| '{ wp-image-[0-9]*" /></a>}' |
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 | |
| // Custom excerpt word limit | |
| function excerpt($limit) { | |
| $excerpt = explode(' ', get_the_excerpt(), $limit); | |
| if (count($excerpt)>=$limit) { | |
| array_pop($excerpt); | |
| $excerpt = implode(" ",$excerpt).'...'; | |
| } else { | |
| $excerpt = implode(" ",$excerpt); | |
| } |
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 | |
| if ( is_page('americas') || $post->post_parent == '2348' || ($post->ancestors && in_array( '2348', $post->ancestors) ) ) { | |
| } |
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 | |
| //Custom excerpt class for Wordpress | |
| class Excerpt { | |
| // Default length (by WordPress) | |
| public static $length = 55; | |
| // Default more (by WordPress) | |
| public static $more = '[...]'; |
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 (c) { | |
| c.fn.stickyfloat = function (l) { | |
| var b = this, | |
| f = c(document), | |
| h = parseInt(b.parent().css("padding-top")), | |
| g = b.parent().offset().top, | |
| a, d, i, j, k, e; | |
| a = c.fn.stickyfloat.opts; | |
| c.extend(a, { | |
| startOffset: g, |
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 | |
| // Use "Featured Image" box as a custom box | |
| add_action('do_meta_boxes', 'customposttype_image_box'); | |
| function customposttype_image_box() | |
| { | |
| // remove_meta_box( $id, $page, $context ); | |
| remove_meta_box('postimagediv', 'post_type', 'side'); | |
| // add_meta_box( $id, $title, $callback, $post_type, $context, |
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 | |
| // Show post's attachment images | |
| function show_attachment_images() { | |
| $attachments = get_posts( array( | |
| 'post_type' => 'attachment', | |
| 'posts_per_page' => -1, | |
| 'post_parent' => 42, | |
| 'exclude' => get_post_thumbnail_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
| <?php | |
| //hook into the init action and call create_book_taxonomies when it fires | |
| add_action( 'init', 'create_book_taxonomies', 0 ); | |
| //create two taxonomies, genres and writers for the post type "book" | |
| function create_book_taxonomies() | |
| { | |
| // Add new taxonomy, make it hierarchical (like categories) | |
| $labels = array( | |
| 'name' => _x( 'Genres', 'taxonomy general name' ), |
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
| // Scroll to top | |
| jQuery(window).scroll(function() { | |
| if( jQuery(this).scrollTop() != 0 ) { | |
| jQuery('.scroll-to-top').fadeIn(); | |
| } else { | |
| jQuery('.scroll-to-top').fadeOut(); | |
| } | |
| }); |