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 custom selectors to Gravity Forms | |
add_action("gform_field_css_class", "custom_class", 10, 3); | |
function custom_class($classes, $field, $form){ | |
$classes .= " " . $field["type"]; | |
return $classes; | |
} |
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 custom ACF option pages | |
if(function_exists('acf_add_options_page')) { | |
acf_add_options_page(); | |
acf_add_options_sub_page('Site Options'); | |
} |
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
// TINYMCE Options | |
function my_mce4_options( $init ) { | |
$custom_colours = ' | |
"db1e34", "Color Name", "222c64", "Color Name Two" | |
'; | |
$init['textcolor_map'] = '['.$custom_colours.']'; | |
$init['textcolor_rows'] = 6; | |
return $init; | |
} | |
add_filter('tiny_mce_before_init', 'my_mce4_options'); |
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 responsive container to embed videos | |
function forty_responsive_video( $html ) { | |
//add http protocol | |
$html = str_replace('<iframe src="//', '<iframe src="http://', $html); | |
return '<div class="flex-video">' . $html . '</div>'; | |
} | |
add_filter( 'embed_oembed_html', 'forty_responsive_video', 10, 3 ); | |
add_filter( 'video_embed_html', 'forty_responsive_video' ); |
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
// Pull content from another page | |
function show_post($path) { | |
$post = get_page_by_path($path); | |
$content = apply_filters('the_content', $post->post_content); | |
echo $content; | |
} | |
// To use | |
<?php show_post('about'); ?> |
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 jump with <-more-> tag | |
function remove_more_jump_link($link) { | |
$offset = strpos($link, '#more-'); | |
if ($offset) { $end = strpos($link, '"',$offset); } | |
if ($end) { $link = substr_replace($link, '', $offset, $end-$offset); } | |
return $link; | |
} | |
add_filter('the_content_more_link', 'remove_more_jump_link'); |
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
// check if it's a blog page | |
function is_blog () { | |
global $post; | |
$posttype = get_post_type($post ); | |
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ); | |
} |
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
// Allow custom post types in tag search | |
function post_type_tags_fix($request) { | |
if ( isset($request['tag']) && !isset($request['post_type']) ) | |
$request['post_type'] = 'any'; | |
return $request; | |
} | |
add_filter('request', 'post_type_tags_fix'); |
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 Admin Bar Margin | |
add_action('get_header', 'my_filter_head'); | |
function my_filter_head() { | |
remove_action('wp_head', '_admin_bar_bump_cb'); | |
} |