function nice_scripts_js() { global $nice_options; wp_register_script('nice-slides', get_template_directory_uri() . '/includes/js/slides.min.jquery.js', array('jquery')); wp_register_script('nice-feedback', get_template_directory_uri() . '/includes/js/feedback.js', array('jquery', 'nice-slides')); wp_register_script('nice-contact-validation', 'http://ajax.microsoft.com/ajax/jquery.validate/1.9/jquery.validate.min.js', array('jquery')); wp_register_script('nice-fancybox-js', get_template_directory_uri() . '/includes/js/jquery.fancybox.js', array('jquery')); wp_register_script('nice-custom', get_template_directory_uri() . '/includes/js/custom.js', array('jquery')); wp_enqueue_script('nice-custom'); wp_enqueue_script('nice-fancybox-js'); $load_feedback_js = false; $load_feedback_js = apply_filters('nice_load_feedback_js', $load_feedback_js); if ($load_feedback_js || nice_bool(get_option('nice_feedback_footer'))) { wp_enqueue_script('nice-feedback'); } $load_contact_js = false; $load_contact_js = apply_filters('nice_load_contact_js', $load_contact_js); if ($load_contact_js) { wp_enqueue_script('nice-contact-validation'); add_action('wp_head', 'nice_contact_js', 10); } wp_register_script('nice-scrollto-js', get_template_directory_uri() . '/includes/js/jquery.scrollTo-min.js', array('jquery', 'jquery-ui-core')); wp_enqueue_script('nice-scrollto-js'); wp_register_script('nice-localscroll-js', get_template_directory_uri() . '/includes/js/jquery.localscroll-min.js', array('jquery', 'jquery-ui-core')); wp_enqueue_script('nice-localscroll-js'); $load_flexslider_js = false; $load_flexslider_js = apply_filters('nice_load_flexslider_js', $load_flexslider_js); if (is_home() || is_front_page() || $load_flexslider_js) { if ($nice_options['nice_slider'] == 'true' || $load_flexslider_js) { wp_register_script('flexslider', get_template_directory_uri() . '/includes/js/jquery.flexslider-min.js', array('jquery')); wp_enqueue_script('flexslider'); wp_register_script('froogaloop', 'http://a.vimeocdn.com/js/froogaloop2.min.js', array('jquery')); wp_enqueue_script('froogaloop'); add_action('wp_head', 'nice_flexslider_js', 10); } } do_action('nice_scripts_js'); }
<?php // File Security Check if (!empty($_SERVER['SCRIPT_FILENAME']) && basename(__FILE__) == basename($_SERVER['SCRIPT_FILENAME'])) { die('You do not have sufficient permissions to access this page!'); } ?> <!-- END #container --> </div> <!-- BEGIN #footer --> <footer id="footer"> <?php if (nice_bool(get_option('nice_feedback_footer'))) { ?> <section class="testimonials clearfix"> <div class="col-full"> <header> <h4><?php _e('Client Testimonials', 'nicethemes'); ?> </h4> </header> <?php add_filter('nice_load_feedback_js', '__return_true', 10); echo nice_display_feedback_items(array('echo' => false, 'effect' => 'fade', 'pagination' => true, 'display_author' => true, 'display_url' => true, 'featured_image' => 0, 'numberposts' => 5)); ?>
</h1> </header> <div class="entry clearfix"> <?php the_content(__('Continue reading', 'nicethemes') . ' »'); ?> <?php wp_link_pages(array('before' => '<div class="page-link">' . __('Pages:', 'nicethemes'), 'after' => '</div>')); ?> </div> <?php if (nice_bool(get_option('nice_page_comments'))) { comments_template('', true); } ?> <?php } ?> <?php } else { ?> <header> <h2><?php _e('Not Found', 'nicethemes');
<?php echo get_the_term_list( get_the_ID(), 'article-category', '<i class="fa fa-archive"></i>', '', '' ); ?> </span> </footer> </div> </article> <?php if ( nice_bool ( get_option( 'nice_article_author' ) ) ) nice_post_author(); if ( nice_bool ( get_option( 'nice_related_articles' ) ) ) nice_related_posts( array( 'post_type' => 'article', 'taxonomy' => 'article-category', 'posts_per_page' => 4, 'title' => __( 'Related Articles', 'nicethemes' ) ) ); comments_template( '', true ); ?> <?php endwhile; ?> <!-- END #content --> </section> <!-- BEGIN #sidebar --> <aside id="sidebar" role="complementary"> <?php dynamic_sidebar( 'knowledgebase' ); ?> <!-- END #sidebar -->
<section class="single-menu-meta"> <?php if (($calories = get_post_meta($post->ID, 'calories', true)) != '') { echo '<div class="menu-meta clearfix"><span>' . __('Calories', 'nicethemes') . '</span>' . $calories . '</div>'; } if (!nice_bool(get_post_meta($post->ID, 'drink', true))) { echo '<div class="menu-meta clearfix"><span>' . __('Gluten Free', 'nicethemes') . '</span>'; if (nice_bool(get_post_meta($post->ID, 'glutenfree', true))) { _e('Yes', 'nicethemes'); } else { _e('No', 'nicethemes'); } echo '</div>'; echo '<div class="menu-meta clearfix"><span>' . __('Vegetarian', 'nicethemes') . '</span>'; if (nice_bool(get_post_meta($post->ID, 'vegetarian', true))) { _e('Yes', 'nicethemes'); } else { _e('No', 'nicethemes'); } echo '</div>'; } if (($spiciness = get_post_meta($post->ID, 'spiciness', true)) > 0) { echo '<div class="menu-meta clearfix"><span>' . __('Spiciness', 'nicethemes') . '</span>' . $spiciness . '</div>'; } ?> </section> <?php }
<div class="post-content<?php echo $video_class; ?> "> <?php the_content(__('Continue reading', 'nicethemes') . ' »'); ?> </div> </div> </article> <?php if (nice_bool(get_option('nice_post_author'))) { nice_post_author(); } ?> <?php comments_template('', true); ?> <?php } } ?> <!-- END #content --> </section>
$subcategories = get_categories(array('taxonomy' => 'menu-category', 'child_of' => $category->term_id)); foreach ($subcategories as $subcategory) { echo '<h3 class="menu-subcategory">' . $subcategory->name . '</h3>' . "\n"; if ($subcategory->description != '') { echo '<p>' . $subcategory->description . '</p>' . "\n"; } echo '<ul>' . "\n"; foreach (get_posts(array('post_type' => 'menu', 'menu-category' => $subcategory->category_nicename, 'order' => 'ASC', 'orderby' => 'menu_order', 'numberposts' => -1, 'posts_per_page' => -1)) as $post) { setup_postdata($post); echo '<li>' . "\n"; echo '<div class="title clearfix"><span><a href="' . get_permalink($post->ID) . '">' . get_the_title() . '</a></span>' . "\n"; if ($price = get_post_meta($post->ID, 'price', true)) { echo '<span class="price">' . $currency . $price . '</span>' . "\n"; } echo '</div><div class="description clearfix">' . "\n"; if (has_post_thumbnail() && nice_bool(get_post_meta($post->ID, 'display_image_menu', true))) { ?> <figure class="featured-image fl"> <a href="<?php the_permalink(); ?> " title="<?php printf(__('Permanent Link to %s', 'nicethemes'), get_the_title()); ?> "> <?php nice_image('width=85&height=65&class=menu-image fl'); ?> </a> </figure>
function nice_image($args) { global $post; $width = null; $height = null; $class = ''; $quality = 90; $limit = 1; $offset = 0; $id = null; $echo = true; $is_auto_image = false; $src = ''; $meta = ''; $alignment = 'c'; $size = ''; $output = ''; if (!is_array($args)) { parse_str($args, $args); } extract($args); // set post ID if (empty($id)) { $id = $post->ID; } $thumb_id = get_post_thumbnail_id($id); // if empty, get standards if (empty($width) && empty($height)) { $width = get_option('thumbnail_size_w', '150'); $height = get_option('thumbnail_size_h', '150'); } if (!$src) { /* start searching for the image */ if (has_post_thumbnail($id)) { $src = get_nice_image_path($thumb_id); } else { // check the first attachment $attachments = get_children(array('post_parent' => $id, 'numberposts' => $limit, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'DESC', 'orderby' => 'menu_order date')); // Search for and get the post attachment if (!empty($attachments)) { // get first $src = get_nice_image_path(array_shift(array_values($attachments))->ID); } else { $matches = ''; $post = get_post($id); ob_start(); ob_end_clean(); $how_many = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); if (!empty($matches[1][0])) { $src = $matches[1][0]; } } } } if (!empty($src)) { $output .= '<img src="' . get_template_directory_uri() . '/engine/timthumb.php?src=' . $src . '&w=' . $width . '&h=' . $height . '&q=' . $quality . '&a=' . $alignment . '" class="' . $class . '" />'; } if (nice_bool($echo)) { echo $output; } else { return $output; } }
</nav> <!-- END #top --> </div> <!-- END #header --> </header> <!-- BEGIN #container --> <div id="container" class="clearfix"> <nav class="responsive-nav"></nav> <?php if (nice_bool($nice_options['nice_slider']) && (is_home() || is_front_page())) { ?> <?php $slides = get_posts(array('post_type' => 'slide', 'showposts' => $nice_options['nice_slider_entries'], 'orderby' => 'menu_order', 'order' => 'ASC')); ?> <?php if (!empty($slides)) { ?> <!-- BEGIN .flexslider --> <div class="flexslider slider"> <ul class="slides"> <?php
function nice_load_web_fonts() { global $google_fonts; $fonts = ''; $html = ''; global $nice_options; // Go through the options if (!empty($nice_options) && (isset($nice_options['nice_texttitle']) && nice_bool($nice_options['nice_texttitle']) || isset($nice_options['nice_custom_typography']) && nice_bool($nice_options['nice_custom_typography']))) { foreach ($nice_options as $option) { if (is_array($option) && isset($option['family'])) { foreach ($google_fonts as $font) { if ($option['family'] == $font['name'] && !strstr($fonts, $font['name'])) { $fonts .= $font['name'] . $font['variant'] . "|"; } } } } // Output google font css in header if ($fonts) { $fonts = str_replace(" ", "+", $fonts); $html .= "\n\n<!-- Nice Google fonts -->\n"; $html .= '<link href="http' . (is_ssl() ? 's' : '') . '://fonts.googleapis.com/css?family=' . $fonts . '" rel="stylesheet" type="text/css" />' . "\n"; $html = str_replace('|"', '"', $html); echo $html . "\n\n"; } if (!nice_bool($nice_options['nice_custom_typography'])) { nice_standard_fonts(); } } else { // fix for updated themes where no typography options were saved nice_standard_fonts(); } }
$defaults = array('menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'nav fl clearfix', 'menu_id' => 'main-nav', 'echo' => true, 'fallback_cb' => '', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'depth' => 0, 'walker' => new Nice_Walker_Nav_Menu(), 'theme_location' => 'navigation-menu'); ?> <?php wp_nav_menu($defaults); ?> <!-- END #navigation --> </nav> <!-- END #top --> </div> <?php $nice_livesearch_enable = get_option('nice_livesearch_enable'); if (nice_bool($nice_livesearch_enable) && (is_front_page() || is_page_template('template-home.php'))) { ?> <!-- #live-search --> <section id="live-search" class="clearfix"> <div class="container col-full"> <?php $nice_welcome_message = get_option('nice_welcome_message'); $nice_welcome_message_extended = get_option('nice_welcome_message_extended'); if (($nice_welcome_message != '' || $nice_welcome_message_extended != '') && is_front_page()) { ?> <!-- BEGIN .welcome-message --> <section class="welcome-message clearfix"> <div class="col-full">
/** * nice_article_meta() * * Articles metadata, nicely displayed. * * @since 1.0.0 * */ function nice_article_meta() { global $nice_options; ?> <div class="entry-meta"> <?php if (isset($nice_options['nice_views']) && nice_bool($nice_options['nice_views'])) { ?> <span class="nice-views"> <?php $pageviews = nice_pageviews_count(); ?> <i class="fa fa-bullseye"></i><?php printf(_n('1 view', '%s views', $pageviews, 'nicethemes'), $pageviews); ?> </span> <?php } ?> <?php if (isset($nice_options['nice_reading_time']) && nice_bool($nice_options['nice_reading_time'])) { ?> <span class="nice-reading-time"> <?php nicethemes_reading_time(array('before' => '<i class="fa fa-bookmark"></i>')); ?> </span> <?php } ?> <?php if (isset($nice_options['nice_likes']) && nice_bool($nice_options['nice_likes'])) { ?> <a class="nice-like<?php if (!nicethemes_likes_can(get_the_ID())) { echo ' liked'; } ?> " data-id="<?php the_ID(); ?> " href="#" title="<?php _e('Like this', 'nicethemes'); ?> "> <i class="fa fa-heart"></i> <span class="like-count"> <?php echo nicethemes_likes_count(); ?> </span> </a> <?php } ?> <?php edit_post_link(__('Edit', 'nicethemes'), '<span class="edit-link"><span class="edit"><i class="fa fa-pencil"></i>', '</span></span>'); ?> </div> <?php }
function nice_image($args) { global $post; global $nice_options; $width = null; $height = null; $class = ''; $quality = 90; $limit = 1; $offset = 0; $id = null; $echo = true; $is_auto_image = false; $src = ''; $meta = ''; $alignment = 'c'; $size = ''; $noheight = ''; // new vars. $alt = ''; $title = ''; $link = ''; $thumb_id = ''; $nice_timthumb_resize = true; /* deprecated */ $nice_wp_resize = false; if (!is_array($args)) { parse_str($args, $args); } extract($args); // Set post ID if (empty($id)) { $id = $post->ID; } // Get standard size, if not defined if (empty($width) && empty($height)) { $width = get_option('thumbnail_size_w', '150'); $height = get_option('thumbnail_size_h', '150'); } if ($src != '') { $src = esc_attr($src); } if (!$src) { /* start searching for the image */ // the ID is an attachment if (get_post_type($id) == 'attachment') { // get the data from the attachment $thumb_id = $id; $src = get_nice_image_path($id); // they send a post/page/cpt } elseif (has_post_thumbnail($id)) { $thumb_id = get_post_thumbnail_id($id); $src = get_nice_image_path($thumb_id); // they send nothing, get image from the content. } else { // check the first attachment $attachments = get_children(array('post_parent' => $id, 'numberposts' => $limit, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'DESC', 'orderby' => 'menu_order date')); // Search for and get the post attachment if (!empty($attachments)) { // get the first attachment. $thumb_id = get_post_thumbnail_id(array_shift(array_values($attachments))->ID); $src = get_nice_image_path(array_shift(array_values($attachments))->ID); } else { // retrieve the post content to find the first <img> appearance $matches = ''; $post = get_post($id); ob_start(); ob_end_clean(); $how_many = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); if (!empty($matches[1][0])) { $src = $matches[1][0]; } } } } // OUTPUT $output = ''; // Image CSS class. if ($class) { $class = 'nice-image ' . esc_attr($class); } else { $class = 'nice-image'; } // Image metadata if ($thumb_id) { if ($alt == '') { $alt = esc_attr(get_post_meta($thumb_id, '_wp_attachment_image_alt', true)); } if ($title == '') { $title = esc_attr(get_the_title($thumb_id)); } } if (nice_bool(get_option('nice_wp_resize_crop'))) { $vt_crop = get_option('nice_wp_resize_crop'); // resize image if ($thumb_id) { // resize image $vt_image = vt_resize($thumb_id, '', $width, $height, $vt_crop); $src = $vt_image['url']; } elseif ($src) { $vt_image = vt_resize('', $src, $width, $height, $vt_crop); $src = $vt_image['url']; } } else { // use the thumbnail sizes if ($size) { $thumb_size = $size; } else { $thumb_size = array($width, $height); } // on the fly size //$img_link = get_the_post_thumbnail( $thumb_id, $thumb_size, array( 'class' => 'nice-image ' . esc_attr( $class ) ) ); $img_data = wp_get_attachment_image_src($thumb_id, $thumb_size); if (!empty($img_data)) { $src = $img_data[0]; } } // Start generating the output for the different resizing options. if (!empty($vt_image['url'])) { $output .= '<img src="' . esc_url($vt_image['url']) . '" class="' . $class . '" title="' . $title . '" alt="' . $alt . '" />'; } elseif (!empty($src)) { $set_width = ' width="' . esc_attr($width) . '" '; $set_height = ''; if (!$noheight && 0 < $height) { $set_height = ' height="' . esc_attr($height) . '" '; } // WP resize without cropping. $output .= '<img src="' . esc_url($src) . '" class="' . $class . '" title="' . $title . '" alt="' . $alt . '" ' . $set_width . ' ' . $set_height . ' />'; } if (nice_bool($echo)) { echo $output; } else { return $output; } }
"> <?php nice_image(array('width' => 120, 'height' => 80, 'class' => 'menu-image fl')); ?> </a> </figure> <?php } if (get_the_excerpt() != '') { echo '' . get_the_excerpt() . ''; } echo '</div></li>'; } echo '</ul>'; if (nice_bool($taxonomy_menu_grid)) { echo '</div>'; } } $left_menu .= '</ul>'; } echo '</div>'; wp_reset_query(); ?> </div> <!-- END .col-full --> </section> <?php if (!empty($left_menu)) {
function nice_custom_fonts() { global $nice_options; $output = ''; if (isset($nice_options['nice_custom_typography']) && nice_bool($nice_options['nice_custom_typography'])) { if (isset($nice_options['nice_font_body']) && $nice_options['nice_font_body']) { $output .= 'body { ' . nice_custom_font_css($nice_options['nice_font_body']) . ' }' . "\n"; } if (isset($nice_options['nice_font_nav']) && $nice_options['nice_font_nav']) { $output .= '#navigation .nav li a { ' . nice_custom_font_css($nice_options['nice_font_nav']) . ' }' . "\n"; } if (isset($nice_options['nice_font_subnav']) && $nice_options['nice_font_subnav']) { $output .= '#top #navigation .nav li ul li a { ' . nice_custom_font_css($nice_options['nice_font_subnav']) . ' }' . "\n"; } // from now onwards if (isset($nice_options['nice_font_post_title']) && $nice_options['nice_font_post_title']) { $output .= '.post h2 { ' . nice_custom_font_css($nice_options['nice_font_post_title']) . ' }' . "\n"; } if (isset($nice_options['nice_font_post_meta']) && $nice_options['nice_font_post_meta']) { $output .= '.post-meta { ' . nice_custom_font_css($nice_options['nice_font_post_meta']) . ' }' . "\n"; } if (isset($nice_options['nice_font_post_entry']) && $nice_options['nice_font_post_entry']) { $output .= '.entry { ' . nice_custom_font_css($nice_options['nice_font_post_entry']) . ' }' . "\n"; } if (isset($nice_options['nice_font_infobox_title']) && $nice_options['nice_font_infobox_title']) { $output .= '.infobox .entry-title { ' . nice_custom_font_css($nice_options['nice_font_infobox_title']) . ' }' . "\n"; } if (isset($nice_options['nice_font_infobox_content']) && $nice_options['nice_font_infobox_content']) { $output .= '.infobox .entry-excerpt, .menu-box li .description, .menu-box p { ' . nice_custom_font_css($nice_options['nice_font_infobox_content']) . ' }' . "\n"; } if (isset($nice_options['nice_font_slider_title']) && $nice_options['nice_font_slider_title']) { $output .= '.flexslider .slides li h2 {' . nice_custom_font_css($nice_options['nice_font_slider_title']) . ' }' . "\n"; } if (isset($nice_options['nice_font_slider_content']) && $nice_options['nice_font_slider_content']) { $output .= '.flex-caption p { ' . nice_custom_font_css($nice_options['nice_font_slider_content']) . ' }' . "\n"; } if (isset($nice_options['nice_font_widget_titles']) && $nice_options['nice_font_widget_titles']) { $output .= '#sidebar .widget h3 { ' . nice_custom_font_css($nice_options['nice_font_widget_titles']) . ' }' . "\n"; } if (isset($nice_options['nice_font_footer_widget_titles']) && $nice_options['nice_font_footer_widget_titles']) { $output .= '#footer-widgets h3 { ' . nice_custom_font_css($nice_options['nice_font_footer_widget_titles']) . ' }' . "\n"; } if (isset($nice_options['nice_font_footer_widget_content']) && $nice_options['nice_font_footer_widget_content']) { $output .= '#footer-widgets .widget { ' . nice_custom_font_css($nice_options['nice_font_footer_widget_content']) . ' }' . "\n"; } } // Add Text title and tagline if text title option is enabled if (isset($nice_options['nice_texttitle']) && nice_bool($nice_options['nice_texttitle'])) { if ($nice_options['nice_font_site_title']) { $output .= '#header #top #logo a .text-logo { ' . nice_custom_font_css($nice_options['nice_font_site_title']) . ' }' . "\n"; } } if (isset($output) && $output != '') { $output = strip_tags($output); $output = "<!-- Nice Custom Fonts -->\n<style type=\"text/css\">\n" . $output . "</style>\n"; echo $output; } }