示例#1
0
 function woo_display_post_image()
 {
     global $woo_options;
     $display_image = false;
     $width = $woo_options['woo_thumb_w'];
     $height = $woo_options['woo_thumb_h'];
     $align = $woo_options['woo_thumb_align'];
     if (is_single() && isset($woo_options['woo_thumb_single']) && $woo_options['woo_thumb_single'] == 'true') {
         $width = $woo_options['woo_single_w'];
         $height = $woo_options['woo_single_h'];
         $align = $woo_options['woo_thumb_align_single'];
         $display_image = true;
     }
     if (get_option('woo_woo_tumblog_switch') == 'true') {
         $is_tumblog = woo_tumblog_test();
     } else {
         $is_tumblog = false;
     }
     if ($is_tumblog || is_single() && @$woo_options['woo_thumb_single'] == 'false') {
         $display_image = false;
     }
     if ($display_image == true && !woo_embed('')) {
         woo_image('width=' . $width . '&height=' . $height . '&class=thumbnail ' . $align);
     }
 }
示例#2
0
 function woo_display_post_image()
 {
     $display_image = false;
     $options = woo_get_dynamic_values(array('thumb_w' => '100', 'thumb_h' => '100', 'thumb_align' => 'alignleft', 'single_w' => '100', 'single_h' => '100', 'thumb_align_single' => 'alignright', 'thumb_single' => 'false'));
     $width = $options['thumb_w'];
     $height = $options['thumb_h'];
     $align = $options['thumb_align'];
     if (is_single() && 'true' == $options['thumb_single']) {
         $width = $options['single_w'];
         $height = $options['single_h'];
         $align = $options['thumb_align_single'];
         $display_image = true;
     }
     if ('true' == get_option('woo_woo_tumblog_switch')) {
         $is_tumblog = woo_tumblog_test();
     } else {
         $is_tumblog = false;
     }
     if ($is_tumblog || is_single() && 'false' == $options['thumb_single']) {
         $display_image = false;
     }
     if (true == $display_image && !woo_embed('')) {
         woo_image('width=' . esc_attr($width) . '&height=' . esc_attr($height) . '&class=thumbnail ' . esc_attr($align));
     }
 }
示例#3
0
/**
 * Load a template part into a template
 *
 * Makes it easy for a theme to reuse sections of code in a easy to overload way
 * for child themes.
 *
 * Includes the named template part for a theme or if a name is specified then a
 * specialised part will be included. If the theme contains no {slug}.php file
 * then no template will be included.
 *
 * The template is included using require, not require_once, so you may include the
 * same template part multiple times.
 *
 * For the parameter, if the file is called "{slug}-special.php" then specify
 * "special".
 *
 * This version of the `get_template_part()` function has been enhanced to include
 * additional checks for "{slug}-POST_SLUG.php" and "{slug}-POST_ID.php" if within
 * the loop. It also checks for "{slug}-POST_FORMAT.php" if using WordPress 3.1+.
 *
 * @uses locate_template()
 * @since 4.0.0
 * @uses do_action() Calls 'get_template_part_{$slug}' action.
 *
 * @param string $slug The slug name for the generic template.
 * @param string $name The name of the specialised template.
 */
function woo_get_template_part($slug, $name = null)
{
    global $post, $wp_version, $wp_query;
    do_action("get_template_part_{$slug}", $slug, $name);
    $templates = array();
    // Template files specific to this post in single and archive scenarios.
    if (isset($post)) {
        $post_type = get_post_type();
        // Specific files.
        // Archive.
        if (is_archive() || is_home() || is_search()) {
            $templates[] = "{$slug}-archive-{$post->post_name}.php";
            $templates[] = "{$slug}-archive-" . $post_type . "-{$post->ID}.php";
            $templates[] = "{$slug}-archive-" . $post_type . ".php";
        }
        // Single.
        if (is_singular()) {
            $templates[] = "{$slug}-single-{$post->post_name}.php";
            $templates[] = "{$slug}-single-" . $post_type . "-{$post->ID}.php";
        }
        $templates[] = "{$slug}-{$post->post_name}.php";
        if ($post_type != 'post') {
            $templates[] = "{$slug}-" . $post_type . "-{$post->ID}.php";
        }
        $templates[] = "{$slug}-post-{$post->ID}.php";
        // More generic files.
        // Archive.
        if (is_archive() || is_home()) {
            $templates[] = "{$slug}-archive-" . $post_type . ".php";
            $templates[] = "{$slug}-archive.php";
        }
        // Single.
        if (is_singular()) {
            $templates[] = "{$slug}-single-" . $post_type . ".php";
            $templates[] = "{$slug}-single.php";
        }
    }
    // Template file for post format.
    if ($wp_version >= '3.1') {
        if (isset($post) && get_post_format($post)) {
            $templates[] = "{$slug}-format-" . get_post_format($post) . '.php';
        }
    }
    // If it's a tumblog post, and WooTumblog is present.
    if (function_exists('woo_tumblog_test') && defined('WOOTUMBLOG_ACTIVE')) {
        $is_tumblog = woo_tumblog_test();
        if ($is_tumblog) {
            $templates[] = "{$slug}-tumblog.php";
        }
    }
    // Template file as per the parameters.
    if (isset($name)) {
        $templates[] = "{$slug}-{$name}.php";
    }
    // Generic $slug template file.
    $templates[] = "{$slug}.php";
    $templates = apply_filters('woo_template_parts', $templates);
    locate_template($templates, true, false);
}
示例#4
0
woo_loop_before();
if (have_posts()) {
    $count = 0;
    $title_before = '<h1 class="archive_header">';
    $title_after = '</h1>';
    echo $title_before . sprintf(__('Search results for &quot;%s&quot;', 'woothemes'), get_search_query()) . $title_after;
    ?>

<div class="fix"></div>

<?php 
    if (function_exists('relevanssi_didyoumean')) {
        relevanssi_didyoumean(get_search_query(), "<p>Did you mean: ", "</p><br>", 5);
    }
    while (have_posts()) {
        the_post();
        $count++;
        if (get_option('woo_woo_tumblog_switch') == 'true') {
            $is_tumblog = woo_tumblog_test();
        } else {
            $is_tumblog = false;
        }
        woo_get_template_part('content', 'search');
    }
    // End WHILE Loop
} else {
    get_template_part('content', 'noposts');
}
// End IF Statement
woo_loop_after();
woo_pagenav();