is_main_query() ) { return; } if ( is_search() ) { $query->set( 'posts_per_page', 20 ); } } add_action( 'pre_get_posts', 'aperitto_pre_get_posts' ); /** * @param $args * * @return mixed * ========================================================================== */ function aperitto_comment_form_defaults( $args ) { $commenter = wp_get_current_commenter(); $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"'; $fields = apply_filters( 'aperitto_comment_form_defaults', array( 'author' => '
', 'email' => '', 'url' => '', 'cookies' => '', ) ); $args['fields'] = apply_filters( 'comment_form_default_fields', $fields ); $args['comment_field'] = ''; return $args; } add_filter( 'comment_form_defaults', 'aperitto_comment_form_defaults', 10 ); /** * customize excerpt text * * @param $more * * @return string * ========================================================================== */ function aperitto_change_the_excerpt( $more ) { return ' ...'; } add_action( 'excerpt_more', 'aperitto_change_the_excerpt' ); /* ========================================================================== * echo custom css * ========================================================================== */ function aperitto_print_custom_css_js() { $css = aperitto_get_theme_option( 'custom_styles' ); $js = aperitto_get_theme_option( 'head_scripts' ); if ( ! empty( $css ) ) { echo "\n\n"; } if ( ! empty( $js ) ) { echo "\n" . wp_specialchars_decode( $js, ENT_QUOTES ) . "\n"; } } add_action( 'wp_head', 'aperitto_print_custom_css_js', 20 ); /* ========================================================================== * echo custom script in footer from options * ========================================================================== */ function aperitto_print_footer_js() { $footer_js = aperitto_get_theme_option( 'footer_scripts' ); if ( ! empty( $footer_js ) ) { echo "\n" . wp_specialchars_decode( $footer_js, ENT_QUOTES ) . "\n"; } } add_action( 'wp_footer', 'aperitto_print_footer_js' ); /* ========================================================================== * echo custom script in footer from options * ========================================================================== */ function aperitto_singular_thumbnail_attr( $args ) { $show_mobile_thumb = get_theme_mod( 'show_mobile_thumb' ); if ( ! empty( $show_mobile_thumb ) ) { $old = ( array_key_exists( 'class', $args ) ) ? $args['class'] : ''; $args['class'] = "$old show"; } return $args; } apply_filters( 'aperitto_singular_thumbnail_attr', 'aperitto_singular_thumbnail_attr' ); /* ========================================================================== * * Wrap content with entry class * ========================================================================== */ if ( ! function_exists( 'aperitto_the_content_entry' ) ) : function aperitto_the_content_entry( $content ) { return '