registered['jquery'] ) ) {
$script = $scripts->registered['jquery'];
if ( $script->deps ) {
$script->deps = array_diff( $script->deps, array( 'jquery-migrate' ) );
}
}
}
add_action( 'wp_default_scripts', 'aemi_remove_jquery_migrate' );
*/
function aemi_html_tag_schema()
{
$schema = 'http://schema.org/';
$type = 'WebPage';
if ( is_singular( 'post' ) )
{
$type = 'Article';
}
else if ( is_author() )
{
$type = 'ProfilePage';
}
else if ( is_search() )
{
$type = 'SearchResultsPage';
}
echo 'itemscope="itemscope" itemtype="' . esc_attr( $schema ) . esc_attr( $type ) . '"';
}
function aemi_category_transient_flusher()
{
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
{
return;
}
delete_transient( 'aemi_categories' );
}
add_action( 'edit_category', 'aemi_category_transient_flusher' );
add_action( 'save_post', 'aemi_category_transient_flusher' );
function aemi_remove_script_version( $src )
{
$parts = explode( '?', $src );
return $parts[0];
}
add_filter( 'script_loader_src', 'aemi_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', 'aemi_remove_script_version', 15, 1 );
function aemi_optimize_scripts( $tag, $handle )
{
$scripts = array(
'aemi-script'
);
foreach( $scripts as $script )
{
if ( $script === $handle )
{
return str_replace( ' src', ' defer src', $tag );
}
}
return $tag;
}
add_filter('script_loader_tag', 'aemi_optimize_scripts', 10, 2);
if ( ! function_exists( 'aemi_custom_archive_title' ) )
{
function aemi_custom_archive_title( $title )
{
if ( is_category() ) {
$title = '
' . single_cat_title( '', false ) . '
' . _x( 'Category', 'archive page type category', 'aemi' ) . '
';
} elseif ( is_tag() ) {
$title = '' . single_tag_title( '', false ) . '
' . _x( 'Tag', 'archive page type tag', 'aemi' ) . '
';
} elseif ( is_author() ) {
$title = '' . get_the_author() . '
' . _x( 'Author', 'archive page type author', 'aemi' ) . '
';
} elseif ( is_year() ) {
$title = '' . get_the_date( 'Y' ) . '
' . _x( 'Yearly Archives', 'archive page type yearly', 'aemi' ) . '
';
} elseif ( is_month() ) {
$title = '' . get_the_date( 'F Y' ) . '
' . _x( 'Monthly Archives', 'archive page type monthly', 'aemi' ) . '
';
} elseif ( is_day() ) {
$title = '' . get_the_date( 'j F Y' ) . '
' . _x( 'Daily Archives', 'archive page type daily', 'aemi' ) . '
';
} elseif ( is_tax( 'post_format' ) ) {
if ( is_tax( 'post_format', 'post-format-aside' ) ) {
$title = '' . _x( 'Asides', 'post format archive title', 'aemi' ) . '
';
} elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) {
$title = '' . _x( 'Galleries', 'post format archive title', 'aemi' ) . '
';
} elseif ( is_tax( 'post_format', 'post-format-image' ) ) {
$title = '' . _x( 'Images', 'post format archive title', 'aemi' ) . '
';
} elseif ( is_tax( 'post_format', 'post-format-video' ) ) {
$title = '' . _x( 'Videos', 'post format archive title', 'aemi' ) . '
';
} elseif ( is_tax( 'post_format', 'post-format-quote' ) ) {
$title = '' . _x( 'Quotes', 'post format archive title', 'aemi' ) . '
';
} elseif ( is_tax( 'post_format', 'post-format-link' ) ) {
$title = '' . _x( 'Links', 'post format archive title', 'aemi' ) . '
';
} elseif ( is_tax( 'post_format', 'post-format-status' ) ) {
$title = '' . _x( 'Status', 'post format archive title', 'aemi' ) . '
';
} elseif ( is_tax( 'post_format', 'post-format-audio' ) ) {
$title = '' . _x( 'Audio', 'post format archive title', 'aemi' ) . '
';
} elseif ( is_tax( 'post_format', 'post-format-chat' ) ) {
$title = '' . _x( 'Chats', 'post format archive title', 'aemi' ) . '
';
}
} elseif ( is_post_type_archive() ) {
$title = '' . post_type_archive_title( '', false ) . '
';
} elseif ( is_tax() ) {
$tax = get_taxonomy( get_queried_object()->taxonomy );
$title = '' . single_term_title( '', false ) . '
' . $tax->labels->singular_name . '
';
} else {
$title = '' . _x( 'Archives', 'generic archive title', 'aemi' ) . '
';
}
return $title;
}
}
add_filter( 'get_the_archive_title', 'aemi_custom_archive_title' );