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
<? | |
function get_menu_title( $theme_location, $default_name = 'menu' ) { | |
if ( $theme_location && ( $locations = get_nav_menu_locations() ) && isset( $locations[ $theme_location ] ) ) { | |
$menu = wp_get_nav_menu_object( $locations[ $theme_location ] ); | |
if( $menu && $menu->name ) { | |
return $menu->name; | |
} | |
} |
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 | |
/* | |
WP_User_Query orderby random | |
put this in functions.php | |
*/ | |
add_filter('pre_user_query', function(&$query) { | |
if($query->query_vars["orderby"] == 'rand') { | |
$query->query_orderby = 'ORDER by RAND()'; | |
} | |
}); |
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 // dont include this line | |
//Insert code after second paragraph of single post content. | |
add_filter( 'the_content', 'sj_insert_code' ); | |
function sj_insert_code( $content ) { | |
$code = '<div>Code to be inserted goes here</div>'; | |
if ( is_single() && ! is_admin() ) { | |
return sj_insert_after_paragraph( $code, 2, $content ); | |
} | |
return $content; |
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_filter('next_posts_link_attributes', 'posts_link_attributes'); | |
add_filter('previous_posts_link_attributes', 'posts_link_attributes'); | |
function posts_link_attributes() { | |
return 'class="button"'; | |
} |
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
/* | |
Admin Branding | |
*/ | |
$admin_branding_url = get_stylesheet_directory() . '/includes/admin-branding.php'; | |
if(file_exists($admin_branding_url)) { | |
include_once($admin_branding_url); | |
} |
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_filter('enter_title_here', 'my_title_place_holder' , 20 , 2 ); | |
function my_title_place_holder($title , $post){ | |
if( $post->post_type == 'pet' ){ | |
$my_title = "Animal Name"; | |
return $my_title; | |
} | |
return $title; | |
} |
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
function sjd_acf_input_admin_footer() { | |
?> | |
<script type="text/javascript"> | |
(function($) { | |
acf.add_filter('color_picker_args', function( args, $field ){ | |
// add the hexadecimal codes here for the colors you want to appear as swatches | |
args.palettes = ['#ffffff','#000000'] |
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 featured image size on a specific archive page | |
function sjd_custom_loop_image_size( $image_size ) { | |
if(is_archive('testimonial')){ | |
$image_size = 'content-slider'; | |
return $image_size; | |
} | |
} | |
add_filter( 'genesis_pre_get_option_image_size', 'sjd_custom_loop_image_size' ); |
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 custom avatar size to Genesis user profile widget | |
add_filter( 'genesis_gravatar_sizes', 'sjd_user_profile' ); | |
function sjd_user_profile( $sizes ) { | |
$sizes['Extra Large Image'] = 200; | |
return $sizes; | |
} |
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_filter('edac_filter_readability_content', 'edadc_custom_readability_content', 1, 2); | |
function edadc_custom_readability_content($content, $post_id){ | |
$content .= get_field('my_custom_field',$post_id); | |
return $content; | |
} |
OlderNewer