'; $comments .= ''; $comments .= get_comments_number_text( __( '(0 comment)', 'beginner' ), __( '(1 comment)', 'beginner' ), __( '(% comments)', 'beginner' ) ); $comments .= ''; $comments .= ''; endif; // use get_the_excerpt() instead $output to avoid

return get_the_excerpt() . $more . $comments; } elseif ( 'deal' == get_post_type() ) { return get_the_excerpt() . $more . ' ' . __( 'View this Deal', 'beginner' ) . ' '; } } add_filter( 'the_excerpt', 'beginner_the_excerpt' ); /** * Change the excerpt length * * @since 1.0.0 * @param string $length * @return string */ function beginner_excerpt_length( $length ) { if ( 'deal' == get_post_type() ) $length = 15; return $length; } add_filter( 'excerpt_length', 'beginner_excerpt_length' ); /** * Remove theme-layouts meta box on attachment and bbPress post type. * * @since 1.0.0 */ function beginner_remove_theme_layout_metabox() { remove_post_type_support( 'attachment', 'theme-layouts' ); // bbPress remove_post_type_support( 'forum', 'theme-layouts' ); remove_post_type_support( 'topic', 'theme-layouts' ); remove_post_type_support( 'reply', 'theme-layouts' ); } add_action( 'init', 'beginner_remove_theme_layout_metabox', 11 ); /** * Add post type 'post' support for the Simple Page Sidebars plugin. * * @since 1.0.0 */ function beginner_page_sidebar_plugin() { if ( class_exists( 'Simple_Page_Sidebars' ) ) { add_post_type_support( 'post', 'simple-page-sidebars' ); if ( is_tjdeals_activated() ) add_post_type_support( 'deal', 'simple-page-sidebars' ); } } add_action( 'init', 'beginner_page_sidebar_plugin' ); /** * Register custom contact info fields. * * @since 1.0.0 * @param array $contactmethods * @return array */ function beginner_contact_info_fields( $contactmethods ) { // $contactmethods['twitter'] = __( 'Twitter URL', 'beginner' ); // $contactmethods['facebook'] = __( 'Facebook URL', 'beginner' ); // $contactmethods['gplus'] = __( 'Google Plus URL', 'beginner' ); // $contactmethods['instagram'] = __( 'Instagram URL', 'beginner' ); // $contactmethods['pinterest'] = __( 'Pinterest URL', 'beginner' ); // Remove default contacts unset( $contactmethods['aim'] ); unset( $contactmethods['jabber'] ); unset( $contactmethods['yim'] ); return $contactmethods; } add_filter( 'user_contactmethods', 'beginner_contact_info_fields' ); /** * Extend archive title * * @since 1.0.0 */ function beginner_extend_archive_title( $title ) { if ( is_category() ) { $title = sprintf( __( 'All Posts in %s', 'beginner' ), single_cat_title( '', false ) ); } elseif ( is_tag() ) { $title = sprintf( __( 'All Posts in %s', 'beginner' ), single_tag_title( '', false ) ); } elseif ( is_author() ) { $title = sprintf( __( 'All Posts by %s', 'beginner' ), get_the_author() ); } elseif ( is_year() ) { $title = sprintf( __( 'Year: %s', 'beginner' ), get_the_date( _x( 'Y', 'yearly archives date format', 'beginner' ) ) ); } elseif ( is_month() ) { $title = sprintf( __( 'Month: %s', 'beginner' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'beginner' ) ) ); } elseif ( is_day() ) { $title = sprintf( __( 'Day: %s', 'beginner' ), get_the_date( _x( 'F j, Y', 'daily archives date format', 'beginner' ) ) ); } return $title; } add_filter( 'get_the_archive_title', 'beginner_extend_archive_title' ); /** * Customize tag cloud widget * * @since 1.0.0 */ function beginner_customize_tag_cloud( $args ) { $args['largest'] = 12; $args['smallest'] = 12; $args['unit'] = 'px'; $args['number'] = 20; return $args; } add_filter( 'widget_tag_cloud_args', 'beginner_customize_tag_cloud' ); // Uncomment this if support WooCommerce // add_filter( 'woocommerce_product_tag_cloud_widget_args', 'beginner_customize_tag_cloud' ); /** * Modifies the theme layout on attachment pages. * * @since 1.0.0 */ function beginner_mod_theme_layout( $layout ) { // Change the layout to Full Width on Attachment page. if ( is_attachment() && wp_attachment_is_image() ) { $post_layout = get_post_layout( get_queried_object_id() ); if ( 'default' === $post_layout ) { $layout = '1c'; } } return $layout; } add_filter( 'theme_mod_theme_layout', 'beginner_mod_theme_layout', 15 ); /** * Custom comment form fields. * * @since 1.0.0 * @param array $fields * @return array */ function beginner_comment_form_fields( $fields, $args = array() ) { $args = wp_parse_args( $args ); if ( ! isset( $args['format'] ) ) $args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml'; $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $html5 = 'html5' === $args['format']; $fields['author'] = '

'; $fields['email'] = '

'; $fields['url'] = '

'; return $fields; } add_filter( 'comment_form_default_fields', 'beginner_comment_form_fields' ); if ( ! function_exists( 'beginner_strip_shortcode_gallery' ) ) : /** * Remove [gallery] from Single Post the_content * http://wordpress.stackexchange.com/questions/121489/split-content-and-gallery/121508#121508 */ function beginner_strip_shortcode_gallery( $content ) { if ( has_post_format( 'gallery' ) ) { preg_match_all( '/'. get_shortcode_regex() .'/s', $content, $matches, PREG_SET_ORDER ); if ( ! empty( $matches ) ) { foreach ( $matches as $shortcode ) { if ( 'gallery' === $shortcode[2] ) { $pos = strpos( $content, $shortcode[0] ); if ($pos !== false) return substr_replace( $content, '', $pos, strlen($shortcode[0]) ); } } } } return $content; } add_filter( 'the_content', 'beginner_strip_shortcode_gallery' ); endif; /** * Custom
attributes */ function beginner_attr_header( $attr ) { unset( $attr['id'] ); unset( $attr['class'] ); unset( $attr['role'] ); return $attr; } add_filter( 'hybrid_attr_header', 'beginner_attr_header' ); /** * Custom