Пример #1
0
 public function get_html()
 {
     global $post;
     // v6.76
     $params = $this->params;
     //var_dump($params);
     Wf_Debug::stash(array('$params' => $params));
     $html = "\n<div class='" . $params['style'] . "'>\n";
     // v3.51 renamed from $class
     $html .= extra_markup($params);
     // v4.2
     if ($params['heading']) {
         $html .= "<div class='hwrap'><h2>" . $params['heading'] . "</h2></div>\n";
         // <div class='hwrap'> added for carplus v3.15
     }
     $widg_id = $params['widgnum'] . "_" . $params['region'];
     // eg: 0_left   or __shortcode // v4.3 $params['region']
     $args = array('post_type' => $params['post_type'], 'post_status' => $params['status'], 'posts_per_page' => $params['show_posts'], 'order' => strtoupper($params['order']), 'orderby' => $params['orderby'], 'widg_id' => $widg_id, 'list' => true, 'paginate' => $params['paginate']);
     if ($params['paginate']) {
         parse_str($_SERVER['QUERY_STRING'], $q_array);
         // eg: ?pgd_0_left=3
         if (isset($q_array["pgd_" . $widg_id])) {
             $args['paged'] = $q_array["pgd_" . $widg_id];
         } else {
             $args['paged'] = 1;
         }
     }
     // v6.63
     if ($params['date_field']) {
         if ($params['orderby'] == 'date') {
             $args['orderby'] = 'meta_value';
             $args['meta_key'] = $params['date_field'];
         }
         if ($params['status'] == 'future') {
             $args['post_status'] = 'publish';
             // v6.68 not 'published'!
             $args['meta_query'] = array(array('key' => $params['date_field'], 'type' => 'DATETIME', 'value' => date("Y-m-d H:i"), 'compare' => '>'));
         }
     }
     if ($params['cat'] !== false) {
         $args['tax_query'] = array(array('taxonomy' => $params['post_type'] == 'post' ? 'category' : $params['post_type'] . '_type', 'field' => 'id', 'terms' => $params['cat'], 'operator' => 'IN'));
         if ($params['omit_self']) {
             // v6.76
             //$args['post__not_in'] = array($params['host_post']);
             $args['post__not_in'] = array($post->ID);
         }
     }
     Wf_Debug::stash(array('$args' => $args));
     $html .= get_catposts($args, $params);
     $html .= Wf_Widget::get_endlink($params);
     //v5.7
     $html .= "</div>\n";
     // class = 'list'
     return $html;
 }
Пример #2
0
function lib_move_stuff()
{
    // stuff that broke when I moved wf_lib to a plugin
    // MISCELLANEOUS /////////////////////////////////////////////////////////////////////////////
    // Specify users (by login name) who will see debug info...
    if (class_exists('Wf_Debug')) {
        //v6.15
        Wf_Debug::$users = array('Wingfinger', 'Bill', 'admin');
    }
    if (function_exists('set_up_mimic_content_filter')) {
        //v6.15
        set_up_mimic_content_filter();
    }
    if (!function_exists('widget_html')) {
        function widget_html($widget_class, $style, $qstring)
        {
            return "<p class='not_found'>Class " . $widget_class . " not found. <strong>wf_library</strong> plugin not loaded.</p>";
        }
    }
    function get_region_html($region)
    {
        if (class_exists('Wf_Widget')) {
            return Wf_Widget::get_region_html($region);
        } else {
            return "Wingfinger Widgets plugin not loaded.";
        }
    }
    function new_excerpt_length($length)
    {
        return 25;
        //to change the number of words in an excerpt
    }
    add_filter('excerpt_length', 'new_excerpt_length');
    function new_excerpt_more($more)
    {
        global $post;
        return ' <a class=more_link href="' . get_permalink($post->ID) . '">&#187; Read more...</a>';
        // to make the read more into a link to the post
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    if (function_exists('search_request_filter')) {
        add_filter('request', 'search_request_filter');
        // wf_lib.php
    }
    if (function_exists('show_future_posts')) {
        add_filter('the_posts', 'show_future_posts');
    }
    add_theme_support('post-thumbnails');
    add_post_type_support('wf_snippet', 'comments');
    add_post_type_support('wf_sitenote', 'comments');
    // Specify which pages should be excluded from main menu
    function get_page_excludes()
    {
        // v2.19
        $excludes = array();
        return implode(',', array_keys($excludes));
    }
    // IMAGE SIZES /////////////////////////////////////////////////////////////////////////////
    global $content_width;
    $content_width = 740;
    // limits width of large size uploads - www.deluxeblogtips.com/2010/05/max-image-size-wordpress-theme.html
    if (false === get_option("medium_crop")) {
        // force WP to crop medium images: wordpress.org/support/topic/force-crop-to-medium-size
        add_option("medium_crop", "1");
    } else {
        update_option("medium_crop", "1");
    }
    if (false === get_option("large_crop")) {
        // force WP to crop large images: wordpress.org/support/topic/force-crop-to-medium-size
        add_option("large_crop", "1");
    } else {
        update_option("large_crop", "1");
    }
}
Пример #3
0
function add_wf_debug_dashboard_box()
{
    // v6.25
    if (class_exists('Wf_Debug') && Wf_Debug::output('bottom') != '') {
        wp_add_dashboard_widget('wf_debug_box_id', 'Wingfinger debugging info', 'wf_debug_dashboard_box');
        // NB: same id as metabox version
    }
}
Пример #4
0
echo get_region_html('left');
?>
					</div><!-- wf_lining -->
				</div><!-- leftcol -->
				
				
				<!--<div id="threecolclearer"></div> -->
			<!--</div>--><!-- threecols -->
			
			<footer id="footer">
				<?php 
if (function_exists('admin_login_link')) {
    // wf_library
    admin_login_link();
}
?>
				<p>Powered by WordPress. <a href="http://www.wingfinger.co.uk/">Web design by Wingfinger Graphics, Leeds</a></p>
			</footer>
			<?php 
wp_footer();
// required for plugins that hook to 'wp_footer'
if (class_exists('Wf_Debug')) {
    // wf_library
    echo Wf_Debug::output('debug');
    // v6.17
}
?>
		
		
	</body>
</html>