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')); /** * 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')); } 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'); /** * Stylesheet to reset the previous styles. */ // wp_enqueue_style('andrina-customizer-css', ANDRINA_DIR_URI . 'assets/css/customizer.css'); /** * Shortcode Stylesheet */ wp_enqueue_style('shortcodes', ANDRINA_DIR_URI . "assets/css/shortcode.css", '', '', 'all'); /** * 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 Icons */ 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')); /** * 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"; } // Add a page number if necessary: // if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { // $title .= " $sep " . sprintf( __( 'Page %s', '_s' ), max( $paged, $page ) ); // } 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>"; } }else{ print "<a href='$permalink'><img src='".ANDRINA_DIR_URI."assets/images/blog.png' 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' => 'first-footer-widget-area', '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' => 'second-footer-widget-area', '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' => 'third-footer-widget-area', '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' => 'fourth-footer-widget-area', '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' />"; } }else{ print "<img class='aligncenter sb-thumb-img' src='".ANDRINA_DIR_URI."assets/images/blog.png' 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('Theme Heading pretty.', 'andrina-lite'); ?> </h4> <?php } if ($atts['featuredesc'] != '') { ?> <p> <?php echo wp_kses_post($atts['featuredesc']); ?> </p> <?php } else { ?> <p> <?php _e('Lorem ipsum dolor sit amet, are to seg an elit. Duis nec purus a quis puar a tortor, quis puar a tortor.', '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' ); } /** * Theme options to customizer migration function */ function theme_options_to_customizer(){ $customizer_data = array(); /* *Fetch all the theme options ids */ $theme_options_data = get_option('inkthemes_options'); /* *To display theme options */ // echo "<pre>==="; // print_r($theme_options_data); // echo "</pre>"; /* * Replacing inkthemes string with theme name */ foreach ($theme_options_data as $key => $value) { if (stripos("'.$key.'", 'inkthemes') !== false) { $key = str_replace("inkthemes", "andrina", $key); $customizer_data[$key] = $value; } else { $customizer_data[$key] = $value; } } /* *To display theme customizer options */ // echo "<pre>"; // print_r($customizer_data); // echo "</pre>"; /** * Updating the customizer options */ update_option('andrina_options', $customizer_data); } /** *Checking data migrating status (Theme options to Customizer) */ $customizer_data_status = get_option('theme_options_to_customizer_status'); if ($customizer_data_status != 'completed' && $customizer_data_status != '' && $customizer_data_status != null || $customizer_data_status == false) { add_action('after_setup_theme', 'theme_options_to_customizer'); update_option('theme_options_to_customizer_status', 'completed'); } function andrina_tracking_admin_notice() { global $current_user; $user_id = $current_user->ID; $my_theme = wp_get_theme(); /* 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 printf('<b>Notice:</b> You are using Free version of the <b>'. $my_theme->get("Name").'</b> Theme, View Pro version to unlock the features.', 'andrina-lite'); ?></p><a href="<?php echo esc_url('https://www.inkthemes.com/market/fashion-wordpress-theme/'); ?>" target="_blank" rel="unfollow" class="button button-primary "><?php _e('View Pro Version', 'andrina-lite'); ?></a></p> </div> <?php } } add_action('admin_notices', 'andrina_tracking_admin_notice');