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
| (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 | |
| //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
| <?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 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 | |
| // 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 | |
| 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 | |
| // Custom PHPMailer configuration | |
| add_action( 'phpmailer_init', 'cg_custom_phpmailer_config' ); | |
| function cg_custom_phpmailer_config( PHPMailer $phpmailer ) { | |
| $phpmailer->From = 'email@email.com.br'; | |
| $phpmailer->FromName = ''; | |
| $phpmailer->Sender= 'email@email.com.br'; | |
| $phpmailer->Host = 'smtp.server.com.br'; | |
| $phpmailer->Port = 587; // could be different | |
| $phpmailer->Username = 'email@email.com.br'; // if required |
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 | |
| // Get Category ID by name, slug or id | |
| function get_category_id($cat_slug, $field = 'slug', $taxonomy = 'category'){ | |
| $term = get_term_by($field, $cat_slug, $taxonomy); | |
| return $term->term_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 | |
| // Get permalink by slug | |
| get_permalink( get_page_by_path( 'map' ) ); | |
| // Get permalink by title | |
| get_permalink( get_page_by_title( 'Map' ) ); |