. add_theme_support( 'title-tag' ); $header_args = array( 'width' => 1280, 'height' => 600, 'uploads' => true, ); add_theme_support( 'custom-header', $header_args ); add_theme_support( 'custom-background' ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'structured-post-formats', array('link', 'video') ); // This theme supports a variety of post formats. add_theme_support( 'post-formats', array( 'gallery', 'link', 'quote', 'video', 'audio' ) ); // This theme uses wp_nav_menu() in three locations. register_nav_menu( 'primary', __( 'Primary Menu', 'amanda-lite' ) ); // This theme uses Featured Images (also known as post thumbnails) for per-post/per-page Custom Header images add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 640, 490, true ); // Add Amanda's custom image sizes. add_image_size( 'thumbnail', 75, 75, true); add_image_size( 'medium-thumbnail', 680, 580, true ); // for blog masonry add_image_size( 'large-thumbnail', 790 ); // for blog standard add_image_size( 'landscape-thumbnail', 680, 450, true ); // for blog carousel add_image_size( 'portrait-thumbnail', 640, 900, true ); // for filterable portfolio and portfolio carousel add_image_size( 'square-thumbnail', 640, 640, true); // image slideshow add_image_size( 'large-feature-cropped', 1280, 750, true); // image slideshow } endif; // amanda_setup /** * Register our sidebars and widgetized areas. * * @since Amanda 1.0 */ function amanda_widgets_init() { register_sidebar( array( 'name' => __( 'Main Sidebar', 'amanda-lite' ), 'id' => 'sidebar-main', 'before_widget' => '
', 'after_widget' => "
", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Blog Sidebar', 'amanda-lite' ), 'id' => 'sidebar-blog', 'before_widget' => '
', 'after_widget' => "
", 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'amanda_widgets_init' ); // social share require( get_template_directory() . '/inc/mcp-social-share.php' ); // social networks if ( ! function_exists( 'amanda_social_icons' ) ) : function amanda_social_icons(){ $social_icons = array('facebook', 'twitter', 'instagram', 'youtube', 'behance', 'dribbble'); $str = ""; $str .= ''; return $str; } endif; if ( ! function_exists( 'amanda_member_social_networks' ) ) : function amanda_member_social_networks(){ ?> shade; return $new_color; } function amanda_get_px($value){ $value = str_replace("px", "", $value); return $value."px"; } function amanda_get_rgba($hex,$alpha=1){ $hex = str_replace("#", "", $hex); if(strlen($hex) == 3) { $r = hexdec(substr($hex,0,1).substr($hex,0,1)); $g = hexdec(substr($hex,1,1).substr($hex,1,1)); $b = hexdec(substr($hex,2,1).substr($hex,2,1)); } else { $r = hexdec(substr($hex,0,2)); $g = hexdec(substr($hex,2,2)); $b = hexdec(substr($hex,4,2)); } return 'rgba('.$r.','.$g.','.$b.','.$alpha.')'; } function amanda_get_font_settings($fontFamily, $fontVariant, $type){ $websafefonts = array('Garamond', 'Impact', 'Charcoal', 'sans-serif', 'Palatino Linotype', 'Book Antiqua', 'Palatino', 'serif' , 'Tahoma', 'Geneva', 'Century Gothic', 'Lucida Sans Unicode', 'Lucida Grande', 'Arial Black', 'Times New Roman', 'Arial Narrow', 'Verdana', 'Copperplate', 'Copperplate Gothic Light', 'Lucida Console', 'Gill Sans', 'Gill Sans MT', 'Trebuchet MS', 'Helvetica', 'Courier New', 'Arial', 'Georgia'); $setting = ""; if($type=='weight'){ if(in_array($fontFamily, $websafefonts)){ $setting = preg_replace("/(italic)/i", "", $fontVariant); $setting = preg_replace("/(regular)/i", "", $setting); }else{ $setting = preg_replace("/([a-z]+)/i", "", $fontVariant); } if($setting=='' || $setting=="undefined"){ $setting = "normal"; } }else{ if(in_array($fontFamily, $websafefonts)){ $setting = preg_replace("/(bold)/i", "", $fontVariant); }else{ $setting = preg_replace("/([0-9]+)/", "", $fontVariant); } if($setting=='' || $setting=="undefined" || $setting=="regular"){ $setting = "normal"; } } return $setting; } if ( ! function_exists( 'amanda_post_category' ) ) : /** * Prints HTML with category information * Create your own amanda_post_category to override in a child theme * * @since Amanda 1.0 */ function amanda_post_category() { //number_format_i18n // $post_format = get_post_format()!='' ? get_post_format() : 'post'; // $strIcon = amanda_get_icon_by_format($post_format); ?>
', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() ); ?> '.get_the_date("jS F Y"); ?> 0 comments', 'amanda-lite' ), __( '1 comments', 'amanda-lite' ), __( '% comments', 'amanda-lite' ), '', '' ); ?>
/
max_num_pages > 1 ) : ?>

max_num_pages < 2 ) { return; } $paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; $pagenum_link = html_entity_decode( get_pagenum_link() ); $query_args = array(); $url_parts = explode( '?', $pagenum_link ); if ( isset( $url_parts[1] ) ) { wp_parse_str( $url_parts[1], $query_args ); } $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link ); $pagenum_link = trailingslashit( $pagenum_link ) . '%_%'; $format = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : ''; $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%'; // Set up paginated links. $links = paginate_links( array( 'base' => $pagenum_link, 'format' => $format, 'total' => $wp_query->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map( 'urlencode', $query_args ), 'prev_text' => __( 'Newer posts', 'amanda-lite' ), 'next_text' => __( 'Older posts', 'amanda-lite' ), ) ); if ( $links ) : ?> "; } } function amanda_breadcrumbs() { ?> ]+>(.*)<\/[^>]+>'; $url = ''; $matches = array(); if ( preg_match( "/$pattern/", get_the_content(), $matches ) ) { // print_r($matches); $url = $matches[1]; } return $url; } // used for displaying latest tweets if ( !function_exists( 'amanda_get_ago' ) ) { function amanda_get_ago($time) { $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade"); $lengths = array("60","60","24","7","4.35","12","10"); $now = time(); $difference = $now - $time; $tense = "ago"; for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { $difference /= $lengths[$j]; } $difference = round($difference); if($difference != 1) { $periods[$j].= "s"; } return "$difference $periods[$j] ago "; } } function amanda_get_unique_ID($prefix='') { // Generate a Unique ID $date = new DateTime(); $ID = $prefix.$date->getTimestamp().rand(1,999999); return $ID; } // generates columns classes for masonry and isotope plugins function amanda_get_column_css($columns, $ratio=1) { $col_large = 4; $col_medium = 3; $col_small = 2; if($col_large>$columns) $col_large = $columns; if($col_medium>$columns) $col_medium = $columns; if($col_small>$columns) $col_small = $columns; $colWidth = 'col-lg-'.((12/$col_large)*$ratio); $colWidth .= ' col-md-'.((12/$col_medium)*$ratio); $colWidth .= ' col-sm-6 col-xs-12'; return $colWidth; } // generates posts for masonry function amanda_load_posts() { global $paged; global $wp_query; // get your $_GET variables sorted out $category_id = isset($_GET['category']) ? $_GET['category'] : ''; $author_id = isset($_GET['author']) ? $_GET['author'] : ''; $search_id = isset($_GET['search']) ? $_GET['search'] : ''; $tag_id = isset($_GET['tag']) ? $_GET['tag'] : ''; $year = isset($_GET['year']) ? $_GET['year'] : ''; $month = isset($_GET['month']) ? $_GET['month'] : ''; $count = $_GET['count']; $page = isset($_GET['page']) ? $_GET['page'] : '1'; $wp_query = new WP_Query( array( 'post_type' => 'post', 'pagination' => true, 'cat' => $category_id, 'author' => $author_id, 'tag' => $tag_id, 'year'=> $year, 'monthnum'=> $month, 's' => $search_id, 'paged' => $page, 'posts_per_page' => $count, ) ); $count = 1; // initialize your output $str = ''; ob_start(); if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); echo '
'; set_query_var( 'image_size', pogo_get_option( 'blog_image_size', 'landscape-thumbnail') ); get_template_part( 'content', get_post_format() ); echo '
'; $count++; endwhile; endif; $str .= ob_get_clean(); // Reset Query wp_reset_query(); die($str); } add_action('wp_ajax_amanda_load_posts', 'amanda_load_posts'); add_action('wp_ajax_nopriv_amanda_load_posts', 'amanda_load_posts'); // not really needed // get theme option set using Customizer function pogo_get_option($name, $default=false) { // Get option settings from database $options = get_option( 'amanda-lite' ); // Return specific option if ( isset( $options[$name] ) ) { return $options[$name]; } return $default; } // get attachment as an array function amanda_get_attachment( $attachment_id ) { $attachment = get_post( $attachment_id ); if( !is_null($attachment) ) { return array( 'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ), 'caption' => $attachment->post_excerpt, 'description' => $attachment->post_content, 'href' => get_permalink( $attachment->ID ), 'src' => $attachment->guid, 'title' => $attachment->post_title ); }else { return $attachment; } } add_filter('wp_get_attachment_image', 'add_rel_to_gallery'); // add link to gallery to open images in pretty photo if( !function_exists('add_rel_to_gallery') ) { function add_rel_to_gallery($link) { $link = str_replace('> '20', 'size' => 'large', ), $atts ); $out['columns'] = $atts['columns']; $out['size'] = pogo_get_option('blog_image_size','medium-thumbnail'); return $out; } add_filter( 'shortcode_atts_gallery', 'amanda_gallery_atts', 10, 3 );