1000, 'height' => 250, 'flex-height' => true, 'flex-width' => true, 'uploads' => true, ); add_theme_support( 'custom-header' , $custom_header_defaults ); } add_action( 'after_setup_theme', 'awp_editor_styles' ); function awp_editor_styles() { $style_path = apply_filters( 'awp_editor_style_path' , '' ); if ( $style_path ) { add_editor_style( esc_url( $style_path ) ); } } add_action( 'wp_enqueue_scripts', 'awp_enqueue_styles' ); function awp_enqueue_styles() { $primary_bootstrap_css_path = apply_filters( 'awp_primary_bootstrap_css_path' , get_template_directory_uri() . '/bootstrap/css/bootstrap-basic.min.css' ); $second_bootstrap_css_path = apply_filters( 'awp_second_bootstrap_css_path' , '' ); // MIT License : https://github.com/twbs/bootstrap/blob/master/LICENSE wp_enqueue_style( AWP_THEME_SLUG . '-primary-bootstrap-css' , $primary_bootstrap_css_path , '' , AWP_THEME_VERSION ); if ( $second_bootstrap_css_path ) { awp_enqueue_file_followed_by_style_css( $second_bootstrap_css_path ); } else { awp_only_enqueue_style_css(); } wp_enqueue_style( AWP_THEME_SLUG . '-print-css' , get_template_directory_uri() . '/print.css' , '' , AWP_THEME_VERSION , 'print' ); } function awp_enqueue_file_followed_by_style_css( $second_bootstrap_css_path ) { wp_enqueue_style( AWP_THEME_SLUG . '-second-bootstrap-css' , $second_bootstrap_css_path , array( AWP_THEME_SLUG . '-primary-bootstrap-css' ) , AWP_THEME_VERSION ); wp_enqueue_style( AWP_THEME_SLUG . '-main-css' , get_stylesheet_uri() , array( AWP_THEME_SLUG . '-second-bootstrap-css' ) , AWP_THEME_VERSION ); } function awp_only_enqueue_style_css() { wp_enqueue_style( AWP_THEME_SLUG . '-main-css' , get_stylesheet_uri() , array( AWP_THEME_SLUG . '-primary-bootstrap-css' ) , AWP_THEME_VERSION ); } add_action( 'wp_enqueue_scripts', 'awp_enqueue_js' ); function awp_enqueue_js() { global $wp_scripts; wp_register_script( AWP_THEME_VERSION . '-html5-shiv' , get_template_directory() . '/js/html5shiv.js' , array() , AWP_THEME_VERSION , false ); $wp_scripts->add_data( AWP_THEME_VERSION . '-html5-shiv' , 'conditional' , 'lt IE 9' ); wp_register_script( AWP_THEME_VERSION . '-respond-js' , get_template_directory() . '/js/respond.min.js' , array() , AWP_THEME_VERSION , false ); $wp_scripts->add_data( AWP_THEME_VERSION . '-respond-js' , 'conditional' , 'lt IE 9' ); wp_enqueue_script( 'jquery' ); // MIT License : https://github.com/twbs/bootstrap/blob/master/LICENSE $main_bootstrap_js_path = apply_filters( 'awp_js_for_bootstrap' , get_template_directory_uri() . '/bootstrap/js/bootstrap.min.js' ); wp_enqueue_script( 'bootstrap_js' , $main_bootstrap_js_path , array( 'jquery' ) , AWP_THEME_VERSION , true ); wp_enqueue_script( AWP_THEME_SLUG . '-third-level-menu' , get_template_directory_uri() . '/js/awp-third-level-menu' , array( 'jquery' ) , AWP_THEME_VERSION , true ); } function awp_the_classes_of_first_top_navbar() { // 'navbar-fixed-top' fixes navbar $type = apply_filters( 'awp_classes_of_first_top_navbar' , 'navbar-default top-navbar navbar-static-top' ); echo 'navbar navbar-first-top ' . esc_attr( $type ); } function awp_the_classes_of_second_top_navbar() { $type = apply_filters( 'awp_classes_of_second_top_navbar' , 'navbar-default navbar-static-top' ); echo 'navbar navbar-second-top ' . esc_attr( $type ); } function awp_the_classes_of_bottom_navbar() { $classes = apply_filters( 'awp_classes_of_bottom_navbar' , 'navbar-default navbar-static-bottom' ); echo 'navbar ' . esc_attr( $classes ); } add_action( 'after_setup_theme', 'awp_menu_setup' ); function awp_menu_setup() { register_nav_menu( 'awp_main_menu' , __( 'Main Menu', 'adapter-wp' ) ); } add_action( 'after_setup_theme' , 'awp_set_content_width' ); function awp_set_content_width() { if ( ! isset( $content_width ) ) { $content_width = 600; } } add_filter( 'wp_title' , 'awp_fallback_title_for_home' , 11 ); function awp_fallback_title_for_home( $title ) { if ( ( "" == $title ) && ( is_home() || is_front_page() ) ) { return get_bloginfo( 'name' ); } return $title; } if ( ! function_exists( 'awp_maybe_get_top_nav' ) ) { function awp_maybe_get_top_nav() { if ( awp_should_page_have_top_and_bottom_navs() ) { awp_maybe_get_top_banner_parts(); get_template_part( 'navbar-top' ); } } } if ( ! function_exists( 'awp_should_page_have_top_and_bottom_navs' ) ) { function awp_should_page_have_top_and_bottom_navs() { if ( is_page() && ( false != strpos( get_page_template() , 'no-nav' ) ) ) { return false; } return true; } } if ( ! function_exists( 'awp_maybe_get_top_banner_parts' ) ) { function awp_maybe_get_top_banner_parts() { $do_get_top_banner = apply_filters( 'awp_do_get_top_banner' , true ); if ( $do_get_top_banner ) { get_template_part( 'top-banner' ); } } } if ( ! function_exists( 'awp_the_top_banner_backround_alignment' ) ) { function awp_the_top_banner_backround_alignment() { $alignment = apply_filters( 'awp_top_banner_backround_alignment' , 'center' ); echo esc_attr( $alignment ); } } if( ! function_exists( 'awp_maybe_get_bottom_nav' ) ) { function awp_maybe_get_bottom_nav() { $top_and_bottom_navs_allowed = awp_should_page_have_top_and_bottom_navs(); $do_get_bottom_nav = apply_filters( 'awp_do_get_bottom_nav' , $top_and_bottom_navs_allowed ); if ( $do_get_bottom_nav ) { get_template_part( 'navbar-bottom' ); } } } if ( ! function_exists( 'awp_the_top_nav_menu' ) ) { function awp_the_top_nav_menu() { $menu_name = 'awp_main_menu'; wp_nav_menu( array( 'menu' => $menu_name , 'theme_location' => $menu_name , 'depth' => 3 , 'container' => false , 'menu_class' => 'nav navbar-nav' , 'fallback_cb' => 'WP_Bootstrap_Navwalker::fallback', 'walker' => new WP_Bootstrap_Navwalker() , ) ); } } add_action( 'comment_form' , 'awp_maybe_enqueue_comment_reply' ); function awp_maybe_enqueue_comment_reply() { if ( comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } remove_action( 'wp_head', 'rsd_link' ); remove_action( 'wp_head', 'wp_generator' ); remove_action( 'wp_head', 'wlwmanifest_link' ); if ( ! function_exists( 'awp_simple_copyright' ) ) { function awp_simple_copyright() { $name = apply_filters( 'awp_name_next_to_copyright_in_footer' , get_bloginfo( 'admin' ) ); echo esc_html( "© " . $name . " " . date( 'Y' ) ); } } function awp_the_bottom_copyright_classes() { echo apply_filters( 'awp_bottom_copyright_classes' , '' ); } if ( ! function_exists( 'awp_paginate_links' ) ) { function awp_paginate_links() { global $wp_query; $awp_big = 999999999; $pagination_args = array( 'base' => str_replace( $awp_big, '%#%', esc_url( get_pagenum_link( $awp_big ) ) ), 'format' => '/page/%#%', 'type' => 'array' , 'current' => max( 1, get_query_var( 'paged' ) ), 'total' => $wp_query->max_num_pages, 'prev_next' => True, 'prev_text' => sprintf( __( '%sNewer' , 'adapter-wp' ) , ' ' ) , 'next_text' => sprintf( __( 'Older%s' , 'adapter-wp' ) , ' ' ) , ); $pagination = paginate_links( $pagination_args ); $pagination_size = apply_filters( 'awp_pagination_size' , '' ); ?> '' , 'link_before' => '
  • ' , 'link_after' => '
  • ' , 'previouspagelink' => sprintf( __( '%sBack' , 'adapter-wp' ) , ' ' ) , 'nextpagelink' => sprintf( __( 'Next%s' , 'adapter-wp' ) , ' ' ) , 'next_or_number' => 'next' , ); wp_link_pages( $awp_link_pages_args ); } } add_filter( 'wp_link_pages_link' , 'awp_pages_link_filter' ); function awp_pages_link_filter( $link_markup ) { $regex = '/(]*?>).*?(]??>)(.*)/'; $replace_with = '$2$1$3'; $filtered_markup = preg_replace( $regex , $replace_with , $link_markup ); return $filtered_markup; } if ( ! function_exists( 'awp_author_date_category_tag' ) ) { function awp_author_date_category_tag() { global $post; $post_date = get_the_time( get_option( 'date_format' ) ); if ( '' == $post->post_title ) { $post_date = '' . $post_date . ''; } ?> By:  on:  sprintf( __( '%s' , 'adapter-wp' ) , $name ) , 'id' => $id , 'description' => sprintf( __( '%s' , 'adapter-wp' ) , $description ) , 'before_widget' => '
    ' , 'after_widget' => '
    ' , 'before_title' => '

    ' , 'after_title' => '

    ' , ) ); } } add_action( 'widgets_init', 'awp_widgets_init' ); function awp_widgets_init() { awp_register_sidebar( 'Main Sidebar' , 'main_sidebar', 'Diplays on selected pages' ); } add_filter( 'upload_mimes', 'awp_mime_types' ); function awp_mime_types( $mimes ){ $mimes['svg'] = 'image/svg+xml'; return $mimes; } add_filter( 'comment_reply_link' , 'awp_reply_link' ); function awp_reply_link( $link_class ) { $comment_reply_classes = apply_filters( 'awp_comment_reply_classes' , 'btn btn-primary btn-med' ); $link_class = str_replace( "class='comment-reply-link" , "class='comment-reply-link " , $link_class ); return $link_class; } if ( ! function_exists( 'awp_comment_list' ) ) { function awp_comment_list( $comment , $arguments , $depth ) { $_GLOBALS[ 'comment' ] = $comment; ?>
  • id="comment-">

    ago  

    comment_approved ) : ?>

    '   Reply' , 'depth' => $depth , 'max_depth' => $arguments[ 'max_depth' ] , ) ) ); ?>
    '; foreach( $posts as $post ) { echo '' . $post->post_title . ''; } echo ''; } } add_filter( 'get_image_tag_class' , 'awp_image_tag_class_filter' ); function awp_image_tag_class_filter( $classes ) { return $classes . ' img-responsive'; } add_filter( 'widget_archives_args' , 'awp_limit_archives_count' ); function awp_limit_archives_count( $args ) { $args[ 'limit' ] = '6'; return $args; } add_filter( 'widget_categories_args' , 'awp_widget_categories_filter' ); function awp_widget_categories_filter( $args ) { $args[ 'number' ] = 6; $args[ 'orderby' ] = 'count'; $args[ 'order' ] = 'DESC'; return $args; } add_filter( 'the_content' , 'awp_add_clearfix_to_end_of_content' , 1 ); function awp_add_clearfix_to_end_of_content( $content ) { return $content . "
    "; } if ( ! function_exists( 'awp_query_for_page_content' ) ) { function awp_query_for_page_content() { if ( have_posts() ) : while ( have_posts() ) : the_post(); get_template_part( 'content' , 'page' ); endwhile; else : get_template_part( 'no-post-found' ); get_template_part( 'awp-posts-and-pages' ); endif; wp_reset_query(); } } if ( ! function_exists( 'awp_query_for_post_previews' ) ) { function awp_query_for_post_previews() { if ( have_posts() ) : while ( have_posts() ) : the_post(); get_template_part( 'content' , 'post-preview' ); endwhile; awp_paginate_links(); else : get_template_part( 'no-post-found' ); get_template_part( 'awp-posts-and-pages' ); wp_reset_query(); endif; } } // add_filter( 'comments_open' , 'awp_only_allow_comments_on_single_post_page' ); function awp_only_allow_comments_on_single_post_page( $are_comments_open ) { global $post; if ( isset( $post ) && ( 'post' == $post->post_type ) && ( is_single( $post->ID ) ) ) { return true ; } } function awp_display_comment_form_or_template() { $do_use_comment_form = apply_filters( 'awp_use_unstyled_comment_form' , false ); if ( $do_use_comment_form ) { comment_form(); } else { comments_template(); } } if ( ! function_exists( 'awp_the_breadcrumbs' ) ) { function awp_the_breadcrumbs() { global $post; if ( ! isset( $post ) ) { return; } if ( awp_current_post_has_parent() ) { awp_echo_breadcrumbs(); } } } function awp_current_post_has_parent() { global $post; $parent_title = get_the_title( $post->post_parent ); return ( $parent_title != the_title( "" , "" , false ) ); } if ( ! function_exists( 'awp_echo_breadcrumbs' ) ) { function awp_echo_breadcrumbs() { global $post; ?> post_parent ); if ( awp_post_is_only_a_placeholder_and_has_no_content( $post_parent ) ) { echo get_the_title( $post_parent ); } else { awp_echo_post_title_wrapped_in_a_link( $post_parent ); } } } function awp_post_is_only_a_placeholder_and_has_no_content( $post_parent ) { return ( "" == $post_parent->post_content ); } function awp_echo_post_title_wrapped_in_a_link( $post_parent ) { $parent_title = get_the_title( $post_parent ); $parent_link = get_permalink( $post_parent ); echo "{$parent_title}\n"; } if ( ! function_exists( 'awp_maybe_echo_edit_link' ) ) { function awp_maybe_echo_edit_link() { if ( is_user_logged_in() && current_user_can( 'edit_posts' ) ) { edit_post_link( '' ); } } }