tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support('title-tag'); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support('post-thumbnails'); /** * Post thumbnail support */ add_theme_support('post-thumbnails', array('post', 'gallery_post')); /** * Widgets support */ add_theme_support('customize-selective-refresh-widgets'); /** * Post format support */ add_theme_support('post-formats', array('image', 'gallery', 'video', 'link', 'quote')); /** * This theme uses wp_nav_menu() in one location. */ register_nav_menu('custom_menu', __('Main Menu', 'andrina-lite')); // Define and register starter content to showcase the theme on new sites. // $starter_content = apply_filters('hustler_starter_content', $starter_content); add_theme_support('starter-content', array( // Set up nav menus for the theme. 'nav_menus' => array( // Assign a menu to the "menu-1" location. 'custom_menu' => array( 'name' => __('Top Menu', 'andrina-lite'), 'items' => array( 'link_home', // Note that the core "home" page is actually a link in case a static front page is not used. ), ), ), 'widgets' => array( // Place three core-defined widgets in the sidebar area. 'primary-widget-area' => array( 'search', 'categories', 'recent-posts', ), 'footer-widget-area1' => array( 'my_html1' => array( // Widget $id -> set when creating a Widget Class 'custom_html', // Widget $instance -> settings array( // 'title' => __( 'Contact', 'andrina-lite' ), 'content' => '
Image
', ), ), 'my_html2' => array( // Widget $id -> set when creating a Widget Class 'custom_html', // Widget $instance -> settings array( // 'title' => 'Widget Area', 'content' => '

' . __('Footer is widgetized. To setup the footer, drag the required Widgets in Appearance - Widgets Tab in the First, Second, Third and Fourth Footer Widget Areas.', 'andrina-lite') . '

', ), ), ), // Add the core-defined business info widget to the footer 1 area. 'footer-widget-area2' => array( 'my_html4' => array( // Widget $id -> set when creating a Widget Class 'custom_html', // Widget $instance -> settings array( 'title' => 'Categories', 'content' => join('', array( "" )), ), ), ), // Put two core-defined widgets in the footer 2 area. 'footer-widget-area3' => array( 'my_html5' => array( // Widget $id -> set when creating a Widget Class 'custom_html', // Widget $instance -> settings array( 'title' => __('Fully Responsive', 'andrina-lite'), 'content' => '

' . __("Andrina is a unique responsive WordPress theme. The theme design is fabulous enough giving your visitors the absolute reason to stay on your site.", "andrina-lite") . '

', ), ), ), 'footer-widget-area4' => array( 'my_html6' => array( // Widget $id -> set when creating a Widget Class 'custom_html', // Widget $instance -> settings array( 'title' => __('Contact Us', 'andrina-lite'), 'content' => join('', array( "" )), ), ), ), ), ) ); } endif; add_action('after_setup_theme', 'andrina_setup'); /** * Styles Enqueue * */ function andrina_add_stylesheet() { /* * recent-post-widget */ // wp_enqueue_style('andrina-recent-post-widget', ANDRINA_DIR_URI . 'includes/widgets/recent-post-widget/css/recent-post-widget.css'); /* * Font Awesome */ wp_enqueue_style('andrina-font_awesome', ANDRINA_DIR_URI . 'assets/css/font-awesome.min.css'); /** * Bootstrap Stylesheet */ wp_enqueue_style('andrina-bootstrap', ANDRINA_DIR_URI . 'assets/css/bootstrap.css'); /** * Animate Stylesheet */ wp_enqueue_style('andrina-animate', ANDRINA_DIR_URI . 'assets/css/animate.css'); /** * Stylesheet to reset the previous styles. */ wp_enqueue_style('andrina-reset', ANDRINA_DIR_URI . 'assets/css/reset.css'); /** * Font Awesome CSS file */ wp_enqueue_style('andrina-font-awesome', ANDRINA_DIR_URI . 'assets/css/font-awesome.css'); /** * Main Stylesheet - Style.css */ wp_enqueue_style('andrina-style', get_stylesheet_uri()); /** * Raleway Font Family */ wp_enqueue_style('andrina-Montserrat-font', '//fonts.googleapis.com/css?family=Montserrat:200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800'); /** * Open Sans Font Family */ wp_enqueue_style('andrina-opensans-font', '//fonts.googleapis.com/css?family=Open+Sans:400,300,500,600,700,800'); /** * Stylesheet of Mean Menu(Mobile Menu) */ wp_enqueue_style('andrina-meanmenu', ANDRINA_DIR_URI . 'assets/css/meanmenu.css'); /** * Stylesheet of Zoombox */ wp_enqueue_style('andrina-zoombox', ANDRINA_DIR_URI . 'assets/css/zoombox.css'); /** * Stylesheet of Flexslider */ wp_enqueue_style('andrina-flexslider', ANDRINA_DIR_URI . 'assets/css/flexslider.css'); /* * Owl Transitions */ wp_enqueue_style('slice-owl-transitions', ANDRINA_DIR_URI . 'assets/css/owl.transitions.css'); /** * File containing CSS for homepage animation */ wp_enqueue_style('slice-hp-animation', ANDRINA_DIR_URI . 'assets/css/andrina_hp_section_animation.css'); /** * Fontello Icons */ wp_enqueue_style('fontello', ANDRINA_DIR_URI . 'assets/css/fontello.css'); /** * Media Query Stylesheet */ wp_enqueue_style('andrina-responsive', ANDRINA_DIR_URI . "assets/css/responsive.css", '', '', 'all'); /** * Font Awesome Library For Icons */ wp_enqueue_style('andrina-fontawesome', ANDRINA_DIR_URI . "assets/font-awesome/css/font-awesome.css", '', '', 'all'); /** * Font Awesome Library For WooCommerce */ wp_enqueue_style('andrina-woocommerce', ANDRINA_DIR_URI . "assets/css/woocommerce.css", '', '', 'all'); } add_action('wp_enqueue_scripts', 'andrina_add_stylesheet'); /** * Enqueue script for custom customize control. */ function theme_slug_custom_customize_enqueue() { wp_enqueue_style('customizer-css', ANDRINA_DIR_URI . 'assets/css/customizer.css'); } add_action('customize_controls_enqueue_scripts', 'theme_slug_custom_customize_enqueue'); /** * jQuery Enqueue * */ function andrina_wp_enqueue_scripts() { if (!is_admin()) { /** * DDSmooth Menu (Navigation Menu) JS File * Dependency : jQuery */ wp_enqueue_script('andrina-ddsmoothmenu', ANDRINA_DIR_URI . 'assets/js/ddsmoothmenu.js', array('jquery')); /** * Tabbed Content JS File * Dependency : jQuery */ // wp_enqueue_script('andrina-slides', ANDRINA_DIR_URI . 'assets/js/slides.min.jquery.js', array('jquery')); wp_enqueue_script('slice-viewportchecker-js', ANDRINA_DIR_URI . 'assets/js/jquery.viewportchecker.js', array('jquery'), '', true); /** * Mean Menu JS File * Dependency : jQuery */ wp_enqueue_script('andrina-meanmenu_js', ANDRINA_DIR_URI . 'assets/js/jquery.meanmenu.js', array('jquery')); /** * Zoom Box JS File * Dependency : jQuery */ wp_enqueue_script('andrina-flexslider', ANDRINA_DIR_URI . 'assets/js/jquery.flexslider.js', array('jquery')); /** * Zoom Box JS File * Dependency : jQuery */ wp_enqueue_script('andrina-zoombox', ANDRINA_DIR_URI . 'assets/js/zoombox.js', array('jquery')); /** * customizer preview * Dependency : jQuery */ //wp_enqueue_script('andrina-preview', ANDRINA_DIR_URI . 'assets/js/customize-preview.js', array('jquery')); /** * jQuery Validate JS File * Dependency : jQuery */ wp_enqueue_script('andrina-validate', ANDRINA_DIR_URI . 'assets/js/jquery.validate.min.js', array('jquery')); /* * masonry jquery */ wp_enqueue_script('andrina-masonry', ANDRINA_DIR_URI . 'assets/js/masonry.pkgd.min.js', array('jquery')); /** * Custom JS File * Dependency : jQuery */ wp_enqueue_script('andrina-custom', ANDRINA_DIR_URI . 'assets/js/custom.js', array('jquery')); /** * Captcha JS File * Dependency : jQuery */ wp_enqueue_script('andrina-recaptcha', 'https://www.google.com/recaptcha/api.js', array('jquery'), true); /** * Comment Reply JS File * */ if (is_singular() and get_site_option('thread_comments')) { wp_enqueue_script('comment-reply'); } } } add_action('wp_enqueue_scripts', 'andrina_wp_enqueue_scripts'); //get the theme option from options array function andrina_get_option($name, $default = '') { // echo $default; $options = get_option('andrina_options'); if (isset($options[$name]) && $options[$name] != '') { return $options[$name]; } } // Save all option in single array function andrina_save_option($option) { if (!empty($option)) { return update_option('andrina_options', $option); } } //update theme option function andrina_update_option($name, $value) { $options = get_option('andrina_options'); $options[$name] = $value; return update_option('andrina_options', $options); } //delete theme option function andrina_delete_option($name) { $options = get_option('andrina_options'); unset($options[$name]); return update_option('andrina_options', $options); } /** * Filters wp_title to print a neat tag based on what is being viewed. * * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string The filtered title. */ function wpdocs_theme_name_wp_title($title, $sep) { if (is_feed()) { return $title; } // global $page, $paged; // Add the blog name $title .= get_bloginfo('name', 'andrina-display'); // Add the blog description for the home/front page. $site_description = get_bloginfo('description', 'andrina-display'); if ($site_description && ( is_home() || is_front_page() )) { $title .= " $sep $site_description"; } return $title; } add_filter('wp_title', 'wpdocs_theme_name_wp_title', 10, 2); /** * Custom Menus Function * */ // Add CLASS attributes to the first <ul> occurence in wp_page_menu function andrina_add_menuclass($ulclass) { return preg_replace('/<ul>/', '<ul class="ddsmoothmenu">', $ulclass, 1); } add_filter('wp_page_menu', 'andrina_add_menuclass'); function andrina_nav() { if (function_exists('wp_nav_menu')) wp_nav_menu(array('theme_location' => 'custom_menu', 'container_id' => 'menu', 'menu_class' => 'ddsmoothmenu', 'fallback_cb' => 'andrina_nav_fallback')); else andrina_nav_fallback(); } function andrina_nav_fallback() { ?> <div id="menu"> <ul class="ddsmoothmenu"> <?php wp_list_pages('title_li=&show_home=1&sort_column=menu_order'); ?> </ul> </div> <?php } function andrina_nav_menu_items($items) { if (is_home()) { $homelink = '<li class="current_page_item">' . '<a href="' . home_url('/') . '">' . __('Home', 'andrina-lite') . '</a></li>'; } else { $homelink = '<li>' . '<a href="' . home_url('/') . '">' . __('Home', 'andrina-lite') . '</a></li>'; } $items = $homelink . $items; return $items; } add_filter('wp_list_pages', 'andrina_nav_menu_items'); function line_fu($atts, $content = null) { return 'some div'; } /** * Breadcrumbs Plugin * */ function andrina_breadcrumbs() { $delimiter = '»'; $home = __('Home', 'andrina-lite'); // text for the 'Home' link $before = '<span class="current">'; // tag before the current crumb $after = '</span>'; // tag after the current crumb echo '<div id="crumbs">'; global $post; $homeLink = home_url(); echo '<a href="' . $homeLink . '">' . $home . '</a> ' . $delimiter . ' '; if (is_404()) { echo $before . __('Error 404', 'andrina-lite') . $after; } elseif (is_category()) { global $wp_query; $cat_obj = $wp_query->get_queried_object(); $thisCat = $cat_obj->term_id; $thisCat = get_category($thisCat); $parentCat = get_category($thisCat->parent); if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' ')); echo $before . __('Archive by category "', 'andrina-lite') . single_cat_title('', false) . '"' . $after; } elseif (is_day()) { echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> ' . $delimiter . ' '; echo '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . get_the_time('F') . '</a> ' . $delimiter . ' '; echo $before . get_the_time('d') . $after; } elseif (is_month()) { echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> ' . $delimiter . ' '; echo $before . get_the_time('F') . $after; } elseif (is_year()) { echo $before . get_the_time('Y') . $after; } elseif (is_single() && !is_attachment()) { if (get_post_type() != 'post') { $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; echo '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a> ' . $delimiter . ' '; echo $before . get_the_title() . $after; } else { $cat = get_the_category(); $cat = $cat[0]; echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' '); echo $before . get_the_title() . $after; } } elseif (!is_single() && !is_page() && get_post_type() != 'post') { $post_type = get_post_type_object(get_post_type()); echo $before . $post_type->labels->singular_name . $after; } elseif (is_attachment()) { $parent = get_post($post->post_parent); $cat = get_the_category($parent->ID); $cat = $cat[0]; echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' '); echo '<a href="' . get_permalink($parent) . '">' . $parent->post_title . '</a> ' . $delimiter . ' '; echo $before . get_the_title() . $after; } elseif (is_page() && !$post->post_parent) { echo $before . get_the_title() . $after; } elseif (is_page() && $post->post_parent) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>'; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); foreach ($breadcrumbs as $crumb) echo $crumb . ' ' . $delimiter . ' '; echo $before . get_the_title() . $after; } elseif (is_search()) { echo $before . __('Search results for "', 'andrina-lite') . get_search_query() . '"' . $after; } elseif (is_tag()) { echo $before . __('Posts tagged "', 'andrina-lite') . single_tag_title('', false) . '"' . $after; } elseif (is_author()) { global $author; $userdata = get_userdata($author); echo $before . __('Articles posted by ', 'andrina-lite') . $userdata->display_name . $after; } elseif (is_404()) { echo $before . __('Error 404', 'andrina-lite') . $after; } if (get_query_var('paged')) { if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) echo ' ('; printf(__('Page %s', 'andrina-lite'), get_query_var('paged')); if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) echo ')'; } echo '</div>'; } /** * Function to call first uploaded image in functions file * */ /** * This function thumbnail id and * returns thumbnail image * @param type $iw * @param type $ih */ function andrina_get_thumbnail($iw, $ih) { $permalink = get_permalink(); $thumb = get_post_thumbnail_id(); $image = andrina_thumbnail_resize($thumb, '', $iw, $ih, true, 90); if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) { print "<a href='$permalink'><img class='postimg' src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' /></a>"; } } /** * This function gets image width and height and * Prints attached images from the post */ function andrina_get_image($width, $height) { $w = $width; $h = $height; global $post, $posts; //This is required to set to Null $img_source = ''; /* $permalink = get_permalink($id); */ $permalink = get_permalink(); ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); if (isset($matches [1] [0])) { $img_source = $matches [1] [0]; $img_path = andrina_image_resize($img_source, $w, $h); if (!empty($img_path['url'])) { print "<a href='$permalink'><img src='{$img_path['url']}' class='postimg' alt='Post Image'/></a>"; } } } /** * Register widgetized areas, including two sidebars and four widget-ready columns in the footer. * * To override twentyten_widgets_init() in a child theme, remove the action hook and add your own * function tied to the init hook. * * @uses register_sidebar */ function andrina_widgets_init() { // Area 1, located at the top of the sidebar. register_sidebar(array( 'name' => __('Primary Widget Area', 'andrina-lite'), 'id' => 'primary-widget-area', 'description' => __('The primary widget area', 'andrina-lite'), 'before_widget' => '<aside id="%1$s" class="sidebar_widget_wrapper %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="sidebar_widget_title">', 'after_title' => '</div>' )); //Area , located at first blog section on right side register_sidebar(array( 'name' => esc_html__('Right side of first blog section widget', 'andrina-lite'), 'id' => 'bolg_first_right', 'description' => esc_html__('Add widgets here.', 'andrina-lite'), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4><div class="widget-title-underline"></div>', )); //Area , located at blog section on right side register_sidebar(array( 'name' => esc_html__('Right side blog section widget', 'andrina-lite'), 'id' => 'bolg_right', 'description' => esc_html__('Add widgets here.', 'andrina-lite'), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4><div class="widget-title-underline"></div>', )); // Area 3, located in the footer. Empty by default. register_sidebar(array( 'name' => __('First Footer Widget Area', 'andrina-lite'), 'id' => 'footer-widget-area1', 'description' => __('The first footer widget area', 'andrina-lite'), 'before_widget' => '<aside id="%1$s" class="footer_widget_wrapper %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="footer_widget_title">', 'after_title' => '</div>' )); // Area 4, located in the footer. Empty by default. register_sidebar(array( 'name' => __('Second Footer Widget Area', 'andrina-lite'), 'id' => 'footer-widget-area2', 'description' => __('The second footer widget area', 'andrina-lite'), 'before_widget' => '<aside id="%1$s" class="footer_widget_wrapper %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="footer_widget_title">', 'after_title' => '</div>' )); // Area 5, located in the footer. Empty by default. register_sidebar(array( 'name' => __('Third Footer Widget Area', 'andrina-lite'), 'id' => 'footer-widget-area3', 'description' => __('The third footer widget area', 'andrina-lite'), 'before_widget' => '<aside id="%1$s" class="footer_widget_wrapper %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="footer_widget_title">', 'after_title' => '</div>' )); // Area 5, located in the footer. Empty by default. register_sidebar(array( 'name' => __('Fourth Footer Widget Area', 'andrina-lite'), 'id' => 'footer-widget-area4', 'description' => __('The fourth footer widget area', 'andrina-lite'), 'before_widget' => '<aside id="%1$s" class="footer_widget_wrapper %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="footer_widget_title">', 'after_title' => '</div>' )); // Area 5, located in the footer. Empty by default. register_sidebar(array( 'name' => __('Home Page Sidebar Widget Area', 'andrina-lite'), 'id' => 'homepage-sidebar-widget-area', 'description' => __('The homepage sidebar widget area', 'andrina-lite'), 'before_widget' => '<aside id="%1$s" class="homepage_sidebar_widget_wrapper %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="homepage_sidebar_widget_title">', 'after_title' => '</div>' )); } /** Register sidebars by running andrina_widgets_init() on the widgets_init hook. */ add_action('widgets_init', 'andrina_widgets_init'); /** * Pagination * */ function andrina_pagination($pages = '', $range = 2) { $showitems = ($range * 2) + 1; global $paged; if (empty($paged)) $paged = 1; if ($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if (!$pages) { $pages = 1; } } if (1 != $pages) { echo "<ul class='paging'>"; if ($paged > 2 && $paged > $range + 1 && $showitems < $pages) echo "<li><a href='" . get_pagenum_link(1) . "'>«</a></li>"; if ($paged > 1 && $showitems < $pages) echo "<li><a href='" . get_pagenum_link($paged - 1) . "'>‹</a></li>"; for ($i = 1; $i <= $pages; $i++) { if (1 != $pages && (!($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $showitems )) { echo ($paged == $i) ? "<li><a href='" . get_pagenum_link($i) . "' class='current' >" . $i . "</a></li>" : "<li><a href='" . get_pagenum_link($i) . "' class='inactive' >" . $i . "</a></li>"; } } if ($paged < $pages && $showitems < $pages) echo "<li><a href='" . get_pagenum_link($paged + 1) . "'>›</a></li>"; if ($paged < $pages - 1 && $paged + $range - 1 < $pages && $showitems < $pages) echo "<li><a href='" . get_pagenum_link($pages) . "'>»</a></li>"; echo "</ul>\n"; } } /////////Theme Options /** * Add Favicon * */ function andrina_childtheme_favicon() { if (andrina_get_option('andrina_favicon') != '') { echo '<link rel="shortcut icon" href="' . esc_url(andrina_get_option('andrina_favicon')) . '"/>' . "\n"; } } add_action('wp_head', 'andrina_childtheme_favicon'); /** * Custom CSS Styles * */ function andrina_of_head_css() { $output = ''; $custom_css = andrina_get_option('inkthemes_customcss'); if ($custom_css <> '') { $output .= $custom_css . "\n"; } // Output styles if ($output <> '') { $output = "<!-- Custom Styling -->\n<style type=\"text/css\">\n" . $output . "</style>\n"; echo $output; } } add_action('wp_head', 'andrina_of_head_css'); function andrina_get_category_id($cat_name) { $term = get_term_by('name', $cat_name, 'category'); return $term->term_id; } //Trim excerpt function andrina_custom_trim_excerpt($length) { global $post; $explicit_excerpt = $post->post_excerpt; if ('' == $explicit_excerpt) { $text = get_the_content(''); $text = apply_filters('the_content', $text); $text = str_replace(']]>', ']]>', $text); } else { $text = apply_filters('the_content', $explicit_excerpt); } $text = strip_shortcodes($text); // optional $text = strip_tags($text); $excerpt_length = $length; $words = explode(' ', $text, $excerpt_length + 1); if (count($words) > $excerpt_length) { array_pop($words); array_push($words, '[…]'); $text = implode(' ', $words); $text = apply_filters('the_excerpt', $text); } return $text; } /** * The Gallery shortcode. * * This implements the functionality of the Gallery Shortcode for displaying * WordPress images on a post. * * @since 2.5.0 * * @param array $attr Attributes of the shortcode. * @return string HTML content to display gallery. */ //remove_shortcode('gallery'); function andrina_gallery_shortcode($attr) { $post = get_post(); static $instance = 0; $instance++; if (!empty($attr['ids'])) { // 'ids' is explicitly ordered, unless you specify otherwise. if (empty($attr['orderby'])) $attr['orderby'] = 'post__in'; $attr['include'] = $attr['ids']; } // Allow plugins/themes to override the default gallery template. $output = apply_filters('post_gallery', '', $attr); if ($output != '') return $output; // We're trusting author input, so let's at least make sure it looks like a valid orderby statement if (isset($attr['orderby'])) { $attr['orderby'] = sanitize_sql_orderby($attr['orderby']); if (!$attr['orderby']) unset($attr['orderby']); } extract(shortcode_atts(array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '' ), $attr)); $id = intval($id); if ('RAND' == $order) $orderby = 'none'; if (!empty($include)) { $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); $attachments = array(); foreach ($_attachments as $key => $val) { $attachments[$val->ID] = $_attachments[$key]; } } elseif (!empty($exclude)) { $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } else { $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } if (empty($attachments)) return ''; if (is_feed()) { $output = "\n"; foreach ($attachments as $att_id => $attachment) $output .= wp_get_attachment_link($att_id, $size, true) . "\n"; return $output; } $itemtag = tag_escape($itemtag); $captiontag = tag_escape($captiontag); $columns = intval($columns); $itemwidth = $columns > 0 ? floor(100 / $columns) : 100; $float = is_rtl() ? 'right' : 'left'; $selector = "gallery-{$instance}"; $gallery_style = $gallery_div = ''; if (apply_filters('use_default_gallery_style', true)) $gallery_style = " <style type='text/css'> #{$selector} { margin: auto; } #{$selector} .gallery-item { float: {$float}; margin-top: 10px; text-align: center; width: {$itemwidth}%; } #{$selector} img { } #{$selector} .gallery-caption { margin-left: 0; } </style> <!-- see gallery_shortcode() in wp-includes/media.php -->"; $size_class = sanitize_html_class($size); $gallery_div = "<div id='$selector' class='$selector gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>"; $gallery_ul = "<ul class='thumbnail col-{$columns}'>"; $output = apply_filters('gallery_style', $gallery_style . "\n\t\t" . $gallery_div . $gallery_ul); $i = 0; foreach ($attachments as $gallery_image) { $attachment_img = wp_get_attachment_url($gallery_image->ID); $img_source = andrina_image_resize($attachment_img, 1110, 638); if (is_single()) { // $img_source = realphotography_image_resize($attachment_img, 350, 250); } $class_name = ''; $i++; switch ($columns) { case 1: // $class_name = "col-md-12 col-sm-12 col-xs-12"; break; case 2: // $class_name = "col-md-6 col-sm-12 col-xs-12"; break; case 3: // $class_name = "col-md-4 col-sm-6 col-xs-12"; break; case 4: // $class_name = "col-md-3 col-sm-6 col-xs-12"; break; case 5: if (($i % 5) == 1) { // $offset = "col-md-offset-1"; } else { // $offset = ""; } // $class_name = "col-md-2 $offset col-sm-4 col-xs-12"; break; case 6: // $class_name = "col-md-2 col-sm-4 col-xs-12"; break; default: // $class_name = "col-md-2 col-sm-4 col-xs-12"; break; } $output .= "<div class='$class_name animated displaywell'>"; $output .= '<a class="zoombox zgallery1" rel="prettyPhoto[gallery2]" alt="' . $gallery_image->post_excerpt . '" href="' . $attachment_img . '">'; $output .= '<img src="' . $img_source['url'] . '" alt=""/>'; $output .= '</a>'; $output .= '<a class="gall-content" href="' . '?attachment_id=' . $gallery_image->ID . '">'; // $output .= '<div class="overlay"><div class="spread_icon"></div></div>'; $output .= $gallery_image->post_excerpt; $output .= '</a>'; $output .= "</div>"; } $output .= " <br style='clear: both;' /> </ul>\n </div>"; return $output; } function andrina_body_background() { $bg_url = esc_url(andrina_get_option('andrina_bodybg')); ?> <!-- <style type="text/css"> body { background: url('<?php echo $bg_url; ?>'); } </style> --> <?php } add_action('wp_head', 'andrina_body_background'); /** * Return the post URL. * * Falls back to the post permalink if no URL is found in the post. * * @return string The Link format URL. */ function andrina_get_link_url() { $has_url = get_url_in_content(get_the_content()); return $has_url ? $has_url : apply_filters('the_permalink', get_permalink()); } /** * Thumbnail Resize For Blogs * */ function andrina_get_thumbnail_blog($iw, $ih) { $id = ""; $permalink = get_permalink($id); $thumb = get_post_thumbnail_id(); if ($thumb) { $image = andrina_thumbnail_resize($thumb, '', $iw, $ih, true, 90); if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) { print "<img class='aligncenter sb-thumb-img' src='$image[url]' width='$image[width]' height='$image[height]' alt='thumbnail' />"; } } } function andrina_sanitize_html($value) { $array = wp_kses_allowed_html('post'); $allowedtags = array( 'iframe' => array( 'width' => array(), 'height' => array(), 'frameborder' => array(), 'scrolling' => array(), 'src' => array(), 'marginwidth' => array(), 'marginheight' => array(), ), 'script' => array( 'type' => array(), 'src' => array() ), 'i' => array( 'class' => array() ) ); $data = array_merge($allowedtags, $array); $value = wp_kses($value, $data); return $value; } function andrina_feature_box_option_generator_shortcode($atts) { $atts1 = shortcode_atts($atts, $content = 'null'); ?> <div class="col-md-3 col-sm-6"> <div class="feature-item"> <div class="feature_item_img"> <?php if ($atts['featureimg'] != '') { ?> <a href="<?php echo esc_url($atts['featurelink']); ?>"><img src="<?php echo $atts['featureimg']; ?>" alt="<?php _e('Feature Image', 'andrina-lite'); ?>"/></a> <?php } else { ?> <a href="#"><img src="<?php echo ANDRINA_DIR_URI; ?>assets/images/img.jpg" alt="Feature Image 1"/></a> <?php } ?> </div> <div class="img_con"> <?php if ($atts['featuretitle'] != '') { ?> <h4> <?php echo wp_kses_post($atts['featuretitle']); ?> </h4> <?php } else { ?> <h4> <?php _e('Pretty Theme.', 'andrina-lite'); ?> </h4> <?php } if ($atts['featuredesc'] != '') { ?> <p> <?php echo wp_kses_post($atts['featuredesc']); ?> </p> <?php } else { ?> <p> <?php _e('Andrina is a unique responsive WordPress theme. The theme design is fabulous enough giving your visitors the absolute reason to stay on your site.', 'andrina-lite'); ?> </p> <?php } ?> </div> </div> </div> <?php } function andrina_svg($color = '#f5f5f5') { ?> <div class="my_svg"> <svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="1122.000000pt" height="16.000000pt" viewBox="0 0 1122.000000 16.000000" preserveAspectRatio="xMidYMid meet"> <metadata> Created by potrace 1.14, written by Peter Selinger 2001-2017 </metadata> <g transform="translate(0.000000,16.000000) scale(0.100000,-0.100000)" fill="<?php echo $color; ?>" stroke="none"> <path d="M0 85 l0 -75 58 0 c31 0 131 5 222 10 91 5 379 18 640 29 1556 66 2826 91 4610 91 1974 0 3639 -39 5360 -125 162 -8 303 -15 313 -15 15 0 17 10 17 80 l0 80 -5610 0 -5610 0 0 -75z"/> </g> </svg> </div> <?php } /* * WooCommerce Support */ add_action('after_setup_theme', 'woocommerce_support'); function woocommerce_support() { add_theme_support('woocommerce'); } function andrina_tracking_admin_notice() { global $current_user; $user_id = $current_user->ID; /* Check that the user hasn't already clicked to ignore the message */ if (!get_user_meta($user_id, 'wp_email_tracking_ignore_notice')) { ?> <div class="updated um-admin-notice"><p><?php _e('Allow Andrina theme to send you setup guide? Opt-in to our newsletter and we will immediately e-mail you a setup guide along with 20% discount which you can use to purchase any theme.', 'andrina-lite'); ?></p><p><a href="<?php echo get_template_directory_uri() . '/includes/smtp.php?wp_email_tracking=email_smtp_allow_tracking'; ?>" class="button button-primary"><?php _e('Allow Sending', 'andrina-lite'); ?></a> <a href="<?php echo get_template_directory_uri() . '/includes/smtp.php?wp_email_tracking=email_smtp_hide_tracking'; ?>" class="button-secondary"><?php _e('Do not allow', 'andrina-lite'); ?></a></p></div> <?php } } add_action('admin_notices', 'andrina_tracking_admin_notice'); /* * * Enqueue Google Fonts */ //function andrina_gfonts_scripts() { // wp_enqueue_style('andrina-google-fonts', andrina_google_fonts()); // add_action('wp_head', 'andrina_typography'); //} //add_action('wp_enqueue_scripts', 'andrina_gfonts_scripts'); // //$fonts = array('ABeeZee', 'Abel', 'Abril Fatface', 'Aclonica', 'Acme', 'Actor', 'Adamina', 'Advent Pro', 'Aguafina Script', 'Akronim', 'Aladin', 'Aldrich', 'Alef', 'Alegreya', 'Alegreya SC', 'Alex Brush', 'Alfa Slab One', 'Alice', 'Alike', 'Alike Angular', 'Allan', 'Allerta', 'Allerta Stencil', 'Allura', 'Almendra', 'Almendra Display', 'Almendra SC', 'Amarante', 'Amaranth', 'Amatic SC', 'Amethysta', 'Anaheim', 'Andada', 'Andika', 'Angkor', 'Annie Use Your Telescope', 'Anonymous Pro', 'Antic', 'Antic Didone', 'Antic Slab', 'Anton', 'Arapey', 'Arbutus', 'Arbutus Slab', 'Architects Daughter', 'Archivo Black', 'Archivo Narrow', 'Arial Black', 'Arial Narrow', 'Arimo', 'Arizonia', 'Armata', 'Artifika', 'Arvo', 'Asap', 'Asset', 'Astloch', 'Asul', 'Atomic Age', 'Aubrey', 'Audiowide', 'Autour One', 'Average', 'Average Sans', 'Averia Gruesa Libre', 'Averia Libre', 'Averia Sans Libre', 'Averia Serif Libre', 'Bad Script', 'Balthazar', 'Bangers', 'Basic', 'Battambang', 'Baumans', 'Bayon', 'Belgrano', 'Bell MT', 'Bell MT Alt', 'Belleza', 'BenchNine', 'Bentham', 'Berkshire Swash', 'Bevan', 'Bigelow Rules', 'Bigshot One', 'Bilbo', 'Bilbo Swash Caps', 'Bitter', 'Black Ops One', 'Bodoni', 'Bokor', 'Bonbon', 'Boogaloo', 'Bowlby One', 'Bowlby One SC', 'Brawler', 'Bree Serif', 'Bubblegum Sans', 'Bubbler One', 'Buenard', 'Butcherman', 'Butcherman Caps', 'Butterfly Kids', 'Cabin', 'Cabin Condensed', 'Cabin Sketch', 'Caesar Dressing', 'Cagliostro', 'Calibri', 'Calligraffitti', 'Cambo', 'Cambria', 'Candal', 'Cantarell', 'Cantata One', 'Cantora One', 'Capriola', 'Cardo', 'Carme', 'Carrois Gothic', 'Carrois Gothic SC', 'Carter One', 'Caudex', 'Cedarville Cursive', 'Ceviche One', 'Changa One', 'Chango', 'Chau Philomene One', 'Chela One', 'Chelsea Market', 'Chenla', 'Cherry Cream Soda', 'Cherry Swash', 'Chewy', 'Chicle', 'Chivo', 'Cinzel', 'Cinzel Decorative', 'Clara', 'Clicker Script', 'Coda', 'Codystar', 'Combo', 'Comfortaa', 'Coming Soon', 'Concert One', 'Condiment', 'Consolas', 'Content', 'Contrail One', 'Convergence', 'Cookie', 'Copse', 'Corben', 'Corsiva', 'Courgette', 'Courier New', 'Cousine', 'Coustard', 'Covered By Your Grace', 'Crafty Girls', 'Creepster', 'Creepster Caps', 'Crete Round', 'Crimson Text', 'Croissant One', 'Crushed', 'Cuprum', 'Cutive', 'Cutive Mono', 'Damion', 'Dancing Script', 'Dangrek', 'Dawning of a New Day', 'Days One', 'Delius', 'Delius Swash Caps', 'Delius Unicase', 'Della Respira', 'Denk One', 'Devonshire', 'Dhyana', 'Didact Gothic', 'Diplomata', 'Diplomata SC', 'Domine', 'Donegal One', 'Doppio One', 'Dorsa', 'Dosis', 'Dr Sugiyama', 'Droid Arabic Kufi', 'Droid Arabic Naskh', 'Droid Sans', 'Droid Sans Mono', 'Droid Sans TV', 'Droid Serif', 'Duru Sans', 'Dynalight', 'EB Garamond', 'Eagle Lake', 'Eater', 'Eater Caps', 'Economica', 'Electrolize', 'Elsie', 'Elsie Swash Caps', 'Emblema One', 'Emilys Candy', 'Engagement', 'Englebert', 'Enriqueta', 'Erica One', 'Esteban', 'Euphoria Script', 'Ewert', 'Exo', 'Expletus Sans', 'Fanwood Text', 'Fascinate', 'Fascinate Inline', 'Faster One', 'Fasthand', 'Fauna One', 'Federant', 'Federo', 'Felipa', 'Fenix', 'Finger Paint', 'Fjalla One', 'Fjord One', 'Flamenco', 'Flavors', 'Fondamento', 'Fontdiner Swanky', 'Forum', 'Francois One', 'Freckle Face', 'Fredericka the Great', 'Fredoka One', 'Freehand', 'Fresca', 'Frijole', 'Fruktur', 'Fugaz One', 'GFS Didot', 'GFS Neohellenic', 'Gabriela', 'Gafata', 'Galdeano', 'Galindo', 'Garamond', 'Gentium Basic', 'Gentium Book Basic', 'Geo', 'Geostar', 'Geostar Fill', 'Germania One', 'Gilda Display', 'Give You Glory', 'Glass Antiqua', 'Glegoo', 'Gloria Hallelujah', 'Goblin One', 'Gochi Hand', 'Gorditas', 'Goudy Bookletter 1911', 'Graduate', 'Grand Hotel', 'Gravitas One', 'Great Vibes', 'Griffy', 'Gruppo', 'Gudea', 'Habibi', 'Hammersmith One', 'Hanalei', 'Hanalei Fill', 'Handlee', 'Hanuman', 'Happy Monkey', 'Headland One', 'Helvetica Neue', 'Henny Penny', 'Herr Von Muellerhoff', 'Holtwood One SC', 'Homemade Apple', 'Homenaje', 'IM Fell DW Pica', 'IM Fell DW Pica SC', 'IM Fell Double Pica', 'IM Fell Double Pica SC', 'IM Fell English', 'IM Fell English SC', 'IM Fell French Canon', 'IM Fell French Canon SC', 'IM Fell Great Primer', 'IM Fell Great Primer SC', 'Iceberg', 'Iceland', 'Imprima', 'Inconsolata', 'Inder', 'Indie Flower', 'Inika', 'Irish Grover', 'Irish Growler', 'Istok Web', 'Italiana', 'Italianno', 'Jacques Francois', 'Jacques Francois Shadow', 'Jim Nightshade', 'Jockey One', 'Jolly Lodger', 'Josefin Sans', 'Josefin Sans Std Light', 'Josefin Slab', 'Joti One', 'Judson', 'Julee', 'Julius Sans One', 'Junge', 'Jura', 'Just Another Hand', 'Just Me Again Down Here', 'Kameron', 'Karla', 'Kaushan Script', 'Kavoon', 'Keania One', 'Kelly Slab', 'Kenia', 'Khmer', 'Kite One', 'Knewave', 'Kotta One', 'Koulen', 'Kranky', 'Kreon', 'Kristi', 'Krona One', 'La Belle Aurore', 'Lancelot', 'Lateef', 'Lato', 'League Script', 'Leckerli One', 'Ledger', 'Lekton', 'Lemon', 'Lemon One', 'Libre Baskerville', 'Life Savers', 'Lilita One', 'Lily Script One', 'Limelight', 'Linden Hill', 'Lobster', 'Lobster Two', 'Lohit Bengali', 'Lohit Devanagari', 'Lohit Tamil', 'Londrina Outline', 'Londrina Shadow', 'Londrina Sketch', 'Londrina Solid', 'Lora', 'Love Ya Like A Sister', 'Loved by the King', 'Lovers Quarrel', 'Luckiest Guy', 'Lusitana', 'Lustria', 'Macondo', 'Macondo Swash Caps', 'Magra', 'Maiden Orange', 'Mako', 'Marcellus', 'Marcellus SC', 'Marck Script', 'Margarine', 'Marko One', 'Marmelad', 'Marvel', 'Mate', 'Mate SC', 'Maven Pro', 'McLaren', 'Meddon', 'MedievalSharp', 'Medula One', 'Megrim', 'Meie Script', 'Merienda', 'Merienda One', 'Merriweather', 'Merriweather Sans', 'Metal', 'Metal Mania', 'Metamorphous', 'Metrophobic', 'Michroma', 'Milonga', 'Miltonian', 'Miltonian Tattoo', 'Miniver', 'Miss Fajardose', 'Miss Saint Delafield', 'Modern Antiqua', 'Molengo', 'Monda', 'Monofett', 'Monoton', 'Monsieur La Doulaise', 'Montaga', 'Montez', 'Montserrat', 'Montserrat Alternates', 'Montserrat Subrayada', 'Moul', 'Moulpali', 'Mountains of Christmas', 'Mouse Memoirs', 'Mr Bedford', 'Mr Bedfort', 'Mr Dafoe', 'Mr De Haviland', 'Mrs Saint Delafield', 'Mrs Sheppards', 'Muli', 'Mystery Quest', 'Neucha', 'Neuton', 'New Rocker', 'News Cycle', 'Niconne', 'Nixie One', 'Nobile', 'Nokora', 'Norican', 'Nosifer', 'Nosifer Caps', 'Nothing You Could Do', 'Noticia Text', 'Noto Sans', 'Noto Sans UI', 'Noto Serif', 'Nova Cut', 'Nova Flat', 'Nova Mono', 'Nova Oval', 'Nova Round', 'Nova Script', 'Nova Slim', 'Nova Square', 'Numans', 'Nunito', 'OFL Sorts Mill Goudy TT', 'Odor Mean Chey', 'Offside', 'Old Standard TT', 'Oldenburg', 'Oleo Script', 'Oleo Script Swash Caps', 'Open Sans', 'Oranienbaum', 'Orbitron', 'Oregano', 'Orienta', 'Original Surfer', 'Oswald', 'Over the Rainbow', 'Overlock', 'Overlock SC', 'Ovo', 'Oxygen', 'Oxygen Mono', 'PT Mono', 'PT Sans', 'PT Sans Caption', 'PT Sans Narrow', 'PT Serif', 'PT Serif Caption', 'Pacifico', 'Paprika', 'Parisienne', 'Passero One', 'Passion One', 'Pathway Gothic One', 'Patrick Hand', 'Patrick Hand SC', 'Patua One', 'Paytone One', 'Peralta', 'Permanent Marker', 'Petit Formal Script', 'Petrona', 'Philosopher', 'Piedra', 'Pinyon Script', 'Pirata One', 'Plaster', 'Play', 'Playball', 'Playfair Display', 'Playfair Display SC', 'Podkova', 'Poiret One', 'Poller One', 'Poly', 'Pompiere', 'Pontano Sans', 'Port Lligat Sans', 'Port Lligat Slab', 'Prata', 'Preahvihear', 'Press Start 2P', 'Princess Sofia', 'Prociono', 'Prosto One', 'Proxima Nova', 'Proxima Nova Tabular Figures', 'Puritan', 'Purple Purse', 'Quando', 'Quantico', 'Quattrocento', 'Quattrocento Sans', 'Questrial', 'Quicksand', 'Quintessential', 'Qwigley', 'Racing Sans One', 'Radley', 'Raleway', 'Raleway Dots', 'Rambla', 'Rammetto One', 'Ranchers', 'Rancho', 'Rationale', 'Redressed', 'Reenie Beanie', 'Revalia', 'Ribeye', 'Ribeye Marrow', 'Righteous', 'Risque', 'Roboto', 'Roboto Condensed', 'Roboto Slab', 'Rochester', 'Rock Salt', 'Rokkitt', 'Romanesco', 'Ropa Sans', 'Rosario', 'Rosarivo', 'Rouge Script', 'Ruda', 'Rufina', 'Ruge Boogie', 'Ruluko', 'Rum Raisin', 'Ruslan Display', 'Russo One', 'Ruthie', 'Rye', 'Sacramento', 'Sail', 'Salsa', 'Sanchez', 'Sancreek', 'Sansita One','Sans Serif', 'Sarina', 'Satisfy', 'Scada', 'Scheherazade', 'Schoolbell', 'Seaweed Script', 'Sevillana', 'Seymour One', 'Shadows Into Light', 'Shadows Into Light Two', 'Shanti', 'Share', 'Share Tech', 'Share Tech Mono', 'Shojumaru', 'Short Stack', 'Siamreap', 'Siemreap', 'Sigmar One', 'Signika', 'Signika Negative', 'Simonetta', 'Sintony', 'Sirin Stencil', 'Six Caps', 'Skranji', 'Slackey', 'Smokum', 'Smythe', 'Snippet', 'Snowburst One', 'Sofadi One', 'Sofia', 'Sonsie One', 'Sorts Mill Goudy', 'Source Code Pro', 'Source Sans Pro', 'Special Elite', 'Spicy Rice', 'Spinnaker', 'Spirax', 'Squada One', 'Stalemate', 'Stalin One', 'Stalinist One', 'Stardos Stencil', 'Stint Ultra Condensed', 'Stint Ultra Expanded', 'Stoke', 'Strait', 'Sue Ellen Francisco', 'Sunshiney', 'Supermercado One', 'Suwannaphum', 'Swanky and Moo Moo', 'Syncopate', 'Tahoma', 'Tangerine', 'Taprom', 'Tauri', 'Telex', 'Tenor Sans', 'Terminal Dosis', 'Terminal Dosis Light', 'Text Me One', 'Thabit', 'The Girl Next Door', 'Tienne', 'Tinos', 'Titan One', 'Titillium Web', 'Trade Winds', 'Trocchi', 'Trochut', 'Trykker', 'Tulpen One', 'Ubuntu', 'Ubuntu Condensed', 'Ubuntu Mono', 'Ultra', 'Uncial Antiqua', 'Underdog', 'Unica One', 'UnifrakturMaguntia', 'Unkempt', 'Unlock', 'Unna', 'VT323', 'Vampiro One', 'Varela', 'Varela Round', 'Vast Shadow', 'Vibur', 'Vidaloka', 'Viga', 'Voces', 'Volkhov', 'Vollkorn', 'Voltaire', 'Waiting for the Sunrise', 'Wallpoet', 'Walter Turncoat', 'Warnes', 'Wellfleet', 'Wendy One', 'Wire One', 'Yanone Kaffeesatz', 'Yellowtail', 'Yeseva One', 'Yesteryear', 'Zeyada', 'jsMath cmbx10', 'jsMath cmex10', 'jsMath cmmi10', 'jsMath cmr10', 'jsMath cmsy10', 'jsMath cmti10'); // ///* String of Google fonts */ //function andrina_google_fonts() { // global $fonts; // $fonts_collection = add_query_arg(array( // "family" => urlencode(implode("|", $fonts)), // "subset" => "latin" // ), 'https://fonts.googleapis.com/css'); // return $fonts_collection; //} // ///* typography style CSS code function */ //function andrina_typography() { // global $fonts; // // $index = andrina_get_option('typography_logo_family'); // $index1 = andrina_get_option('typography_nav_family'); // //if (andrina_get_option('typography_logo_family')!=''){ // echo "<style type='text/css'> .logo{ font-family: " . $fonts[$index] . ", sans-serif!important; font-weight:500; }</style>"; //} // //if (andrina_get_option('typography_nav_family')!=''){ // echo "<style type='text/css'> body{ font-family: " . $fonts[$index1] . ", sans-serif!important; font-weight:500; }</style>"; // //} //} //$wp_customize->selective_refresh->add_partial( 'second-footer-widget-area', array( // 'selector' => '.widget_inner', // You can also select a css class //) );