'main', 'footer' => 'overflow-container', 'render' => 'ct_apex_infinite_scroll_render' ) ); // load theme options page require_once( trailingslashit( get_template_directory() ) . 'theme-options.php' ); // add inc folder files foreach ( glob( trailingslashit( get_template_directory() ) . 'inc/*' ) as $filename ) { include $filename; } // load text domain load_theme_textdomain( 'apex', get_template_directory() . '/languages' ); // register Primary menu register_nav_menus( array( 'primary' => __( 'Primary', 'apex' ) ) ); } } add_action( 'after_setup_theme', 'ct_apex_theme_setup', 10 ); // register widget areas function ct_apex_register_widget_areas(){ /* register after post content widget area */ register_sidebar( array( 'name' => __( 'Primary Sidebar', 'apex' ), 'id' => 'primary', 'description' => __( 'Widgets in this area will be shown in the sidebar next to the main post content', 'apex' ), 'before_widget' => '', 'before_title' => '
'; $fields['url'] = '
'; return $fields; } } add_filter('comment_form_default_fields','apex_update_fields'); if( ! function_exists( 'apex_update_comment_field' ) ) { function apex_update_comment_field( $comment_field ) { $comment_field = '
'; return $comment_field; } } add_filter('comment_form_field_comment','apex_update_comment_field'); // remove allowed tags text after comment form if( ! function_exists( 'ct_apex_remove_comments_notes_after' ) ) { function ct_apex_remove_comments_notes_after( $defaults ) { $defaults['comment_notes_after'] = ''; return $defaults; } } add_action('comment_form_defaults', 'ct_apex_remove_comments_notes_after'); // excerpt handling if( ! function_exists( 'ct_apex_excerpt' ) ) { function ct_apex_excerpt() { // make post variable available global $post; // check for the more tag $ismore = strpos( $post->post_content, '' ); // get the show full post setting $show_full_post = get_theme_mod( 'full_post' ); // if show full post is on and not on a search results page if ( ( $show_full_post == 'yes' ) && ! is_search() ) { // use the read more link if present if ( $ismore ) { the_content( __( 'Continue reading', 'apex' ) . " " . get_the_title() . "" ); } else { the_content(); } } // use the read more link if present elseif ( $ismore ) { the_content( __( 'Continue reading', 'apex' ) . " " . get_the_title() . "" ); } // otherwise the excerpt is automatic, so output it else { the_excerpt(); } } } // filter the link on excerpts if( ! function_exists( 'ct_apex_excerpt_read_more_link' ) ) { function ct_apex_excerpt_read_more_link( $output ) { global $post; return $output . "
" . __( 'Continue reading', 'apex' ) . " " . get_the_title() . "
"; } } add_filter('the_excerpt', 'ct_apex_excerpt_read_more_link'); // change the length of the excerpts if( ! function_exists( 'apex_custom_excerpt_length' ) ) { function apex_custom_excerpt_length( $length ) { $new_excerpt_length = get_theme_mod('excerpt_length'); // if there is a new length set and it's not 15, change it if( ! empty( $new_excerpt_length ) && $new_excerpt_length != 25 ){ return $new_excerpt_length; } // return 0 if user explicitly sets it to 0 elseif ( $new_excerpt_length === 0 ) { return 0; } else { return 25; } } } add_filter( 'excerpt_length', 'apex_custom_excerpt_length', 99 ); // switch [...] to ellipsis on automatic excerpt if( ! function_exists( 'ct_apex_new_excerpt_more' ) ) { function ct_apex_new_excerpt_more( $more ) { // get user set excerpt length $new_excerpt_length = get_theme_mod('excerpt_length'); // if set to 0, return nothing if ( $new_excerpt_length === 0 ) { return ''; } // else add the ellipsis else { return '…'; } } } add_filter('excerpt_more', 'ct_apex_new_excerpt_more'); // turns of the automatic scrolling to the read more link if( ! function_exists( 'ct_apex_remove_more_link_scroll' ) ) { function ct_apex_remove_more_link_scroll( $link ) { $link = preg_replace( '|#more-[0-9]+|', '', $link ); return $link; } } add_filter( 'the_content_more_link', 'ct_apex_remove_more_link_scroll' ); // for displaying featured images if( ! function_exists( 'ct_apex_featured_image' ) ) { function ct_apex_featured_image() { // get post object global $post; // instantiate featured image var $featured_image = ''; // if post has an image if ( has_post_thumbnail( $post->ID ) ) { if ( is_singular() ) { $featured_image = '