function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); $before_widget = '<div class="widget widget-search">'; $after_widget = '</div>'; echo $before_widget; ?> <?php if (!empty($title)) { ?> <h3 class="widget-title"><?php echo tfuse_qtranslate($title); ?> </h3> <?php } ?> <form method="get" id="searchform" action="<?php echo home_url('/'); ?> "> <input name="s" id="s" type="text" class="inputtext" placeholder="<?php echo tfuse_options('search_box_text'); ?> " name="search" value=""> <button type="submit" class="btn btn-search"><span class="tficon-row"></span></button> </form> <?php echo $after_widget; }
public function admin_add_css() { global $wp_version; // For cases like '3.5-beta2' the version_compare() will not work properly, extract only '3.5' $version = explode('-', $wp_version); $_wp_version = array_shift($version); wp_enqueue_style('thickbox'); wp_register_style('JQueryUiStyle', TFUSE_ADMIN_CSS . '/jquery-ui-1.8.14.custom.css', false, '1.0.0'); wp_enqueue_style('JQueryUiStyle'); $this->include->register_type('framework_css', TFUSE . '/static/css'); $this->include->css('style', 'framework_css', 'tf_head', '1.5'); if (version_compare($_wp_version, "3.8", ">=")) { // wp3.8 css fixes $this->include->css('style-wp3.8', 'framework_css', 'tf_head', '1.0'); $this->include->css('screen-wp3.8', 'framework_css', 'tf_head', '1.0'); } elseif (version_compare($_wp_version, "3.5", ">=")) { // wp3.5 css fixes $this->include->css('style-wp3.5', 'framework_css', 'tf_head', '1.1'); } if (tfuse_options('activate_tfuse_style', true) && version_compare($_wp_version, '3.8', '<')) { $this->include->css('tfuse_style', 'framework_css', 'tf_head', '1.3'); if (version_compare($_wp_version, "3.5", ">=")) { // wp3.5 css fixes $this->include->css('tfuse_style-wp3.5', 'framework_css', 'tf_head', '1.1'); } } $this->include->css('prettyPhoto', 'framework_css', 'tf_head'); $this->include->css('colorpicker', 'framework_css', 'tf_head'); $this->include->css('datepicker', 'framework_css', 'tf_head'); }
function tfuse_latest_news($atts, $content = null) { extract(shortcode_atts(array('posts' => '', 'title' => '', 'b_title' => '', 'b_link' => ''), $atts)); $posts = explode(',', $posts); $return_html = $img = ''; if (!empty($posts)) { $return_html .= '<section class="postlist postlist-cols-1 shortcode_news"> <h1>' . $title . '</h1>'; foreach ($posts as $post) { $image = wp_get_attachment_url(get_post_thumbnail_id($post, 'post-thumbnails')); $img_pos = tfuse_page_options('single_img_position', '', $post); $post_date = get_the_date($post); $time = strtotime($post_date); $position = tfuse_page_options('img_pos', '', $post); $current_post = get_post($post); $user_data = get_user_by('id', $current_post->post_author); $return_html .= '<article class="post"> <div class="inner">'; $press_source = tfuse_page_options('press_source', '', $post); $press_author = tfuse_page_options('press_author', '', $post); $is_outer_link = !empty($press_source) ? true : false; $target_window = !empty($press_source) ? "_blank" : "_self"; $author_url = !empty($press_source) ? $press_source : get_author_posts_url($current_post->post_author, $user_data->data->user_nicename); $press_source = !empty($press_source) ? $press_source : get_permalink($post); $press_author = !empty($press_author) ? $press_author : $user_data->data->display_name; if (!empty($image)) { $return_html .= '<a class="post-thumbnail" href="' . $press_source . '"><img src="' . $image . '" alt="' . get_the_title($post) . '" /></a>'; } $return_html .= '<div class="entry-aside"> <header class="entry-header"> <h2 class="entry-title"><a target="' . $target_window . '" href="' . $press_source . '">' . get_the_title($post) . '</a></h2> <div class="entry-meta"> ' . __('By ', 'tfuse') . '<span class="author"><a href="' . $author_url . '">' . $press_author . '</a></span> ' . __(' on ', 'tfuse') . '<time class="entry-date" datetime="' . date('Y-m-d', $time) . 'T' . date('g:i:s', $time) . '">' . get_the_time(get_option('date_format'), $post) . '</time> </div> </header> <div class="entry-content">'; if (tfuse_options('post_content') == 'content') { $return_html .= '<p>' . $current_post->post_content . '</p>'; } else { $return_html .= !empty($current_post->post_excerpt) ? '<p>' . $current_post->post_excerpt . '</p>' : '<p>' . strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)) . '</p>'; } $tmp_comments = $is_outer_link ? '' : '<span class="comments-link"><a href="' . $press_source . '#comments"><i class="tficon-comment"></i> ' . get_comments_number($post) . '</a></span>'; $return_html .= '</div> <footer class="entry-meta"> <a target="' . $target_window . '" class="btn btn-default btn-xs" href="' . $press_source . '">' . __('Read more', 'tfuse') . '</a> ' . $tmp_comments . ' </footer> </div> </div> </article>'; } $return_html .= '<div class="load_button"> <a href="' . $b_link . '" class="btn btn-main">' . $b_title . '</a> </div>'; $return_html .= '</section>'; } return $return_html; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); $number = esc_attr($instance['number']); if ($number > 0) { } else { $number = 6; } $before_widget = '<div class="widget widget-freshpost">'; $after_widget = '</div>'; echo $before_widget; ?> <?php if (!empty($title)) { ?> <h3 class="widget-title"><?php echo tfuse_qtranslate($title); ?> </h3> <?php } ?> <ul class="side-postlist"> <?php $recent_posts = tfuse_shortcode_posts(array('sort' => 'recent', 'items' => $number, 'image_post' => false, 'date_post' => false)); foreach ($recent_posts as $post_val) { ?> <li><a href="<?php echo $post_val['post_link']; ?> "><span><?php echo $post_val['post_title']; ?> </span></a></li> <?php } ?> </ul> <?php if (isset($instance['enable_rss']) && $instance['enable_rss']) { ?> <a href="<?php echo tfuse_options('feedburner_url', '#'); ?> " class="btn btn-orange btn-freshpost"><span><?php _e('subscribe to rss feed', 'tfuse'); ?> </span></a> <?php } ?> <?php echo $after_widget; }
function tf_sidebars_init() { extract(tf_sidebar_cfg()); register_sidebar(array('name' => __('General Sidebar', 'tfuse'), 'id' => 'sidebar-1', 'before_widget' => $beforeWidget, 'after_widget' => $afterWidget, 'before_title' => $beforeTitle, 'after_title' => $afterTitle, 'description' => '')); if (!tfuse_options('enable_footer_shortcodes')) { register_sidebar(array('name' => __('Footer 1', 'tfuse'), 'id' => 'footer-1', 'before_widget' => $beforeWidget, 'after_widget' => $afterWidget, 'before_title' => $beforeTitle, 'after_title' => $afterTitle)); register_sidebar(array('name' => __('Footer 2', 'tfuse'), 'id' => 'footer-2', 'before_widget' => $beforeWidget, 'after_widget' => $afterWidget, 'before_title' => $beforeTitle, 'after_title' => $afterTitle)); register_sidebar(array('name' => __('Footer 3', 'tfuse'), 'id' => 'footer-3', 'before_widget' => $beforeWidget, 'after_widget' => $afterWidget, 'before_title' => $beforeTitle, 'after_title' => $afterTitle)); register_sidebar(array('name' => __('Footer 4', 'tfuse'), 'id' => 'footer-4', 'before_widget' => $beforeWidget, 'after_widget' => $afterWidget, 'before_title' => $beforeTitle, 'after_title' => $afterTitle)); register_sidebar(array('name' => __('Footer 5', 'tfuse'), 'id' => 'footer-5', 'before_widget' => $beforeWidget, 'after_widget' => $afterWidget, 'before_title' => $beforeTitle, 'after_title' => $afterTitle)); } }
/** * Search form * * To override this shortcode in a child theme, copy this file to your child theme's * theme_config/extensions/shortcodes/shortcodes/ folder. */ function tfuse_search($atts) { extract(shortcode_atts(array('title' => ''), $atts)); if (empty($title)) { $title = __('SEARCH WIDGET', 'tfuse'); } $output = ''; $output .= '<div class="widget widget-search"> <h3 class="widget-title">' . tfuse_qtranslate($title) . '</h3> <form method="get" id="searchform" action="' . home_url('/') . '"> <input name="s" id="s" type="text" class="inputtext" placeholder="' . tfuse_options('search_box_text') . '" name="search" value=""> <button id="searchsubmit" type="submit" class="btn btn-search"><span class="tficon-row"></span></button> </form> </div>'; return $output; }
function tfuse_portfolio($atts) { extract(shortcode_atts(array('category' => '', 'columns' => 'three-column'), $atts)); wp_register_script('isotope', tfuse_get_file_uri('/js/isotope.pkgd.min.js'), array('jquery'), '1.0', true); wp_enqueue_script('isotope'); $output = ''; if ($category != 0) { $tax = 'group'; $term = get_term_by('id', $category, $tax); $term_children = get_term_children($category, $tax); $args = array('posts_per_page' => -1, 'post_type' => 'portfolio', 'tax_query' => array(array('taxonomy' => $tax, 'field' => 'id', 'terms' => $category))); $query = new WP_Query($args); $posts = $query->get_posts(); if (!empty($term)) { $output .= '<div class="shortcode-portfolio">'; if (tfuse_options('enable_portfolio_filter', true)) { $output .= '<div class="wrapp-categories-gallery"> <ul id="categories" class="gallery-categories">'; if (!empty($term_children)) { $output .= '<li class="categories-item active" data-category="' . $term->slug . '"><div class="check-category"><span></span></div>' . $term->name . '</li>'; foreach ($term_children as $id) { $term_child = get_term_by('id', $id, $tax); $output .= '<li class="categories-item" data-category="' . $term_child->slug . '"><div class="check-category"><span></span></div>' . $term_child->name . '</li>'; } } $output .= '</ul> <a class="prev" id="categories-prev" href="#"><i class="tficon-shevron-left"></i></a> <a class="next" id="categories-next" href="#"><i class="tficon-shevron-right"></i></a> </div>'; } $output .= '<section class="gallery">' . '' . ' <ul id="gallery-list" class="gallery-list ' . $columns . '">'; if (!empty($posts)) { foreach ($posts as $post) { $output .= '<li class="gallery-item" data-category="' . tfuse_get_portfolio_categories_list($post->ID) . '"> <div class="gallery-img">' . tfuse_get_portfolio_thumbnail($post->ID, $columns) . '</div> ' . tfuse_get_portfolio_gallery($post->ID) . ' </li>'; } } $output .= '</ul>'; $output .= '</section></div>'; } } return $output; }
/** * Newsletter * * To override this shortcode in a child theme, copy this file to your child theme's * theme_config/extensions/shortcodes/shortcodes/ folder. * * Optional arguments: * title: e.g. Newsletter signup * text: e.g. Thank you for your subscribtion. * action: URL where to send the form data. * rss_feed: */ function tfuse_newsletter($atts, $content = null) { extract(shortcode_atts(array('title' => '', 'text' => '', 'rss_feed' => ''), $atts)); if (empty($title)) { $title = __('Newsletter', 'tfuse'); } if (empty($text)) { $text = __('', 'tfuse'); } $out = ' <div class="widget widget_newsletter newsletter_subscription_box"> <h1 class="widget-title">' . $title . '</h1> <div class="newsletter_subscription_messages before-text"> <div class="newsletter_subscription_message_initial"> ' . __('', 'tfuse') . ' </div> <div class="newsletter_subscription_message_success"> ' . __('Thank you for your subscription.', 'tfuse') . ' </div> <div class="newsletter_subscription_message_wrong_email"> ' . __('Your email format is wrong!', 'tfuse') . ' </div> <div class="newsletter_subscription_message_failed"> ' . __('Sad, but we couldn\'t add you to our mailing list ATM.', 'tfuse') . ' </div> </div> <form action="#" method="post" class="newsletter_subscription_form"> <div class="newsletter_text">' . $text . '</div> <input type="text" value="" name="newsletter" id="newsletter" class="newsletter_subscription_email inputtext" placeholder="' . __('Your email adress here...', 'tfuse') . '"/> <button type="submit" class="btn btn-newsletter newsletter_subscription_submit"><span>' . __('Subscribe', 'tfuse') . '</span></button> <div class="newsletter_subscription_ajax">' . __('Loading...', 'tfuse') . '</div> <div class="newsletter_text">'; if ($rss_feed != 'false') { $out .= '<a class="newssetter_subscribe" href="' . tfuse_options('feedburner_url', get_bloginfo_rss('rss2_url')) . '">' . __('I also want to subscribe to the RSS Feed', 'tfuse') . '</a>'; } $out .= ' </div> </form> </div>'; return $out; }
function tfuse_shortcode_latest_post($atts, $content = null) { $out = ''; $recent_post = wp_get_recent_posts(array('numberposts' => 1)); if (!empty($recent_post)) { foreach ($recent_post as $post) { $image = wp_get_attachment_url(get_post_thumbnail_id($post['ID'], 'post-thumbnails')); $get_image = new TF_GET_IMAGE(); $img = $get_image->properties(array('class' => '', 'alt' => get_the_title($post['ID'])))->width(210)->height(82)->src($image)->resize(true)->get_img(); $current_post = get_post($post['ID']); $user_data = get_user_by('id', $current_post->post_author); $out .= '<article class="post"> <h2 class="entry-title"><a href="' . get_permalink($post['ID']) . '">' . get_the_title($post['ID']) . '</a></h2> <div class="entry-meta"> <time class="entry-date" datetime="">' . get_the_time(get_option('date_format'), $post['ID']) . '</time> <span class="author"> ' . __('by', 'tfuse') . ' <a href="' . get_author_posts_url($current_post->post_author, $user_data->data->user_nicename) . '">' . $user_data->data->user_nicename . '</a></span> </div> <span class="post-thumbnail">'; if (!empty($image)) { $out .= $img; } $out .= '</span> <div class="entry-content"><p>'; if (tfuse_options('post_content') == 'content') { $out .= $current_post->post_content; } else { $out .= !empty($current_post->post_excerpt) ? $current_post->post_excerpt : strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)); } $out .= '</p></div> <footer class="entry-meta"> <a href="' . get_permalink($post['ID']) . '" class="btn btn-yellow"><span>' . __('find out more', 'tfuse') . '</span></a> </footer> </article>'; } } return $out; }
/** * Newsletter * * To override this shortcode in a child theme, copy this file to your child theme's * theme_config/extensions/shortcodes/shortcodes/ folder. * * Optional arguments: * title: e.g. Newsletter signup * text: e.g. Thank you for your subscription. * action: URL where to send the form data. * rss_feed: */ function tfuse_newsletter($atts, $content = null) { extract(shortcode_atts(array('title' => '', 'text' => '', 'rss_feed' => ''), $atts)); if (empty($title)) { $title = __('Newsletter', 'tfuse'); } if (empty($text)) { $text = __('Sign up for our weekly newsletter to receive updates, news, and promos:', 'tfuse'); } $out = ' <div class="newsletter_subscription_box newsletterBox"> <div class="inner"> <div class="ribbon"></div> <h2>' . $title . '</h2> <div class="newsletter_subscription_messages before-text"> <div class="newsletter_subscription_message_initial">' . $text . '</div> <div class="newsletter_subscription_message_success">' . __('Thank you for your subscription.', 'tfuse') . '</div> <div class="newsletter_subscription_message_wrong_email">' . __('Your email format is wrong!', 'tfuse') . '</div> <div class="newsletter_subscription_message_failed">' . __('Sad, but we couldn\'t add you to our mailing list ATM.', 'tfuse') . '</div> </div> <form action="#" method="post" class="newsletter_subscription_form"> <input type="text" value="" name="newsletter" class="newsletter_subscription_email inputField" /> <input type="submit" value="" class="btn-submit newsletter_subscription_submit" /> <div class="clear"></div> </form> <div class="newsletter_subscription_ajax">' . __('Loading', 'tfuse') . '...</div>'; if ($rss_feed == 'true') { $out .= '<div class="newsletter_text"><a href="' . tfuse_options('feedburner_url', get_bloginfo_rss('rss2_url')) . '" class="link-news-rss">' . __('You can also', 'tfuse') . ' <span>' . __('Subscribe to our RSS', 'tfuse') . '</span> ' . __('feed', 'tfuse') . '</a></div>'; } $out .= '</div> </div>'; return $out; }
function tfuse_set_blog_page() { global $wp_query, $is_tf_blog_page; $id_post = 0; $blog_page_id = tfuse_options('blog_page', ''); if (isset($wp_query->queried_object) && isset($wp_query->queried_object->ID)) { $id_post = $wp_query->queried_object->ID; } elseif (isset($wp_query->query['page_id'])) { $id_post = $wp_query->query['page_id']; } if (function_exists('icl_object_id')) { $id_post = icl_object_id($id_post, 'page', false, 'en'); } if ($blog_page_id != 0 && $id_post == $blog_page_id) { $is_tf_blog_page = true; } }
public function tfuse_load_google_fonts() { global $google_fonts; $fonts = ''; $output = ''; $tfuse_options = tfuse_options(); // Go through the options if (!empty($tfuse_options['framework'])) { foreach ($tfuse_options['framework'] as $option) { // Check if option has "face" in array if (is_array($option) && isset($option['face'])) { // Go through the google font array foreach ($google_fonts as $font) { // Check if the google font name exists in the current "face" option if ($option['face'] == $font['name'] and !strstr($fonts, $font['name'])) { // Add google font to output $fonts .= $font['name'] . $font['variant'] . "|"; } // End If Statement } // End Foreach Loop } // End If Statement } // End Foreach Loop // Output google font css in header if ($fonts) { $fonts = str_replace(" ", "+", $fonts); $output .= "\n<!-- Google Webfonts -->\n"; $output .= '<link href="//fonts.googleapis.com/css?family=' . $fonts . '" rel="stylesheet" type="text/css" />' . "\n"; $output = str_replace('|"', '"', $output); echo $output; } } }
function resize($resize = NULL, $quality = 100) { // Checks if function has been called manually if (isset($this->resize)) { return $this; } if ($this->width && !$this->removeSizeParams) { $this->property_string .= ' width="' . $this->width . '"'; } if ($this->height && !$this->removeSizeParams) { $this->property_string .= ' height="' . $this->height . '"'; } // in framework TRUE inseamna ca nu face resize // daca se apeleaza direct functia resize() ... atunci TRUE face resize if (!isset($resize)) { $this->resize = tfuse_options('disable_resize'); } else { $this->resize = !$resize; } if (!$this->resize) { if (strpos($this->src, home_url()) === false) { $remote_uploaded_by_tfuse = get_option('tfuse_remote_images', array()); if (!array_key_exists($this->src, $remote_uploaded_by_tfuse)) { $attachment_id = tfuse_sideload_image_attachment($this->src); if (is_numeric($attachment_id)) { $remote_uploaded_by_tfuse[$this->src] = wp_get_attachment_url($attachment_id); update_option('tfuse_remote_images', $remote_uploaded_by_tfuse); $this->src = $remote_uploaded_by_tfuse[$this->src]; unset($remote_uploaded_by_tfuse); } } else { $this->src = $remote_uploaded_by_tfuse[$this->src]; unset($remote_uploaded_by_tfuse); } } $resized_img = tfuse_image_resize($this->src, $this->width, $this->height); if (!is_wp_error($resized_img)) { $this->src = $resized_img['url']; } } return $this; }
function tfuse_projects($atts, $content = null) { extract(shortcode_atts(array('post' => ''), $atts)); $output = ''; $uniq = rand(1, 100); $post = explode(',', $post); $query = new WP_Query(array('posts_per_page' => -1, 'post_type' => 'project', 'orderby' => 'post__in', 'post__in' => $post)); $posts = $query->get_posts(); if (!empty($posts)) { $output .= '<div class="recent-slider"> <ul id="recent-slider' . $uniq . '">'; foreach ($posts as $post) { $image = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')); if (!empty($image)) { $image = TF_GET_IMAGE::get_src_link($image, 285, 326); } $current_post = get_post($post->ID); $output .= '<li data-recentslider1="1"> <div class="recent-slider-text"> <h3 class="title"><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></h3> <div class="line-title-sldier"></div> <div class="recent-slider-description">'; if (tfuse_options('post_content') == 'content') { $output .= $current_post->post_content; } else { $output .= !empty($current_post->post_excerpt) ? $current_post->post_excerpt : strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)); } $output .= '</div> </div> <div class="recent-slider-image"> <a href="' . get_permalink($post->ID) . '" class="recent-slider-thumbnail"><span>' . __('More', 'tfuse') . '</span></a> <img src="' . $image . '" > </div> </li>'; } $output .= '</ul> <div id="recent-slider' . $uniq . '-controls" class="recent-slider-controls"></div> <a id="recent-slider' . $uniq . '-prev" class="prev" href="#">prev</a> <a id="recent-slider' . $uniq . '-next" class="next" href="#">next</a> </div>'; $output .= ' <script> jQuery(document).ready(function(){ function recentsliderInit() { jQuery("#recent-slider' . $uniq . '").carouFredSel({ swipe : { onTouch: true }, next : "#recent-slider' . $uniq . '-next", prev : "#recent-slider' . $uniq . '-prev", pagination : "#recent-slider' . $uniq . '-controls", infinite: false, items: 1, auto: { play: false, timeoutDuration: 0 }, scroll: { items : 1, fx: "crossfade", easing: "linear", pauseOnHover: true, duration: 300 } }); } recentsliderInit(); jQuery(window).resize(function() { recentsliderInit(); }); var tControlsHeight = jQuery(".recent-slider-controls").innerHeight(); jQuery(".recent-slider-controls").css("margin-top" , -tControlsHeight/2); //Script align center the text for two mini slider var caroufredsel_wrapper = jQuery(".caroufredsel_wrapper"); var recent_slider_text = jQuery(".recent-slider-text"); caroufredsel_wrapper.each(function(){ hei1 = jQuery(this).height(); recent_slider_text.each(function(){ hei2 = jQuery(this).height(); jQuery(this).css({ "padding-top" :hei1/2-hei2/2 }); }); }); }); </script> '; } return $output; }
?> <a href="<?php echo $permalink; ?> " class="post-thumbnail"><?php the_post_thumbnail(''); ?> </a> <?php } } ?> </header> <div class="entry-content"> <?php if (tfuse_options('post_content') == 'content') { the_content(''); } else { the_excerpt(); } ?> </div> <footer class="entry-meta"> <a href="<?php echo $permalink; ?> " class="btn btn-black-transparent btn-xs"><span><?php _e('find out more', 'tfuse'); ?> </span></a> <a href="<?php
<?php /* ----------------------------------------------------------------------------------- */ /* Initializes all the theme settings option fields for pages area. */ /* ----------------------------------------------------------------------------------- */ $options = array(array('name' => __('Single Page', 'tfuse'), 'id' => TF_THEME_PREFIX . '_side_media', 'type' => 'metabox', 'context' => 'side', 'priority' => 'low'), array('name' => __('Disable Comments', 'tfuse'), 'desc' => '', 'id' => TF_THEME_PREFIX . '_disable_comments', 'value' => tfuse_options('disable_page_comments', 'true'), 'type' => 'checkbox', 'divider' => true), array('name' => __('Page Title', 'tfuse'), 'desc' => __('Select your preferred Page Title.', 'tfuse'), 'id' => TF_THEME_PREFIX . '_page_title', 'value' => 'default_title', 'options' => array('hide_title' => __('Hide Page Title', 'tfuse'), 'default_title' => __('Default Title', 'tfuse'), 'custom_title' => __('Custom Title', 'tfuse')), 'type' => 'select'), array('name' => __('Custom Title', 'tfuse'), 'desc' => __('Enter your custom title for this page.', 'tfuse'), 'id' => TF_THEME_PREFIX . '_custom_title', 'value' => '', 'type' => 'text'), array('name' => __('Header', 'tfuse'), 'id' => TF_THEME_PREFIX . '_header_option', 'type' => 'metabox', 'context' => 'normal'), array('name' => __('Element of Hedear', 'tfuse'), 'desc' => __('Select type of element on the header.', 'tfuse'), 'id' => TF_THEME_PREFIX . '_header_element', 'value' => 'image', 'options' => array('none' => __('Without Header Element', 'tfuse'), 'slider' => __('Slider on Header', 'tfuse'), 'image' => __('Image on Header', 'tfuse')), 'type' => 'select'), $this->ext->slider->model->has_sliders() ? array('name' => __('Slider', 'tfuse'), 'desc' => __('Select a slider for your post. The sliders are created on the', 'tfuse') . '<a href="' . admin_url('admin.php?page=tf_slider_list') . '" target="_blank">' . __('Sliders page', 'tfuse') . '</a>.', 'id' => TF_THEME_PREFIX . '_select_slider', 'value' => '', 'options' => $TFUSE->ext->slider->get_sliders_dropdown(), 'type' => 'select') : array('name' => __('Slider', 'tfuse'), 'desc' => '', 'id' => TF_THEME_PREFIX . '_select_slider', 'value' => '', 'html' => __('No sliders created yet. You can start creating one', 'tfuse') . '<a href="' . admin_url('admin.php?page=tf_slider_list') . '">' . __('here', 'tfuse') . '</a>.', 'type' => 'raw'), array('name' => __('Header Image', 'tfuse'), 'desc' => __('Upload an image for your header. It will be resized to 960x142 px', 'tfuse'), 'id' => TF_THEME_PREFIX . '_header_image', 'value' => '', 'type' => 'upload'), array('name' => __('Shortcodes after Content', 'tfuse'), 'desc' => __('In this textarea you can input your prefered custom shotcodes.', 'tfuse'), 'id' => TF_THEME_PREFIX . '_content_bottom', 'value' => '', 'type' => 'textarea')); /* * ********************************************************* Advanced * ********************************************************** */
<div class="tagcloud"><?php echo $tags; ?> </div> </section> <?php } ?> <?php get_template_part('content', 'author'); ?> <section class="clearfix"> <?php if (tfuse_options('post_share')) { ?> <div class="social-share-blog"> <div class="twitter"><a href="https://twitter.com/share?url=<?php echo get_permalink(); ?> " target="_blank"><i class="icon-twitter"></i><?php _e('Tweet', 'tfuse'); ?> </a></div> <div class="facebook-share-blog"><a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo get_permalink(); ?> " target="_blank"><i class="tficon-like"></i><?php _e('Share', 'tfuse'); ?>
/** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which runs * before the init hook. The init hook is too late for some features, such as indicating * support post thumbnails. * * To override tfuse_slider_type() in a child theme, add your own tfuse_slider_type to your child theme's * functions.php file. */ function tfuse_get_header_content() { global $TFUSE, $post, $header_image, $is_tf_front_page, $is_tf_blog_page; $posts = $header_element = $header_image = $slider = null; if ($is_tf_blog_page) { $header_element = tfuse_options('header_element_blog'); if ('slider' == $header_element) { $slider = tfuse_options('select_slider_blog'); } elseif ('image' == $header_element) { $header_image = tfuse_options('header_image_blog'); } } elseif ($is_tf_front_page) { if (tfuse_options('use_page_options') && tfuse_options('homepage_category') == 'page') { $page_id = $post->ID; $header_element = tfuse_page_options('header_element', '', $page_id); if ('slider' == $header_element) { $slider = tfuse_page_options('select_slider', '', $page_id); } elseif ('image' == $header_element) { $header_image = tfuse_page_options('header_image', '', $page_id); } } else { $header_element = tfuse_options('header_element'); if ('slider' == $header_element) { $slider = tfuse_options('select_slider'); } elseif ('image' == $header_element) { $header_image = tfuse_options('header_image'); } } } elseif (is_singular()) { $ID = $post->ID; $header_element = tfuse_page_options('header_element'); if ('slider' == $header_element) { $slider = tfuse_page_options('select_slider'); } elseif ('image' == $header_element) { $header_image = tfuse_page_options('header_image'); } } elseif (is_category()) { $ID = get_query_var('cat'); $header_element = tfuse_options('header_element', null, $ID); if ('slider' == $header_element) { $slider = tfuse_options('select_slider', null, $ID); } elseif ('image' == $header_element) { $header_image = tfuse_options('header_image', null, $ID); } } elseif (is_tax()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); $ID = $term->term_id; $header_element = tfuse_options('header_element', null, $ID); if ('slider' == $header_element) { $slider = tfuse_options('select_slider', null, $ID); } elseif ('image' == $header_element) { $header_image = tfuse_options('header_image', null, $ID); } } if ($header_element != 'slider') { get_template_part('header', 'image'); return; } elseif (!$slider) { return; } $slider = $TFUSE->ext->slider->model->get_slider($slider); switch ($slider['type']) { case 'custom': if (is_array($slider['slides'])) { $slider_image_resize = isset($slider['general']['slider_image_resize']) && $slider['general']['slider_image_resize'] == 'true' ? true : false; foreach ($slider['slides'] as $k => $slide) { $image = new TF_GET_IMAGE(); $slider['slides'][$k]['slide_src'] = $image->width(960)->height(444)->src($slide['slide_src'])->resize($slider_image_resize)->get_src(); } } break; case 'posts': $args = array('post__in' => explode(',', $slider['general']['posts_select'])); $slides_posts = array(); $slides_posts = explode(',', $slider['general']['posts_select']); foreach ($slides_posts as $slide_posts) { $posts[] = get_post($slide_posts); } $posts = array_reverse($posts); $args = apply_filters('tfuse_slider_posts_args', $args, $slider); $args = apply_filters('tfuse_slider_posts_args_' . $ID, $args, $slider); break; case 'tags': $args = array('tag__in' => explode(',', $slider['general']['tags_select'])); $args = apply_filters('tfuse_slider_tags_args', $args, $slider); $args = apply_filters('tfuse_slider_tags_args_' . $ID, $args, $slider); $posts = get_posts($args); break; case 'categories': $args = 'cat=' . $slider['general']['categories_select'] . '&posts_per_page=' . $slider['general']['sliders_posts_number']; $args = apply_filters('tfuse_slider_categories_args', $args, $slider); $args = apply_filters('tfuse_slider_categories_args_' . $ID, $args, $slider); $posts = get_posts($args); break; } if (is_array($posts)) { $slider['slides'] = tfuse_get_slides_from_posts($posts, $slider); } if (!is_array($slider['slides'])) { return; } include_once locate_template('/theme_config/extensions/slider/designs/' . $slider['design'] . '/template.php'); }
<?php /** * The template for displaying content in the single-menu.php template. * To override this template in a child theme, copy this file * to your child theme's folder. * * @since The Flavour 1.0 */ $permalink = get_permalink(); ?> <article class="post post-details portfolio-details"> <header class="entry-header"> <div class="entry-meta"> <?php if (tfuse_options('enable_menus_meta', true)) { ?> <time class="entry-date"><?php echo get_the_date(); ?> </time> <span class="author"> <?php _e('by', 'tfuse'); ?> <?php the_author_posts_link(); ?> </span> <?php } ?>
function widget($args, $instance) { extract($args); $newsletter_title = empty($instance['newsletter_title']) ? 'Newsletter' : esc_attr($instance['newsletter_title']); $rss = empty($instance['rss']) ? '' : esc_attr($instance['rss']); $b = $instance['b'] = empty($instance['b']) ? '' : $instance['b']; $class = $b ? 'widget-boxed' : ''; ?> <div class="widget widget_newsletter newsletter_subscription_box newsletterBox <?php echo $class; ?> "> <?php if ($newsletter_title != '') { ?> <h3 class="widget-title"><?php echo tfuse_qtranslate($newsletter_title); ?> </h3><?php } ?> <div class="newsletter_subscription_messages before-text"> <div class="newsletter_subscription_message_initial"> <?php _e('', 'tfuse'); ?> </div> <div class="newsletter_subscription_message_success"> <?php _e('Thank you for your subscription.', 'tfuse'); ?> </div> <div class="newsletter_subscription_message_wrong_email"> <?php _e('Your email format is wrong!', 'tfuse'); ?> </div> <div class="newsletter_subscription_message_failed"> <?php _e('Sad, but we couldn\'t add you to our mailing list ATM.', 'tfuse'); ?> </div> </div> <form action="#" method="post" class="newsletter_subscription_form"> <input type="text" value="" name="newsletter" id="newsletter" class="newsletter_subscription_email inputtext" placeholder="<?php _e('Your Email', 'tfuse'); ?> " /> <button type="submit" class="btn btn-main newsletter_subscription_submit" value="<?php _e('Send', 'tfuse'); ?> "><?php _e('Subscribe', 'tfuse'); ?> </button> <div class="newsletter_subscription_ajax"> <?php _e('Loading...', 'tfuse'); ?> </div> <div class="newsletter_text"> <?php if ($rss == 'on') { ?> <a class="newssetter_subscribe" href="<?php echo tfuse_options('feedburner_url', get_bloginfo_rss('rss2_url')); ?> "><?php _e('I also want to subscribe to the RSS Feed', 'tfuse'); ?> </a> <?php } ?> </div> </form> </div> <?php }
function widget($args, $instance) { extract($args); $title = esc_attr($instance['newsletter_title']); $before_title = esc_attr($instance['before_title']); $notice = esc_attr($instance['notice']); $rss = empty($instance['rss']) ? '' : esc_attr($instance['rss']); $before_widget = '<div class="widget widget_newsletter newsletter_subscription_box">'; $after_widget = '</div>'; echo $before_widget; ?> <?php if (!empty($before_title)) { ?> <h3 class="widget-title-before"><?php echo tfuse_qtranslate($before_title); ?> </h3> <?php } ?> <?php if (!empty($title)) { ?> <h1 class="widget-title"><?php echo tfuse_qtranslate($title); ?> </h1> <?php } ?> <?php if (!empty($notice)) { ?> <div class="widget-content"><p><?php echo tfuse_qtranslate($notice); ?> </p></div> <?php } ?> <form action="#" method="post" class="newsletter_subscription_form"> <input type="text" value="" name="newsletter" class="newsletter_subscription_email inputtext" placeholder="Enter Your Email" /> <button type="submit" class="btn btn-newsletter newsletter_subscription_submit" value="<?php _e('Send', 'tfuse'); ?> " title="Subscribe"><span class="tficon-row"></span></button> <?php if ($rss != '') { ?> <div class="newsletter_text"> <a href="<?php echo tfuse_options('feedburner_url', '#'); ?> " class="link-news-rss"><?php _e('Also subscribe to <span>our RSS feed</span>', 'tfuse'); ?> </a> </div> <?php } ?> </form> <div class="newsletter_subscription_messages before-text" style="margin-left: 10px"> <div class="newsletter_subscription_message_success"> <?php _e('Thank you for your subscription.', 'tfuse'); ?> </div> <div class="newsletter_subscription_message_wrong_email"> <?php _e('Your email format is wrong!', 'tfuse'); ?> </div> <div class="newsletter_subscription_message_failed"> <?php _e('Sad, but we couldn\'t add you to our mailing list ATM.', 'tfuse'); ?> </div> </div> <div class="newsletter_subscription_ajax" style="margin-left: 10px"><?php _e('Loading...', 'tfuse'); ?> </div> <?php echo $after_widget; }
?> " > </a> <?php } $url = tfuse_page_options('ios_link'); if (!$isAndroid && !(ctype_space($url) || empty($url))) { ?> <a class="ios-link" href="<?php echo $url; ?> "> <img src="<?php echo tfuse_options('ios_appstore_img'); ?> " > </a> <?php } ?> </div> </div> </div> </li> </ul> </div> <!-- -->
?> </div> <?php $footer_socials = tfuse_options('header_socials'); ?> <?php if ($footer_socials == 'footer' || $footer_socials == 'both') { ?> <?php $fb = tfuse_options('header_facebook'); $tw = tfuse_options('header_twitter'); $db = tfuse_options('header_dribbble'); $lk = tfuse_options('header_linkedin'); $fl = tfuse_options('header_flickr'); ?> <div class="col-sm-4 footer-socials"> <span class="social-icons"> <?php if (!empty($fb)) { ?> <a href="<?php echo $fb; ?> " target="_blank" title="<?php _e('Facebook', 'tfuse'); ?> "><i class="tficon-facebook"></i> <span><?php _e('Facebook', 'tfuse'); ?>
/** * Return correct config array for requested method or false */ private function get_conf() { $conf = false; $method = trim(tfuse_options('mail__general__method')); if (!in_array($method, array('wpmail', 'smtp'))) { $method = 'wpmail'; } switch ($method) { case 'wpmail': $conf = array(); break; case 'smtp': $conf = array('host' => trim(tfuse_options('mail__smtp__host')), 'port' => trim(tfuse_options('mail__smtp__port')), 'username' => trim(tfuse_options('mail__smtp__username')), 'password' => trim(tfuse_options('mail__smtp__password')), 'secure' => in_array(tfuse_options('mail__smtp__secure'), array('ssl', 'tls')) ? tfuse_options('mail__smtp__secure') : ''); if (!in_array($conf['secure'], array('ssl', 'tls'))) { $conf['secure'] = false; } if (empty($conf['port']) || !is_numeric($conf['port'])) { $conf['port'] = 25; if ($conf['secure']) { $conf['port'] = 465; } } /** validate */ do { if (!tf_is_valid_domain_name($conf['host'])) { break; } if (empty($conf['username']) || empty($conf['password'])) { break; } break 2; } while (false); $conf = false; break; } /** add general settings */ if ($conf !== false) { $conf = array_merge($conf, array('from_address' => trim(tfuse_options('mail__general__from_address')), 'from_name' => trim(tfuse_options('mail__general__from_name')))); do { do { if (!empty($conf['from_email']) && !is_email($conf['from_email'])) { break; } $conf['_method'] = $method; break 2; } while (false); $conf = false; } while (false); } return $conf; }
<?php /* ----------------------------------------------------------------------------------- */ /* Initializes all the theme settings option fields for posts area. */ /* ----------------------------------------------------------------------------------- */ $options = array(array('name' => __('Info Page Options', 'tfuse'), 'id' => TF_THEME_PREFIX . '_side_media', 'type' => 'metabox', 'context' => 'side', 'priority' => 'low'), array('name' => __('Disable Image', 'tfuse'), 'desc' => '', 'id' => TF_THEME_PREFIX . '_disable_image', 'value' => tfuse_options('disable_image', 'false'), 'type' => 'checkbox'), array('name' => __('Disable Video', 'tfuse'), 'desc' => '', 'id' => TF_THEME_PREFIX . '_disable_video', 'value' => tfuse_options('disable_video', 'false'), 'type' => 'checkbox'), array('name' => __('Disable Comments', 'tfuse'), 'desc' => '', 'id' => TF_THEME_PREFIX . '_disable_comments', 'value' => tfuse_options('disable_posts_comments', 'false'), 'type' => 'checkbox'), array('name' => __('Media', 'tfuse'), 'id' => TF_THEME_PREFIX . '_media', 'type' => 'metabox', 'context' => 'normal'), array('name' => __('Image', 'tfuse'), 'desc' => __('This is the main image that appears on doctors\' info page. Upload one from your computer, or specify an online address for your image (Ex: ttp://yoursite.com/image.png).', 'tfuse'), 'id' => TF_THEME_PREFIX . '_single_image', 'value' => '', 'type' => 'upload', 'hidden_children' => array(TF_THEME_PREFIX . '_single_img_dimensions', TF_THEME_PREFIX . '_single_img_position')), array('name' => __('Image Resize (px)', 'tfuse'), 'desc' => __('These are the default width and height values. If you want to resize the image change the values with your own. If you input only one, the image will get resized with constrained proportions based on the one you specified.', 'tfuse'), 'id' => TF_THEME_PREFIX . '_single_img_dimensions', 'value' => tfuse_options('single_image_dimensions'), 'type' => 'textarray'), array('name' => __('Image Position', 'tfuse'), 'desc' => __('Select your preferred image alignment', 'tfuse'), 'id' => TF_THEME_PREFIX . '_single_img_position', 'value' => tfuse_options('thumbnail_position'), 'options' => array('' => array($url . 'full_width.png', __('Don\'t apply an alignment', 'tfuse')), 'alignleft' => array($url . 'left_off.png', __('Align to the left', 'tfuse')), 'alignright' => array($url . 'right_off.png', __('Align to the right', 'tfuse'))), 'type' => 'images', 'divider' => true), array('name' => __('Doctor Photo', 'tfuse'), 'desc' => __('This is the main image of a doctor. Upload one from your computer, or specify an online address for your image (Ex: ttp://yoursite.com/image.png).', 'tfuse'), 'id' => TF_THEME_PREFIX . '_thumbnail_image', 'value' => '', 'type' => 'upload', 'hidden_children' => array(TF_THEME_PREFIX . '_thumbnail_dimensions', TF_THEME_PREFIX . '_thumbnail_position')), array('name' => __('Photo Resize (px)', 'tfuse'), 'desc' => __('These are the default width and height values. If you want to resize the photo change the values with your own. If you input only one, the photo will get resized with constrained proportions based on the one you specified.', 'tfuse'), 'id' => TF_THEME_PREFIX . '_thumbnail_dimensions', 'value' => tfuse_options('thumbnail_dimensions'), 'type' => 'textarray'), array('name' => __('Photo Position', 'tfuse'), 'desc' => __('Select your preferred doctor photo Position.', 'tfuse'), 'id' => TF_THEME_PREFIX . '_thumbnail_position', 'value' => tfuse_options('thumbnail_position'), 'options' => array('' => array($url . 'full_width.png', __('Don\'t apply an alignment', 'tfuse')), 'alignleft' => array($url . 'left_off.png', __('Align to the left', 'tfuse')), 'alignright' => array($url . 'right_off.png', __('Align to the right', 'tfuse'))), 'type' => 'images', 'divider' => true), array('name' => __('Video', 'tfuse'), 'desc' => __('Copy paste the video URL or embed code. The video URL works only for Vimeo and YouTube videos. Read <a target="_blank" href="http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/">prettyPhoto documentation</a> for more info on how to add video or flash in this text area ', 'tfuse'), 'id' => TF_THEME_PREFIX . '_video_link', 'value' => '', 'type' => 'textarea', 'hidden_children' => array(TF_THEME_PREFIX . '_video_dimensions', TF_THEME_PREFIX . '_video_position')), array('name' => __('Video Size (px)', 'tfuse'), 'desc' => __('These are the default width and height values. If you want to resize the video change the values with your own. If you input only one, the video will get resized with constrained proportions based on the one you specified.', 'tfuse'), 'id' => TF_THEME_PREFIX . '_video_dimensions', 'value' => tfuse_options('thumbnail_dimensions'), 'type' => 'textarray'), array('name' => __('Video Position', 'tfuse'), 'desc' => __('Select your preferred video alignment', 'tfuse'), 'id' => TF_THEME_PREFIX . '_video_position', 'value' => tfuse_options('thumbnail_position'), 'options' => array('' => array($url . 'full_width.png', __('Don\'t apply an alignment', 'tfuse')), 'alignleft' => array($url . 'left_off.png', __('Align to the left', 'tfuse')), 'alignright' => array($url . 'right_off.png', __('Align to the right', 'tfuse'))), 'type' => 'images'), array('name' => __('Header', 'tfuse'), 'id' => TF_THEME_PREFIX . '_header_option', 'type' => 'metabox', 'context' => 'normal'), array('name' => __('Element of Hedear', 'tfuse'), 'desc' => __('Select type of element on the header.', 'tfuse'), 'id' => TF_THEME_PREFIX . '_header_element', 'value' => 'image', 'options' => array('none' => __('Without Header Element', 'tfuse'), 'slider' => __('Slider on Header', 'tfuse'), 'image' => __('Image on Header', 'tfuse')), 'type' => 'select'), $this->ext->slider->model->has_sliders() ? array('name' => __('Slider', 'tfuse'), 'desc' => __('Select a slider for your post. The sliders are created on the <a href="', 'tfuse') . admin_url('admin.php?page=tf_slider_list') . '" target="_blanck">Sliders page</a>.', 'id' => TF_THEME_PREFIX . '_select_slider', 'value' => '', 'options' => $TFUSE->ext->slider->get_sliders_dropdown(), 'type' => 'select') : array('name' => __('Slider', 'tfuse'), 'desc' => __('More details on <a href="', 'tfuse') . admin_url('admin.php?page=tf_slider_list') . '" target="_blank">Sliders</a> page.', 'id' => TF_THEME_PREFIX . '_select_slider', 'value' => '', 'html' => __('No sliders created yet. You can start creating one', 'tfuse') . '<a href="' . admin_url('admin.php?page=tf_slider_list') . '">' . __('here', 'tfuse') . '</a>.', 'type' => 'raw'), array('name' => __('Header Image', 'tfuse'), 'desc' => __('Upload an image for your header. It will be resized to 960x142 px', 'tfuse'), 'id' => TF_THEME_PREFIX . '_header_image', 'value' => tfuse_options('doctor_header_image'), 'type' => 'upload'));
<?php $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); $term_id = $term->term_id; $header_bg = tfuse_options('header_image', tfuse_options('header_image', '', $term->parent), $term_id); $child_terms = tfuse_get_menu_subcategories_terms($term_id); $subcategories_list = ''; if (!empty($child_terms)) { foreach ($child_terms as $item) { $subcategories_list .= '<li class="categories-item "> <a href="#' . $item->slug . '" class="anchor-scroll"><img src="' . tfuse_options('category_icon', '', $item->term_id) . '"><br><br>' . $item->name . '</a> </li>'; } } ?> <section class="main-top"> <div class="main-slider"> <div class="wrap-main-slider" style="background-image:url(<?php echo $header_bg; ?> );"> <div class="main-slider-content"> <h1 class="main-slider-title"><?php echo $term->name; ?> </h1> <div class="container"> <div class="row"> <div class="col-sm-8 col-sm-offset-2"> <div class="categories-slider menu-slider"> <div class="caroufredsel_wrapper">
function tfuse_set_blog_page() { global $wp_query, $is_tf_blog_page; if (isset($wp_query->queried_object->ID)) { $id_post = $wp_query->queried_object->ID; } elseif (isset($wp_query->query['page_id'])) { $id_post = $wp_query->query['page_id']; } else { $id_post = 0; } if (tfuse_options('blog_page') != 0 && $id_post == tfuse_options('blog_page')) { $is_tf_blog_page = true; } }
<div class="footer"> <div class="container_12"> <?php tfuse_footer(); ?> <div class="clear"></div> <div class="copyright"><?php echo tfuse_options('custom_copyright'); ?> </div> </div> </div> <?php wp_footer(); ?> </body> </html>
/** * Builds the sitemap and writes it into a xml file. * * @return array An array with messages such as failed writes etc. */ function BuildSitemap() { global $wpdb, $posts, $wp_version; //Other plugins can detect if the building process is active $this->_isActive = true; if (true) { $fileName = $this->GetXmlPath(); if ($this->IsFileWritable($fileName)) { $this->_fileHandle = fopen($fileName, "w"); } } //Write gzipped sitemap file if ($this->IsGzipEnabled()) { $fileName = $this->GetZipPath(); if ($this->IsFileWritable($fileName)) { $this->_fileZipHandle = gzopen($fileName, "w1"); } } if (!$this->_fileHandle && !$this->_fileZipHandle) { return; } //Content of the XML file $this->AddElement(new TF_SEO_SitemapGeneratorXmlEntry('<?xml version="1.0" encoding="UTF-8"' . '?' . '>')); //All comments as an asso. Array (postID=>commentCount) $comments = array(); //Full number of comments $commentCount = 0; //Go XML! $this->AddElement(new TF_SEO_SitemapGeneratorXmlEntry('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">')); $home = home_url(); $homePid = 0; //Add the home page (WITH a slash!) if (true) { if ('page' == get_option('show_on_front') && get_option('page_on_front')) { $pageOnFront = get_option('page_on_front'); $p = get_page($pageOnFront); if ($p) { $homePid = $p->ID; $this->AddUrl(trailingslashit($home), $this->GetTimestampFromMySql($p->post_modified_gmt && $p->post_modified_gmt != '0000-00-00 00:00:00' ? $p->post_modified_gmt : $p->post_date_gmt), $this->GetOption("cf_home"), $this->GetOption("pr_home")); } } else { $this->AddUrl(trailingslashit($home), $this->GetTimestampFromMySql(get_lastpostmodified('GMT')), $this->GetOption("cf_home"), $this->GetOption("pr_home")); } } //Add the posts if (true) { $wpCompat = false; $excludes = ''; //Excluded posts and pages (user enetered ID) $exclCats = ''; // Excluded cats $sql = "SELECT `ID`, `post_author`, `post_date`, `post_date_gmt`, `post_status`, `post_name`, `post_modified`, `post_modified_gmt`, `post_parent`, `post_type` FROM `" . $wpdb->posts . "` WHERE "; $where = '('; if (true) { $where .= " (post_status = 'publish' AND (post_type in (''"; foreach (get_post_types() as $customType) { if (!in_array($customType, array('revision', 'nav_menu_item', 'attachment'))) { if (!tfuse_options('seo_xmls_exclude_posttype_' . $customType, false) && 'STOP!' != tfuse_options('seo_xmls_exclude_posttype_' . $customType, 'STOP!')) { $where .= ",'{$customType}'"; } } } $where .= "))) "; } $where .= ") "; $where .= " AND post_password='' ORDER BY post_modified DESC"; $sql .= $where; if ($this->GetOption("b_max_posts") > 0) { $sql .= " LIMIT 0," . $this->GetOption("b_max_posts"); } $postCount = intval($wpdb->get_var("SELECT COUNT(*) AS cnt FROM `" . $wpdb->posts . "` WHERE " . $where, 0, 0)); //Create a new connection because we are using mysql_unbuffered_query and don't want to disturb the WP connection //Safe Mode for other plugins which use mysql_query() without a connection handler and will destroy our resultset :( $con = $postRes = null; if (true) { $postRes = mysql_query($sql, $wpdb->dbh); if (!$postRes) { trigger_error("MySQL query failed: " . mysql_error(), E_USER_NOTICE); //E_USER_NOTICE will be displayed on our debug mode return; } } if ($postRes) { $prioProvider = NULL; $z = 1; $zz = 1; //Default priorities $default_prio_posts = $this->GetOption('pr_posts'); $default_prio_pages = $this->GetOption('pr_pages'); //Change frequencies $cf_pages = $this->GetOption('cf_pages'); $cf_posts = $this->GetOption('cf_posts'); $minPrio = $this->GetOption('pr_posts_min'); //Cycle through all posts and add them while ($post = mysql_fetch_object($postRes)) { //Fill the cache with our DB result. Since it's incomplete (no text-content for example), we will clean it later. $cache = array(&$post); update_post_cache($cache); //Set the current working post for other plugins which depend on "the loop" $GLOBALS['post'] =& $post; $permalink = get_permalink($post->ID); if ($permalink != $home && $post->ID != $homePid) { $isPage = false; if ($wpCompat) { $isPage = $post->post_status == 'static'; } else { $isPage = $post->post_type == 'page'; } //Default Priority if auto calc is disabled $prio = 0; if ($isPage) { //Priority for static pages $prio = $default_prio_pages; } else { //Priority for normal posts $prio = $default_prio_posts; } if (!$isPage && $minPrio > 0 && $prio < $minPrio) { $prio = $minPrio; } //Add it $this->AddUrl($permalink, $this->GetTimestampFromMySql($post->post_modified_gmt && $post->post_modified_gmt != '0000-00-00 00:00:00' ? $post->post_modified_gmt : $post->post_date_gmt), $isPage ? $cf_pages : $cf_posts, $prio); if (false) { $subPage = ''; for ($p = 1; $p <= $post->postPages; $p++) { if (get_option('permalink_structure') == '') { $subPage = $permalink . '&paged=' . ($p + 1); } else { $subPage = trailingslashit($permalink) . user_trailingslashit($p + 1, 'single_paged'); } $this->AddUrl($subPage, $this->GetTimestampFromMySql($post->post_modified_gmt && $post->post_modified_gmt != '0000-00-00 00:00:00' ? $post->post_modified_gmt : $post->post_date_gmt), $isPage ? $cf_pages : $cf_posts, $prio); } } } //Update the status every 100 posts and at the end. //If the script breaks because of memory or time limit, //we have a "last reponded" value which can be compared to the server settings if ($zz == 100 || $z == $postCount) { $zz = 0; } else { $zz++; } $z++; //Clean cache because it's incomplete if (version_compare($wp_version, "2.5", ">=")) { //WP 2.5 makes a mysql query for every clean_post_cache to clear the child cache //so I've copied the function here until a patch arrives... wp_cache_delete($post->ID, 'posts'); wp_cache_delete($post->ID, 'post_meta'); clean_object_term_cache($post->ID, 'post'); } else { clean_post_cache($post->ID); } } unset($postRes); unset($prioProvider); } } //Add custom taxonomy pages if (true) { $taxList = array(); foreach (get_taxonomies() as $taxName) { if (!in_array($taxName, array('nav_menu', 'link_category', 'post_format'))) { $taxonomy = get_taxonomy($taxName); if (isset($taxonomy->labels->name) && trim($taxonomy->labels->name) != '') { if (!tfuse_options('seo_xmls_exclude_taxonomy_' . $taxName, false) && 'STOP!' != tfuse_options('seo_xmls_exclude_taxonomy_' . $taxName, 'STOP!')) { if ($taxonomy) { $taxList[] = $wpdb->escape($taxonomy->name); } } } } } if (count($taxList) > 0) { //We're selecting all term information (t.*) plus some additional fields //like the last mod date and the taxonomy name, so WP doesnt need to make //additional queries to build the permalink structure. //This does NOT work for categories and tags yet, because WP uses get_category_link //and get_tag_link internally and that would cause one additional query per term! $sql = "\r\r\n\t\t\t\t\tSELECT\r\r\n\t\t\t\t\t\tt.*,\r\r\n\t\t\t\t\t\ttt.taxonomy AS _taxonomy,\r\r\n\t\t\t\t\t\tUNIX_TIMESTAMP(MAX(post_date_gmt)) as _mod_date\r\r\n\t\t\t\t\tFROM\r\r\n\t\t\t\t\t\t{$wpdb->posts} p ,\r\r\n\t\t\t\t\t\t{$wpdb->term_relationships} r,\r\r\n\t\t\t\t\t\t{$wpdb->terms} t,\r\r\n\t\t\t\t\t\t{$wpdb->term_taxonomy} tt\r\r\n\t\t\t\t\tWHERE\r\r\n\t\t\t\t\t\tp.ID = r.object_id\r\r\n\t\t\t\t\t\tAND p.post_status = 'publish'\r\r\n\t\t\t\t\t\tAND p.post_password = ''\r\r\n\t\t\t\t\t\tAND r.term_taxonomy_id = t.term_id\r\r\n\t\t\t\t\t\tAND t.term_id = tt.term_id\r\r\n\t\t\t\t\t\tAND tt.count > 0\r\r\n\t\t\t\t\t\tAND tt.taxonomy IN ('" . implode("','", $taxList) . "')\r\r\n\t\t\t\t\tGROUP BY \r\r\n\t\t\t\t\t\tt.term_id"; $termInfo = $wpdb->get_results($sql); foreach ($termInfo as $term) { if (!in_array($term->_taxonomy, array('nav_menu', 'link_category', 'post_format'))) { $this->AddUrl(get_term_link($term->slug, $term->_taxonomy), $term->_mod_date, $this->GetOption("cf_tags"), $this->GetOption("pr_tags")); } } } } //Add the custom pages if ($this->_pages && is_array($this->_pages) && count($this->_pages) > 0) { //#type $page TF_SEO_SitemapGeneratorPage foreach ($this->_pages as $page) { $this->AddUrl($page->GetUrl(), $page->getLastMod(), $page->getChangeFreq(), $page->getPriority()); } } do_action('tf_seo_buildmap'); $this->AddElement(new TF_SEO_SitemapGeneratorXmlEntry("</urlset>")); $pingUrl = ''; if (true) { if ($this->_fileHandle && fclose($this->_fileHandle)) { $this->_fileHandle = null; $pingUrl = $this->GetXmlUrl(); } } if ($this->IsGzipEnabled()) { if ($this->_fileZipHandle && fclose($this->_fileZipHandle)) { $this->_fileZipHandle = null; $pingUrl = $this->GetZipUrl(); } } //Ping Google if (!empty($pingUrl)) { $sPingUrl = "http://www.google.com/webmasters/sitemaps/ping?sitemap=" . urlencode($pingUrl); $pingres = $this->RemoteOpen($sPingUrl); if ($pingres == NULL || $pingres === false) { trigger_error("Failed to ping Google: " . htmlspecialchars(strip_tags($pingres)), E_USER_NOTICE); } } //Ping Ask.com if (!empty($pingUrl)) { $sPingUrl = "http://submissions.ask.com/ping?sitemap=" . urlencode($pingUrl); $pingres = $this->RemoteOpen($sPingUrl); if ($pingres == NULL || $pingres === false || strpos($pingres, "successfully received and added") === false) { //Ask.com returns 200 OK even if there was an error, so we need to check the content. trigger_error("Failed to ping Ask.com: " . htmlspecialchars(strip_tags($pingres)), E_USER_NOTICE); } } //Ping Bing if (!empty($pingUrl)) { $sPingUrl = "http://www.bing.com/webmaster/ping.aspx?siteMap=" . urlencode($pingUrl); $pingres = $this->RemoteOpen($sPingUrl); //Bing returns ip/country-based success messages, so there is no way to check the content. Rely on HTTP 500 only then... if ($pingres == NULL || $pingres === false || strpos($pingres, " ") === false) { trigger_error("Failed to ping Bing: " . htmlspecialchars(strip_tags($pingres)), E_USER_NOTICE); } } $this->_isActive = false; //done... return; }
function tfuse_shortcode_latest_entry($atts, $content = null) { $out = ''; $recent_post = wp_get_recent_posts(array('numberposts' => 1)); if (!empty($recent_post)) { foreach ($recent_post as $post) { $image = wp_get_attachment_url(get_post_thumbnail_id($post['ID'], 'post-thumbnails')); $get_image = new TF_GET_IMAGE(); $img = $get_image->properties(array('class' => '', 'alt' => get_the_title($post['ID'])))->width(210)->height(210)->src($image)->resize(true)->get_img(); $current_post = get_post($post['ID']); $out .= ' <div class="home-post"> <div class="inner"> <div class="entry-aside"> <header class="entry-header"> <div class="entry-meta"> <div class="cat-links"> <a href="' . get_permalink($post['ID']) . '">' . __('Latest blog entry', 'tfuse') . '</a> </div> <time class="entry-date"><i class="icon-circle"></i>' . get_the_time(get_option('date_format'), $post['ID']) . '</time> <h1 class="entry-title"> <a href="' . get_permalink($post['ID']) . '">' . get_the_title($post['ID']) . '</a> </h1> </div> </header>'; if (!empty($image)) { $out .= '<a class="post-thumbnail" href="' . get_permalink($post['ID']) . '">' . $img . '</a>'; } $out .= '<div class="entry-content"> <p>'; if (tfuse_options('post_content') == 'content') { $out .= $current_post->post_content; } else { $out .= !empty($current_post->post_excerpt) ? $current_post->post_excerpt : strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)); } $out .= '</p> </div> <footer class="entry-meta"> <a href="' . get_permalink($post['ID']) . '" class="btn btn-transparent btn-lets-talk"><span>' . __('Read article', 'tfuse') . ' <i class="icon-chevron-right align-right-icon"></i></span></a> </footer> </div> </div> </div>'; } } return $out; }