is_main_query() ) { return; } if ( is_search() ) { $query->set( 'posts_per_page', 20 ); } } add_action( 'pre_get_posts', 'basic_pre_get_posts' ); /* ========================================================================== */ /** * @param $args * * @return mixed * ========================================================================== */ function basic_comment_form_defaults( $args ) { $commenter = wp_get_current_commenter(); $fields = apply_filters( 'basic_comment_form_defaults', array( 'author' => '
', 'email' => '', 'url' => '' ) ); $args['fields'] = apply_filters( 'comment_form_default_fields', $fields ); $args['comment_field'] = ''; return $args; } add_filter( 'comment_form_defaults', 'basic_comment_form_defaults', 10 ); /** * customize excerpt text * * @param $more * * @return string * ========================================================================== */ function basic_change_the_excerpt( $more ) { return ' ...'; } add_action( 'excerpt_more', 'basic_change_the_excerpt' ); /* ========================================================================== */ /* ========================================================================== * echo custom css * ========================================================================== */ function basic_print_custom_css_js() { $css = basic_get_theme_option( 'custom_styles' ); $js = basic_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', 'basic_print_custom_css_js', 20 ); /* ========================================================================== */ /* ========================================================================== * echo custom script in footer from options * ========================================================================== */ function basic_print_footer_js() { $footer_js = basic_get_theme_option( 'footer_scripts' ); if ( ! empty( $footer_js ) ) { echo "\n" . wp_specialchars_decode( $footer_js, ENT_QUOTES ) . "\n"; } } add_action( 'wp_footer', 'basic_print_footer_js' ); /* ========================================================================== */ /* ========================================================================== * echo custom script in footer from options * ========================================================================== */ function basic_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( 'basic_singular_thumbnail_attr', 'basic_singular_thumbnail_attr' ); /* ========================================================================== */ /* ========================================================================== * add social button to the_content * ========================================================================== */ function basic_social_share_buttons( $content ) { $share_buttons = basic_get_theme_option( 'social_share' ); $hide_on_pages = get_theme_mod( 'hide_socshare_on_pages', 0 ); $link_pages = wp_link_pages( 'echo=0' ); if ( ! is_singular() || empty( $share_buttons ) || 'hide' == $share_buttons || ( is_page() && ! empty( $hide_on_pages ) ) ) { // return $content; return $content . $link_pages; } $soc_title = basic_get_theme_option( 'title_before_socshare' ); $soc_html = ""; $fitered_soc_html = apply_filters( 'basic_social_share', $soc_html ); // return $content . $fitered_soc_html; return $content . $link_pages . $fitered_soc_html; } add_action( 'the_content', 'basic_social_share_buttons', 10 ); /* ========================================================================== */ /* ========================================================================== * * * ========================================================================== */ if ( ! function_exists( 'basic_the_content_entry' ) ) : function basic_the_content_entry( $content ) { return '