theme_location ) {
return $nav_menu;
}
$left_button = sprintf(
'',
aamla_get_icon( [ 'icon' => 'angle-left' ] )
);
$right_button = sprintf(
'',
aamla_get_icon( [ 'icon' => 'angle-right' ] )
);
$nav_menu .= $left_button . $right_button;
return $nav_menu;
}
add_filter( 'wp_nav_menu', 'aamla_add_menu_scrolling_buttons', 10, 2 );
add_filter( 'wp_page_menu', 'aamla_add_menu_scrolling_buttons', 10, 2 );
/**
* Adding Custom Images Sizes to the WordPress Media Library (Admin).
*
* @since 1.0.0
*
* @param array $size_names Array of image sizes and their names.
* @return array
*/
function aamla_custom_image_sizes_to_admin( $size_names ) {
return array_merge(
$size_names,
[
'aamla-small' => esc_html__( 'Aamla Small', 'aamla' ),
'aamla-medium' => esc_html__( 'Aamla Medium', 'aamla' ),
'aamla-large' => esc_html__( 'Aamla Large', 'aamla' ),
'aamla-laptop' => esc_html__( 'Aamla Laptop', 'aamla' ),
]
);
}
add_filter( 'image_size_names_choose', 'aamla_custom_image_sizes_to_admin' );
/**
* Do not autoplay audio on archive pages.
*
* @since 1.0.0
*
* @param array $result The shortcode_atts() merging of $defaults and $atts.
* @param array $defaults The default attributes defined for the shortcode.
* @param array $atts The attributes supplied by the user within the shortcode.
* @return array
*/
function aamla_audio_autoplay_off( $result, $defaults, $atts ) {
if ( is_home() || is_archive() ) {
$result['autoplay'] = false;
}
return $result;
}
add_filter( 'shortcode_atts_audio', 'aamla_audio_autoplay_off', 10, 3 );
/**
* Strip Tags from manual page excerpts on search pages.
*
* @since 1.0.0
*
* @param string $excerpt The post excerpt.
* @param WP_Post $post Post object.
* @return string
*/
function aamla_strip_page_excerpts( $excerpt, $post ) {
if ( ! is_search() ) {
return $excerpt;
}
if ( 'page' === $post->post_type ) {
$excerpt = wp_strip_all_tags( $excerpt );
}
return $excerpt;
}
add_filter( 'get_the_excerpt', 'aamla_strip_page_excerpts', 10, 2 );