__( 'Main Menu', 'amigo' ), ) ); add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 300, 300, true ); add_image_size( 'amigo-home', 476, 634, true ); add_image_size( 'amigo-slider', 765, 430, true ); add_image_size( 'amigo-single', 1170, 400, true ); // Adds RSS feed links to for posts and comments. add_theme_support( 'automatic-feed-links' ); // Set Content Width if ( !isset( $content_width ) ) $content_width = 800; // Enable support for Post Formats. add_theme_support( 'post-formats', array( 'video', 'gallery' ) ); } endif; //////////////////////////////////////////////////////////////////// // Enqueue Styles (normal style.css and bootstrap.css) //////////////////////////////////////////////////////////////////// function amigo_theme_stylesheets() { wp_enqueue_style( 'amigo-bootstrap-css', get_template_directory_uri() . '/css/bootstrap.css' ); wp_enqueue_style( 'amigo-stylesheet', get_stylesheet_uri() ); // load Font Awesome css wp_enqueue_style( 'amigo-font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', false ); // load Flexslider css wp_enqueue_style( 'amigo-stylesheet-flexslider', get_template_directory_uri() . '/css/flexslider.css', 'style' ); } add_action( 'wp_enqueue_scripts', 'amigo_theme_stylesheets' ); //////////////////////////////////////////////////////////////////// // Register Bootstrap JS with jquery //////////////////////////////////////////////////////////////////// function amigo_theme_js() { wp_enqueue_script( 'amigo-bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' ), true ); wp_enqueue_script( 'amigo-theme-js', get_template_directory_uri() . '/js/customscript.js', array( 'jquery' ), true ); wp_enqueue_script( 'amigo-flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array( 'jquery' ) ); } add_action( 'wp_enqueue_scripts', 'amigo_theme_js' ); //////////////////////////////////////////////////////////////////// // Register Custom Navigation Walker include custom menu widget to use walkerclass //////////////////////////////////////////////////////////////////// require_once('lib/wp_bootstrap_navwalker.php'); //////////////////////////////////////////////////////////////////// // Register the Sidebar(s) //////////////////////////////////////////////////////////////////// add_action( 'widgets_init', 'amigo_widgets_init' ); function amigo_widgets_init() { register_sidebar( array( 'name' => __( 'Right Sidebar', 'amigo' ), 'id' => 'amigo-right-sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Left Sidebar', 'amigo' ), 'id' => 'amigo-left-sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Area After First Post', 'amigo' ), 'id' => 'amigo-post-area', 'description' => __( 'Suitable for text widget.', 'amigo' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } //////////////////////////////////////////////////////////////////// // Register hook and action to set Main content area col-md- width based on sidebar declarations //////////////////////////////////////////////////////////////////// add_action( 'amigo_main_content_width_hook', 'amigo_main_content_width_columns' ); function amigo_main_content_width_columns() { $columns = '12'; if ( get_theme_mod( 'rigth-sidebar-check', 1 ) != 0 ) { $columns = $columns - esc_attr( get_theme_mod( 'right-sidebar-size', 3 ) ); } if ( get_theme_mod( 'left-sidebar-check', 0 ) != 0 ) { $columns = $columns - esc_attr( get_theme_mod( 'left-sidebar-size', 3 ) ); } echo $columns; } function amigo_main_content_width() { do_action( 'amigo_main_content_width_hook' ); } //////////////////////////////////////////////////////////////////// // Breadcrumbs //////////////////////////////////////////////////////////////////// function amigo_breadcrumb() { global $post, $wp_query; $home = __( 'Home', 'amigo' ); $delimiter = ' / '; $homeLink = home_url(); if ( is_home() || is_front_page() ) { // no need for breadcrumbs in homepage } else { echo ''; } } //////////////////////////////////////////////////////////////////// // Display navigation to next/previous pages when applicable //////////////////////////////////////////////////////////////////// if ( !function_exists( 'amigo_content_nav' ) ) : function amigo_content_nav( $nav_id ) { global $wp_query, $post; // Don't print empty markup on single pages if there's nowhere to navigate. if ( is_single() ) { $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( !$next && !$previous ) return; } // Don't print empty markup in archives if there's only one page. if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) ) return; $nav_class = ( is_single() ) ? 'post-navigation' : 'paging-navigation'; ?> __( 'Facebook', 'amigo' ), 'twp_social_twitter' => __( 'Twitter', 'amigo' ), 'twp_social_google' => __( 'Google-Plus', 'amigo' ), 'twp_social_instagram' => __( 'Instagram', 'amigo' ), 'twp_social_pin' => __( 'Pinterest', 'amigo' ), 'twp_social_youtube' => __( 'YouTube', 'amigo' ), 'twp_social_reddit' => __( 'Reddit', 'amigo' ), ); ?> str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?page=%#%', 'current' => max( 1, get_query_var( 'paged' ) ), 'total' => $wp_query->max_num_pages, 'prev_next' => false, 'type' => 'array', 'prev_next' => TRUE, 'prev_text' => __( '← Previous', 'amigo' ), 'next_text' => __( 'Next →', 'amigo' ), ) ); if ( is_array( $pages ) ) { $current_page = ( get_query_var( 'paged' ) == 0 ) ? 1 : get_query_var( 'paged' ); echo ''; } } //////////////////////////////////////////////////////////////////// // Meta functions //////////////////////////////////////////////////////////////////// function amigo_cat_list() { global $post; $categories = get_the_category(); if ( $categories ) { foreach ( $categories as $category ) { echo '' . esc_attr( $category->cat_name ) . ''; } } } //////////////////////////////////////////////////////////////////// // Remove banner from options page review //////////////////////////////////////////////////////////////////// add_filter( 'wp_review_remove_branding', '__return_true' ); //////////////////////////////////////////////////////////////////// // Rating functions *wp_review_total / wp_review_user_reviews and wp_review_type / wp_review_user_review_type //////////////////////////////////////////////////////////////////// function amigo_rating( $postID, $class = 'wp_review_total', $type = 'wp_review_type' ) { if ( function_exists( 'mts_get_post_reviews' ) ) { $userTotal = $reviewtype = $total = ''; $userTotal = get_post_meta( $postID, $class, true ); $reviewtype = get_post_meta( $postID, $type, true ); if ( $reviewtype != '' && !empty( $reviewtype ) && $userTotal != '' && !empty( $userTotal ) ) { if ( $class == 'wp_review_total' ) { $user_icon = 'fa fa-user'; $title = __( 'Editor Rating', 'amigo' ); } else { $user_icon = 'fa fa-users'; $title = __( 'User Ratings', 'amigo' ); } if ( $reviewtype == 'star' ) { $icon = 'fa-star'; } elseif ( $reviewtype == 'point' ) { $icon = 'fa-dot-circle-o'; } elseif ( $reviewtype == 'percentage' ) { $icon = 'fa-percent'; } else { $icon = ''; } echo '' . esc_attr( $userTotal ) . ''; } } } function amigo_review_show_total( $echo = true, $class = 'review-total-only', $post_id = null, $args = array() ) { global $post, $wp_review_rating_types; if ( empty( $post_id ) ) $post_id = $post->ID; $type = wp_review_get_post_review_type( $post_id ); $user_type = wp_review_get_post_user_review_type( $post_id ); if ( !$type && !$user_type ) return ''; wp_enqueue_style( 'wp_review-style' ); $options = get_option( 'wp_review_options' ); $show_on_thumbnails_type = isset( $options[ 'show_on_thumbnails_type' ] ) ? $options[ 'show_on_thumbnails_type' ] : 'visitors'; $show_on_thumbnails_type = apply_filters( 'wp_review_thumbnails_total', $show_on_thumbnails_type, $post_id, $args ); // will override option $total = get_post_meta( $post_id, 'wp_review_user_reviews', true ); if ( $user_type == 'point' || $user_type == 'percentage' ) { $rating = sprintf( $wp_review_rating_types[ $user_type ][ 'value_text' ], $total ); } else { $rating = wp_review_user_rating( $post_id ); } $review = ''; if ( !empty( $rating ) && !empty( $total ) ) { $review .= '
'; $review .= $rating; $review .= '
'; } $review = apply_filters( 'wp_review_show_total', $review, $post_id, $type, $total ); $review = apply_filters( 'wp_review_total_output', $review, $post_id, $type, $total, $class, $args ); if ( $echo ) echo $review; else return $review; }