function widget($args, $instance)
    {
        extract($args);
        $loc = get_locale();
        $emailtxt = 'text';
        if (xtreme_is_html5()) {
            $emailtxt = 'email';
        }
        echo $before_widget;
        if ($instance['title']) {
            echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title;
        }
        ?>
<div>
	<form action="http://feedburner.google.com/fb/a/mailverify" method="post" <?php 
        xtreme_aria_required('application', true);
        ?>
>
		<div>
        <?php 
        if ($instance['text'] != '') {
            echo "<label for='x-email'>" . esc_html($instance['text']) . "</label>";
        }
        ?>
			<input class="x-newsletter-email" id="x-email" <?php 
        xtreme_aria_required('email', true);
        ?>
 type="<?php 
        echo $emailtxt;
        ?>
" name="email" value="<?php 
        echo esc_attr($instance['email']);
        ?>
" onfocus="if (this.value == '<?php 
        echo esc_js($instance['email']);
        ?>
') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php 
        echo esc_js($instance['email']);
        ?>
';}" />
			<input class="x-newsletter-submit" type="submit" value="<?php 
        echo esc_attr($instance['button_text']);
        ?>
" />
			<input type="hidden" value="<?php 
        echo esc_attr($instance['feedburner_id']);
        ?>
" name="uri" />
			<input type="hidden" name="loc" value="<?php 
        echo $loc;
        ?>
" />
		</div>
	</form>
</div>
        <?php 
        echo $after_widget;
    }
    public function widget($args, $instance)
    {
        global $wpdb;
        extract($args);
        $number_posts = absint($instance['number_posts']);
        /* @since 09/26/2013 */
        $post_type = isset($instance['post_type']) ? esc_attr($instance['post_type']) : 'post';
        $columns = absint($instance['columns']);
        $thumbnail_size = esc_attr($instance['thumbnail_size']);
        /* since 1.01 */
        $contentorder = array('content' => isset($instance['content_pos']) ? (int) $instance['content_pos'] : 4, 'byline' => isset($instance['byline_pos']) ? (int) $instance['byline_pos'] : 3, 'subtitle' => isset($instance['subtitle_pos']) ? (int) $instance['subtitle_pos'] : 3, 'posttitle' => isset($instance['posttitle_pos']) ? (int) $instance['posttitle_pos'] : 2, 'thumbnail' => isset($instance['image_pos']) ? (int) $instance['image_pos'] : 1);
        /* since 1.1 */
        $title_tag = isset($instance['title_tag']) ? esc_attr($instance['title_tag']) : 'h3';
        $tag = isset($instance['posttitle_tag']) ? esc_attr($instance['posttitle_tag']) : 'h2';
        $subtag = isset($instance['subtitle_tag']) ? esc_attr($instance['subtitle_tag']) : 'h3';
        if (!isset($instance['content_pos'])) {
            $instance['show_posttitle'] = 1;
            $instance['show_content'] = 1;
            $instance['sticky'] = 0;
        }
        $suppress_posttitle_link = isset($instance['suppress_posttitle_link']) ? (bool) ($instance['suppress_posttitle_link'] == 1) : false;
        $suppress_postthumbnail_link = isset($instance['suppress_postthumbnail_link']) ? (bool) ($instance['suppress_postthumbnail_link'] == 1) : false;
        $suppress_category_link = isset($instance['suppress_category_link']) ? (bool) ($instance['suppress_category_link'] == 1) : false;
        if (!isset($instance['show_subtitle'])) {
            $instance['show_subtitle'] = 0;
        }
        asort($contentorder, SORT_NUMERIC);
        foreach ($contentorder as $key => $value) {
            if ($instance['show_' . $key]) {
                $new_sort[] = $key;
            }
        }
        $el = 'div';
        $html5 = xtreme_is_html5();
        if ($html5) {
            $el = 'article';
        }
        echo $before_widget;
        if ($columns !== 1) {
            echo '<div class="ym-grid linearize-level-1">';
        }
        for ($i = 0; $i < $columns; $i++) {
            if ($columns !== 1) {
                echo "<div class='" . $this->classes[$columns][$i]['outer'] . "'>\n";
                echo "<div class='" . $this->classes[$columns][$i]['inner'] . "'>\n";
            }
            /* @since 09/26/2013 */
            $tax_names = get_object_taxonomies($post_type);
            if (!empty($tax_names) && in_array('category', $tax_names)) {
                $category = $instance['category-' . $i];
            } else {
                $category = '';
            }
            $r = new WP_Query(array('cat' => $category, 'showposts' => $number_posts, 'offset' => (int) $instance['offset'], 'nopaging' => 0, 'post_type' => $post_type, 'post_status' => 'publish', XF_STICKY_HANDLING => 1, 'orderby' => esc_attr($instance['orderby']), 'order' => esc_attr(strtoupper($instance['sort']))));
            if ($r->have_posts()) {
                $x = 0;
                while ($r->have_posts()) {
                    $r->the_post();
                    $x++;
                    if ($x === 1 && '' !== $category && $instance['title']) {
                        if ((int) $instance['category-' . $i] === 0) {
                            $title = __('All Categories', XF_TEXTDOMAIN);
                            $cls = 'category-all';
                        } else {
                            $cat = get_category($instance['category-' . $i]);
                            $cls = 'category-' . $cat->slug;
                            if (!$suppress_category_link) {
                                $title = '<a href="' . esc_attr(get_category_link($instance['category-' . $i])) . '">' . esc_attr($cat->name) . '</a>';
                            } else {
                                $title = esc_attr($cat->name);
                            }
                        }
                        echo '<' . $title_tag . ' class="widget-title ' . $cls . '">' . $title . '</' . $title_tag . '>';
                    }
                    ?>
					<<?php 
                    echo $el;
                    ?>
 <?php 
                    post_class();
                    ?>
>
					<?php 
                    if (isset($new_sort)) {
                        $c = count($new_sort);
                        for ($y = 0; $y < $c; $y++) {
                            switch ($new_sort[$y]) {
                                case 'thumbnail':
                                    if (!$suppress_postthumbnail_link) {
                                        xtreme_post_thumbnail($thumbnail_size, esc_attr($instance['image_alignment']));
                                    } else {
                                        xtreme_widget_post_thumbnail($thumbnail_size, esc_attr($instance['image_alignment']));
                                    }
                                    break;
                                case 'subtitle':
                                    xtreme_widget_post_subtitle($subtag);
                                    break;
                                case 'posttitle':
                                    if ($html5) {
                                        echo '<header>';
                                    }
                                    xtreme_widget_post_headline($tag, !$suppress_posttitle_link);
                                    if ($html5 && $new_sort[$y + 1] !== 'byline') {
                                        echo '</header>';
                                    }
                                    break;
                                case 'byline':
                                    if (!$html5) {
                                        xtreme_byline();
                                    } else {
                                        xtreme_html5_byline();
                                        if ($new_sort[$y - 1] == 'posttitle') {
                                            echo '</header>';
                                        }
                                    }
                                    break;
                                case 'content':
                                    echo '<div class="entry-content">';
                                    switch ($instance['content_type']) {
                                        case 'xtreme_excerpt':
                                            xtreme_excerpt($instance['excerpt_length'], esc_html($instance['excerpt_morelink_text']), esc_html($instance['excerpt_more']));
                                            break;
                                        case 'excerpt':
                                            $new_excerpt = wptexturize(get_the_excerpt());
                                            echo "<p>{$new_excerpt} <span class='read-more'><a href='" . get_permalink() . "' title='" . __('Read more about', XF_TEXTDOMAIN) . ' ' . esc_attr(get_the_title()) . "'>" . esc_html($instance['excerpt_morelink_text']) . "</a></span></p>";
                                            break;
                                        case 'content':
                                            the_content();
                                            break;
                                    }
                                    echo '</div>';
                                    break;
                            }
                        }
                        echo '</' . $el . '>';
                    }
                }
                if ($columns !== 1) {
                    echo "</div></div>";
                }
                wp_reset_query();
            } else {
                echo __('No Posts so far.', XF_TEXTDOMAIN) . '</div></div>';
            }
        }
        if ($columns !== 1) {
            echo '</div>';
        }
        echo $after_widget;
    }
Beispiel #3
0
<?php

/*
* Xtreme Name: Archive
*/
get_header();
if (have_posts()) {
    the_post();
    do_action('xtreme_archive_title');
}
rewind_posts();
$docmode = '';
if (xtreme_is_html5()) {
    $docmode = 'html5';
}
get_template_part($docmode . 'loop', 'archive');
get_footer();
Beispiel #4
0
if (!xtreme_is_html5()) {
    ?>
<div class="post">
    <h2><?php 
    _e('Sorry, Page Not Found', XF_TEXTDOMAIN);
    ?>
</h2>
<?php 
} else {
    ?>
    <article class="post">
        <header><h2><?php 
    _e('Sorry, Page Not Found', XF_TEXTDOMAIN);
    ?>
</h2></header>
<?php 
}
?>
	<div class="entry-content">
		<p><?php 
_e('Apologies, but the page you requested could not be found.', XF_TEXTDOMAIN);
?>
</p>
	</div>
<?php 
if (!xtreme_is_html5()) {
    echo '</div>';
} else {
    echo '</article>';
}
get_footer();
    function widget($args, $instance)
    {
        global $wpdb;
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
        if ($instance['number_posts'] < 1) {
            $instance['number_posts'] = 1;
        }
        $columns = absint($instance['columns']);
        $rows = absint($instance['rows']);
        $thumbnail_size = esc_attr($instance['thumbnail_size']);
        if (!isset($instance['as_backgroundimage'])) {
            $instance['as_backgroundimage'] = 0;
        }
        if (!isset($instance['wrap_content'])) {
            $instance['wrap_content'] = 1;
        }
        $el = 'div';
        $html5 = xtreme_is_html5();
        if ($html5) {
            $el = 'article';
        }
        $contentorder = array('content' => isset($instance['content_pos']) ? (int) $instance['content_pos'] : 4, 'byline' => isset($instance['byline_pos']) ? (int) $instance['byline_pos'] : 3, 'subtitle' => isset($instance['subtitle_pos']) ? (int) $instance['subtitle_pos'] : 3, 'posttitle' => isset($instance['posttitle_pos']) ? (int) $instance['posttitle_pos'] : 2, 'thumbnail' => isset($instance['image_pos']) ? (int) $instance['image_pos'] : 1);
        $suppress_posttitle_link = isset($instance['suppress_posttitle_link']) ? (bool) ($instance['suppress_posttitle_link'] == 1) : false;
        $tag = isset($instance['posttitle_tag']) ? esc_attr($instance['posttitle_tag']) : 'h2';
        $subtag = isset($instance['subtitle_tag']) ? esc_attr($instance['subtitle_tag']) : 'h3';
        if (!isset($instance['content_pos'])) {
            $instance['show_posttitle'] = 1;
            $instance['show_content'] = 1;
            $instance['sticky'] = 0;
        }
        if (!isset($instance['show_subtitle'])) {
            $instance['show_subtitle'] = 0;
        }
        asort($contentorder, SORT_NUMERIC);
        foreach ($contentorder as $key => $value) {
            if ($instance['show_' . $key]) {
                $new_sort[] = $key;
            }
        }
        $query_args = array('showposts' => (int) $instance['number_posts'], 'offset' => (int) $instance['offset'], 'nopaging' => 0, 'post_type' => 'post', 'post_status' => 'publish', XF_STICKY_HANDLING => (bool) $instance['sticky'], 'orderby' => esc_attr($instance['orderby']));
        if ($query_args[XF_STICKY_HANDLING] === true) {
            $query_args['post__not_in'] = get_option('sticky_posts');
        }
        if (array_key_exists('hide_child_cat', $instance) && (bool) $instance['hide_child_cat']) {
            $query_args['category__in'] = $instance['category'];
        } else {
            $query_args['cat'] = $instance['category'];
        }
        $r = new WP_Query($query_args);
        if ($r->have_posts()) {
            $i = 0;
            $count = $r->post_count;
            echo $before_widget;
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            while ($r->have_posts()) {
                $r->the_post();
                $i++;
                echo $this->html_before($columns, $i, $instance['use_box_bottom']);
                ?>
				<<?php 
                echo $el;
                ?>
 <?php 
                post_class();
                ?>
>
				<?php 
                if (isset($new_sort)) {
                    $c = count($new_sort);
                    for ($y = 0; $y < $c; $y++) {
                        switch ($new_sort[$y]) {
                            case 'thumbnail':
                                if ($instance['as_backgroundimage'] == 0) {
                                    xtreme_post_thumbnail($thumbnail_size, esc_attr($instance['image_alignment']));
                                } else {
                                    xtreme_background_post_thumbnail($thumbnail_size, esc_attr($instance['image_alignment']), esc_html($instance['excerpt_morelink_text']));
                                }
                                break;
                            case 'subtitle':
                                xtreme_widget_post_subtitle($subtag);
                                break;
                            case 'posttitle':
                                if ($html5) {
                                    echo '<header>';
                                }
                                xtreme_widget_post_headline($tag, !$suppress_posttitle_link);
                                if ($html5 && $new_sort[$y + 1] !== 'byline') {
                                    echo '</header>';
                                }
                                break;
                            case 'byline':
                                if (!$html5) {
                                    xtreme_byline();
                                } else {
                                    xtreme_html5_byline();
                                    if ($new_sort[$y - 1] == 'posttitle') {
                                        echo '</header>';
                                    }
                                }
                                break;
                            case 'content':
                                if ($instance['wrap_content'] == 1) {
                                    echo '<div class="entry-content">';
                                }
                                switch ($instance['content_type']) {
                                    case 'xtreme_excerpt':
                                        if (!$instance['use_box_bottom']) {
                                            xtreme_excerpt($instance['excerpt_length'], esc_html($instance['excerpt_morelink_text']), esc_html($instance['excerpt_more']));
                                        } else {
                                            xtreme_excerpt($instance['excerpt_length'], '', esc_html($instance['excerpt_more']));
                                        }
                                        break;
                                    case 'excerpt':
                                        the_excerpt();
                                        if (!$instance['use_box_bottom']) {
                                            echo " <p><span class='read-more'><a href='" . get_permalink() . "' title='" . __('Read more about', XF_TEXTDOMAIN) . ' ' . esc_attr(get_the_title()) . "'>" . esc_html($instance['excerpt_morelink_text']) . "</a></span></p>";
                                        }
                                        break;
                                }
                                if ($instance['wrap_content'] == 1) {
                                    echo '</div>';
                                }
                                break;
                        }
                    }
                    echo '</' . $el . '>';
                    $link[] = array('url' => get_permalink(), 'title' => get_the_title());
                    echo $this->html_after($columns, $i, $instance['use_box_bottom'], $link, esc_html($instance['excerpt_morelink_text']));
                }
            }
            wp_reset_query();
            $rest = $i % $columns;
            if ($rest !== 0) {
                while ($rest < $columns) {
                    $rest++;
                    $i++;
                    $link[] = array('url' => '#blank', 'title' => '');
                    echo $this->html_before($columns, $rest, $instance['use_box_bottom']);
                    echo "&nbsp;";
                    echo $this->html_after($columns, $i, $instance['use_box_bottom'], $link, esc_html($instance['excerpt_morelink_text']));
                }
            }
            echo $after_widget;
        }
        unset($link);
    }
function xtreme_get_template_part($templatename = 'content')
{
    $templatename = apply_filters('xtreme_loop_templatename', $templatename);
    $docmode = '';
    $f = '';
    if (xtreme_is_html5()) {
        $docmode = 'html5-';
    }
    if (current_theme_supports('post-formats')) {
        $f = get_post_format();
    }
    get_template_part('/includes/posttemplates/' . $docmode . $templatename, $f);
}
    function widget($args, $instance)
    {
        global $wpdb;
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
        $columns = absint($instance['columns']);
        $thumbnail_size = esc_attr($instance['thumbnail_size']);
        if (!isset($instance['as_backgroundimage'])) {
            $instance['as_backgroundimage'] = 0;
        }
        if (!isset($instance['wrap_content'])) {
            $instance['wrap_content'] = 1;
        }
        $el = 'div';
        $html5 = xtreme_is_html5();
        if ($html5) {
            $el = 'article';
        }
        $contentorder = array('content' => isset($instance['content_pos']) ? (int) $instance['content_pos'] : 4, 'subtitle' => isset($instance['subtitle_pos']) ? (int) $instance['subtitle_pos'] : 3, 'posttitle' => isset($instance['posttitle_pos']) ? (int) $instance['posttitle_pos'] : 2, 'thumbnail' => isset($instance['image_pos']) ? (int) $instance['image_pos'] : 1);
        $suppress_posttitle_link = isset($instance['suppress_posttitle_link']) ? (bool) ($instance['suppress_posttitle_link'] == 1) : false;
        $suppress_subtitle_link = isset($instance['suppress_subtitle_link']) ? (bool) ($instance['suppress_subtitle_link'] == 1) : false;
        $tag = isset($instance['posttitle_tag']) ? esc_attr($instance['posttitle_tag']) : 'h2';
        $subtag = isset($instance['subtitle_tag']) ? esc_attr($instance['subtitle_tag']) : 'h3';
        $instance['show_content'] = 1;
        if (!isset($instance['show_headline'])) {
            $instance['show_posttitle'] = 1;
        }
        if (!isset($instance['show_subtitle'])) {
            $instance['show_subtitle'] = 0;
        }
        asort($contentorder, SORT_NUMERIC);
        foreach ($contentorder as $key => $value) {
            if ($instance['show_' . $key]) {
                $new_sort[] = $key;
            }
        }
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        for ($i = 0; $i < $columns; $i++) {
            $r = new WP_Query(array('page_id' => $instance['page_id-' . $i]));
            if ($r->have_posts()) {
                while ($r->have_posts()) {
                    $r->the_post();
                    echo $this->html_before($columns, $i + 1, $instance['use_box_bottom']);
                    ?>
					<<?php 
                    echo $el;
                    ?>
 <?php 
                    post_class();
                    ?>
>
					<?php 
                    if (isset($new_sort)) {
                        $c = count($new_sort);
                        for ($y = 0; $y < $c; $y++) {
                            switch ($new_sort[$y]) {
                                case 'thumbnail':
                                    if ($instance['as_backgroundimage'] == 0) {
                                        xtreme_post_thumbnail($thumbnail_size, esc_attr($instance['image_alignment']));
                                    } else {
                                        xtreme_background_post_thumbnail($thumbnail_size, esc_attr($instance['image_alignment']), esc_html($instance['excerpt_morelink_text']));
                                    }
                                    break;
                                case 'subtitle':
                                    xtreme_widget_post_subtitle($subtag, !$suppress_subtitle_link, true);
                                    break;
                                case 'posttitle':
                                    if ($html5) {
                                        echo '<header>';
                                    }
                                    $custom_posttitle = esc_html($instance['custom_posttitle-' . $i]);
                                    xtreme_widget_post_headline($tag, !$suppress_posttitle_link, true, $custom_posttitle);
                                    if ($html5) {
                                        echo '</header>';
                                    }
                                    break;
                                case 'content':
                                    if ($instance['wrap_content'] == 1) {
                                        echo '<div class="entry-content">';
                                    }
                                    switch ($instance['content_type-' . $i]) {
                                        case 'xtreme_excerpt':
                                            if (!$instance['use_box_bottom']) {
                                                xtreme_excerpt($instance['excerpt_length-' . $i], esc_html($instance['excerpt_morelink_text-' . $i]), esc_html($instance['excerpt_more-' . $i]));
                                            } else {
                                                xtreme_excerpt($instance['excerpt_length-' . $i], '', esc_html($instance['excerpt_more-' . $i]));
                                            }
                                            break;
                                        case 'content':
                                            the_content();
                                            break;
                                        case 'excerpt':
                                            if (!$instance['use_box_bottom']) {
                                                $new_excerpt = wptexturize(get_the_excerpt());
                                                echo "<p>{$new_excerpt} <span class='read-more'><a href='" . get_permalink() . "' title='" . __('Read more about', XF_TEXTDOMAIN) . ' ' . esc_attr(get_the_title()) . "'>" . esc_html($instance['excerpt_morelink_text-' . $i]) . "</a></span></p>";
                                            } else {
                                                the_excerpt();
                                            }
                                            break;
                                    }
                                    if ($instance['wrap_content'] == 1) {
                                        echo '</div>';
                                    }
                                    break;
                            }
                        }
                        echo '</' . $el . '>';
                        $link[] = array('url' => get_permalink(), 'title' => get_the_title(), 'read_more' => esc_html($instance['excerpt_morelink_text-' . $i]));
                    }
                }
                wp_reset_query();
                echo $this->html_after($columns, $i + 1, $instance['use_box_bottom'], $link);
            }
        }
        unset($link);
        echo $after_widget;
    }
    function widget($args, $instance)
    {
        global $wpdb;
        extract($args);
        $title = empty($instance['title']) ? '' : $instance['title'];
        $title = apply_filters('widget_title', $title);
        $columns = absint($instance['columns']);
        $thumbnail_size = esc_attr($instance['thumbnail_size']);
        $el = 'div';
        $html5 = xtreme_is_html5();
        if ($html5) {
            $el = 'article';
        }
        $contentorder = array('content' => isset($instance['content_pos']) ? (int) $instance['content_pos'] : 4, 'byline' => isset($instance['byline_pos']) ? (int) $instance['byline_pos'] : 3, 'posttitle' => isset($instance['posttitle_pos']) ? (int) $instance['posttitle_pos'] : 2, 'thumbnail' => isset($instance['image_pos']) ? (int) $instance['image_pos'] : 1);
        $suppress_posttitle_link = isset($instance['suppress_posttitle_link']) ? (bool) ($instance['suppress_posttitle_link'] == 1) : false;
        $tag = isset($instance['posttitle_tag']) ? esc_attr($instance['posttitle_tag']) : 'h2';
        if (!isset($instance['content_pos'])) {
            $instance['show_posttitle'] = 1;
            $instance['show_content'] = 1;
        }
        asort($contentorder, SORT_NUMERIC);
        foreach ($contentorder as $key => $value) {
            if ($instance['show_' . $key]) {
                $new_sort[] = $key;
            }
        }
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        echo '<div>';
        for ($i = 0; $i < $columns; $i++) {
            $key = 'category-' . $i;
            if (!array_key_exists($key, $instance)) {
                continue;
            }
            $query_args = array('cat' => $instance[$key], 'showposts' => 1, 'offset' => (int) $instance['offset'], 'nopaging' => 0, 'post_type' => 'post', 'post_status' => 'publish', 'orderby' => esc_attr($instance['orderby']));
            $r = new WP_Query($query_args);
            if (!$r->have_posts()) {
                continue;
            }
            while ($r->have_posts()) {
                $r->the_post();
                $cat = get_category($instance[$key]);
                if (is_wp_error($cat)) {
                    continue;
                }
                $cls = 'category-' . $cat->slug;
                ?>
				<<?php 
                echo $el;
                ?>
 class="<?php 
                echo join(' ', get_post_class('tab-content'));
                ?>
">
					<h5 class="<?php 
                echo $cls;
                ?>
" id="<?php 
                echo $cls;
                ?>
"><?php 
                echo esc_attr($cat->name);
                ?>
</h5>
					<?php 
                if (isset($new_sort)) {
                    $c = count($new_sort);
                    for ($y = 0; $y < $c; $y++) {
                        switch ($new_sort[$y]) {
                            case 'thumbnail':
                                xtreme_post_thumbnail($thumbnail_size, esc_attr($instance['image_alignment']));
                                break;
                            case 'posttitle':
                                if ($html5) {
                                    echo '<header>';
                                }
                                xtreme_widget_post_headline($tag, !$suppress_posttitle_link);
                                if ($html5 && ($y + 1 >= $c || $new_sort[$y + 1] !== 'byline')) {
                                    echo '</header>';
                                }
                                break;
                            case 'byline':
                                if (!$html5) {
                                    xtreme_byline();
                                } else {
                                    xtreme_html5_byline();
                                    if ($y - 1 >= 0 && $new_sort[$y - 1] == 'posttitle') {
                                        echo '</header>';
                                    }
                                }
                                break;
                            case 'content':
                                echo '<div class="entry-content">';
                                switch ($instance['content_type']) {
                                    case 'xtreme_excerpt':
                                        xtreme_excerpt($instance['excerpt_length'], esc_html($instance['excerpt_morelink_text']), esc_html($instance['excerpt_more']));
                                        break;
                                    case 'excerpt':
                                        $new_excerpt = wptexturize(get_the_excerpt());
                                        echo "<p>{$new_excerpt} <span class='read-more'><a href='" . get_permalink() . "' title='" . __('Read more about', XF_TEXTDOMAIN) . ' ' . esc_attr(get_the_title()) . "'>" . esc_html($instance['excerpt_morelink_text']) . "</a></span></p>";
                                        break;
                                    case 'content':
                                    default:
                                        the_content();
                                        break;
                                }
                                echo '</div>';
                                break;
                        }
                    }
                    echo '</' . $el . '>';
                }
            }
            wp_reset_query();
        }
        echo "</div>";
        echo $after_widget;
    }
Beispiel #9
0
<ul class="advertise">
	<li><a href="#" title="Advertise here"><img src="<?php 
echo get_stylesheet_directory_uri();
?>
/images/ads.png" alt="Advertise here!" /></a></li>
	<li><a href="#" title="Advertise here"><img src="<?php 
echo get_stylesheet_directory_uri();
?>
/images/ads.png" alt="Advertise here!" /></a></li>
	<li><a href="#" title="Advertise here"><img src="<?php 
echo get_stylesheet_directory_uri();
?>
/images/ads.png" alt="Advertise here!" /></a></li>
	<li><a href="#" title="Advertise here"><img src="<?php 
echo get_stylesheet_directory_uri();
?>
/images/ads.png" alt="Advertise here!" /></a></li>
	<li><a href="#" title="Advertise here"><img src="<?php 
echo get_stylesheet_directory_uri();
?>
/images/ads.png" alt="Advertise here!" /></a></li>
	<li><a href="#" title="Advertise here"><img src="<?php 
echo get_stylesheet_directory_uri();
?>
/images/ads.png" alt="Advertise here!" /></a></li>
</ul>
<?php 
if (!xtreme_is_html5() && $t === 'ul') {
    echo '</li>';
}
echo xtreme_sidebar_widget_end_tag();
function xtreme_gallery_shortcode($attr)
{
    global $xf_gallery_target_size;
    $post = get_post();
    static $instance = 0;
    $instance++;
    // look for the parameter ids -> load these images
    if (!empty($attr['ids'])) {
        // 'ids' is explicitly ordered, unless you specify otherwise, set default for orderby
        if (empty($attr['orderby']) && !isset($attr['xtorderby'])) {
            $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;
    }
    // check for wp 3.5 code
    if (isset($attr['xtorderby']) && !isset($attr['orderby'])) {
        $attr['orderby'] = $attr['xtorderby'];
    }
    if (isset($attr['xtorder'])) {
        $attr['order'] = $attr['xtorder'];
    }
    if (isset($attr['orderby'])) {
        $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
        if (!$attr['orderby']) {
            unset($attr['orderby']);
        }
    }
    $default_attr = array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'target' => 'auto', 'include' => '', 'exclude' => '', 'link' => 'file');
    $attr = shortcode_atts($default_attr, $attr);
    if (!isset($attr['link'])) {
        $attr['link'] = 'file';
    }
    $id = intval($attr['id']);
    if ('RAND' == $attr['order']) {
        $attr['orderby'] = 'none';
    }
    if (!empty($include)) {
        $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $attr['order'], 'orderby' => $attr['orderby']));
        $attachments = array();
        foreach ($_attachments as $key => $val) {
            $attachments[$val->ID] = $_attachments[$key];
        }
    } elseif (!empty($exclude)) {
        $attachments = get_children(array('post_parent' => $id, 'exclude' => $attr['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $attr['order'], 'orderby' => $attr['exclude']));
    } else {
        $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $attr['order'], 'orderby' => $attr['orderby']));
    }
    if (empty($attachments)) {
        return '';
    }
    if (is_feed()) {
        $output = "\n";
        foreach ($attachments as $att_id => $attachment) {
            $output .= wp_get_attachment_link($att_id, $attr['size'], TRUE) . "\n";
        }
        return $output;
    }
    $html5 = xtreme_is_html5();
    if ($html5) {
        $el = 'ul';
        $attr['itemtag'] = 'li';
        $attr['icontag'] = 'figure';
        $attr['captiontag'] = 'figcaption';
    } else {
        $el = 'div';
    }
    $attr['itemtag'] = tag_escape($attr['itemtag']);
    $attr['icontag'] = tag_escape($attr['icontag']);
    $attr['captiontag'] = tag_escape($attr['captiontag']);
    $valid_tags = wp_kses_allowed_html('post');
    if (!isset($valid_tags[$attr['itemtag']])) {
        $attr['itemtag'] = 'dl';
    }
    if (!isset($valid_tags[$attr['captiontag']])) {
        $attr['captiontag'] = 'dd';
    }
    if (!isset($valid_tags[$attr['icontag']])) {
        $attr['icontag'] = 'dt';
    }
    $columns = intval($attr['columns']);
    $selector = "gallery-{$instance}";
    $output = apply_filters('gallery_style', "<{$el} id='{$selector}' class='gallery galleryid-{$id}'>");
    $i = 0;
    foreach ($attachments as $id => $attachment) {
        $i++;
        if ($attr['link'] === 'file') {
            $image_output = xtreme_get_gallery_attachment_link($id, $attr['size'], $attr['target']);
        } else {
            if ($attr['link'] === 'none') {
                $image_output = wp_get_attachment_image($id, $attr['size'], false);
            } else {
                $image_output = wp_get_attachment_link($id, $attr['size'], true, false);
            }
        }
        $cls = '';
        if ($columns > 0 && $i % $columns == 0) {
            $cls = 'last';
        } elseif ($columns > 0 && $i % $columns == 1) {
            $cls = 'first';
        }
        $output .= "<{$attr['itemtag']} class='gallery-item col-{$columns} {$cls}'>";
        $output .= "<{$attr['icontag']} class='gallery-icon'>{$image_output}</{$attr['icontag']}>";
        if ($attr['captiontag'] && trim($attachment->post_excerpt)) {
            $output .= "<{$attr['captiontag']} class='gallery-caption'>";
            $output .= wptexturize($attachment->post_excerpt);
            $output .= "</{$attr['captiontag']}>";
        }
        if ($html5) {
            $output .= "</{$attr['icontag']}>";
        }
        $output .= "</{$attr['itemtag']}>";
    }
    $output .= "</{$el}>\n";
    return $output;
}
function xtreme_comment_default_fields()
{
    $aria_req = "";
    $commenter = wp_get_current_commenter();
    $options = get_option(XF_OPTIONS);
    $req = get_option('require_name_email');
    if (true === $options['xc_general']['aria_required']['value'] && $req) {
        $aria_req = " aria-required='true'";
    }
    $email = 'text';
    $url = 'text';
    if (xtreme_is_html5()) {
        $email = 'email';
        $url = 'url';
    }
    $a = '<div class="ym-fbox-text">';
    $a .= '<label for="author">' . __('Name', XF_TEXTDOMAIN) . ' ' . ($req ? '<sup>*</sup>' : '') . '</label>';
    $a .= '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30" tabindex="1"' . $aria_req . ' />';
    $a .= '</div>';
    $m = '<div class="ym-fbox-text">';
    $m .= '<label for="email">' . __('Email', XF_TEXTDOMAIN) . ' ' . ($req ? '<sup>*</sup>' : '') . '</label>';
    $m .= '<input id="email" name="email" type="' . $email . '" value="' . esc_attr($commenter['comment_author_email']) . '" size="30" tabindex="2"' . $aria_req . ' />';
    $m .= '</div>';
    $u = '<div class="ym-fbox-text">';
    $u .= '<label for="url">' . __('Website', XF_TEXTDOMAIN) . '</label>';
    $u .= '<input id="url" name="url" type="' . $url . '" value="' . esc_url($commenter['comment_author_url']) . '" size="30" tabindex="3" />';
    $u .= '</div>';
    $args = array('author' => $a, 'email' => $m, 'url' => $u);
    return $args;
}
function xtreme_navigation_searchform()
{
    $el = 'text';
    if (xtreme_is_html5()) {
        $el = 'search';
    }
    $options = get_option(XF_OPTIONS);
    $submitcls = false === $options['xc_navigation']['show_submit']['value'] ? "class='ym-hideme'" : "";
    $submittxt = $options['xc_navigation']['submit_text']['value'];
    $searchtxt = $options['xc_navigation']['input_text']['value'];
    $form = '<form ' . xtreme_aria_required('search', false) . ' method="get" id="searchform" action="' . home_url() . '/" >
    <div><label class="screen-reader-text" for="s">' . __('Search for:', XF_TEXTDOMAIN) . '</label>';
    $form .= "<input type='" . $el . "' value='" . esc_attr($searchtxt) . "' name='s' id='s' accesskey='s'/>\n";
    $form .= "<input type='submit' id='searchsubmit' value='" . esc_attr($submittxt) . "'  " . $submitcls . " />";
    $form .= "</div></form>";
    $html = '<ul class="nav_search"><li class="navsearch">' . $form . '</li></ul>';
    return $html;
}
    public function widget($args, $instance)
    {
        global $wpdb;
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
        if ($instance['number_posts'] < 1) {
            $instance['number_posts'] = 1;
        }
        /* @since 09/26/2013 */
        $post_type = isset($instance['post_type']) ? esc_attr($instance['post_type']) : 'post';
        $columns = absint($instance['columns']);
        $rows = absint($instance['rows']);
        $thumbnail_size = esc_attr($instance['thumbnail_size']);
        if (!isset($instance['as_backgroundimage'])) {
            $instance['as_backgroundimage'] = 0;
        }
        if (!isset($instance['wrap_content'])) {
            $instance['wrap_content'] = 1;
        }
        $el = 'div';
        $html5 = xtreme_is_html5();
        if ($html5) {
            $el = 'article';
        }
        /* since 1.01 */
        $contentorder = array('content' => isset($instance['content_pos']) ? (int) $instance['content_pos'] : 4, 'byline' => isset($instance['byline_pos']) ? (int) $instance['byline_pos'] : 3, 'subtitle' => isset($instance['subtitle_pos']) ? (int) $instance['subtitle_pos'] : 3, 'posttitle' => isset($instance['posttitle_pos']) ? (int) $instance['posttitle_pos'] : 2, 'thumbnail' => isset($instance['image_pos']) ? (int) $instance['image_pos'] : 1);
        $suppress_posttitle_link = isset($instance['suppress_posttitle_link']) ? (bool) ($instance['suppress_posttitle_link'] == 1) : false;
        $tag = isset($instance['posttitle_tag']) ? esc_attr($instance['posttitle_tag']) : 'h2';
        $subtag = isset($instance['subtitle_tag']) ? esc_attr($instance['subtitle_tag']) : 'h3';
        if (!isset($instance['content_pos'])) {
            $instance['show_posttitle'] = 1;
            $instance['show_content'] = 1;
            $instance['sticky'] = 0;
        }
        if (!isset($instance['show_subtitle'])) {
            $instance['show_subtitle'] = 0;
        }
        asort($contentorder, SORT_NUMERIC);
        foreach ($contentorder as $key => $value) {
            if ($instance['show_' . $key]) {
                $new_sort[] = $key;
            }
        }
        /* @since 09/26/2013 */
        $tax_names = get_object_taxonomies($post_type);
        if (!empty($tax_names) && in_array('category', $tax_names)) {
            $category = $instance['category'];
        } else {
            $category = '';
        }
        $query_args = array('cat' => $instance['category'], 'showposts' => (int) $instance['number_posts'], 'offset' => (int) $instance['offset'], 'nopaging' => 0, 'post_type' => $post_type, 'post_status' => 'publish', XF_STICKY_HANDLING => (bool) $instance['sticky'], 'orderby' => esc_attr($instance['orderby']), 'order' => esc_attr($instance['order']));
        /**
         * exclude the current post_id on is_singular()
         * @since 1.6.3
         * @link https://github.com/inpsyde/xtreme-one/issues/184
         */
        if (is_singular()) {
            $id = get_the_ID();
            if (!!$id) {
                $query_args['post__not_in'] = array($id);
            }
        }
        $r = new WP_Query($query_args);
        if ($r->have_posts()) {
            $i = 0;
            $count = $r->post_count;
            echo $before_widget;
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            while ($r->have_posts()) {
                $r->the_post();
                echo $this->html_before($columns, $i);
                $i++;
                ?>
				<<?php 
                echo $el;
                ?>
 <?php 
                post_class();
                ?>
>
				<?php 
                if (isset($new_sort)) {
                    $c = count($new_sort);
                    for ($y = 0; $y < $c; $y++) {
                        switch ($new_sort[$y]) {
                            case 'thumbnail':
                                if ($instance['as_backgroundimage'] == 0) {
                                    xtreme_post_thumbnail($thumbnail_size, esc_attr($instance['image_alignment']));
                                } else {
                                    xtreme_background_post_thumbnail($thumbnail_size, esc_attr($instance['image_alignment']), esc_html($instance['excerpt_morelink_text']));
                                }
                                break;
                            case 'subtitle':
                                xtreme_widget_post_subtitle($subtag);
                                break;
                            case 'posttitle':
                                if ($html5) {
                                    echo '<header>';
                                }
                                xtreme_widget_post_headline($tag, !$suppress_posttitle_link);
                                if ($html5 && $new_sort[$y + 1] !== 'byline') {
                                    echo '</header>';
                                }
                                break;
                            case 'byline':
                                if (!$html5) {
                                    xtreme_byline();
                                } else {
                                    xtreme_html5_byline();
                                    if ($y !== 0) {
                                        if ($new_sort[$y - 1] == 'posttitle') {
                                            echo '</header>';
                                        }
                                    }
                                }
                                break;
                            case 'content':
                                if ($instance['wrap_content'] == 1) {
                                    echo '<div class="entry-content">';
                                }
                                switch ($instance['content_type']) {
                                    case 'xtreme_excerpt':
                                        $excerpt_length = esc_attr($instance['excerpt_length']);
                                        $excerpt_more_text = esc_html($instance['excerpt_morelink_text']);
                                        $excerpt_more = esc_html($instance['excerpt_more']);
                                        $excerpt_show_tags = isset($instance['excerpt_show_tags']);
                                        xtreme_excerpt($excerpt_length, $excerpt_more_text, $excerpt_more, true, $excerpt_show_tags);
                                        break;
                                    case 'excerpt':
                                        the_excerpt();
                                        echo " <p><span class='read-more'><a href='" . get_permalink() . "' title='" . __('Read more about', XF_TEXTDOMAIN) . ' ' . esc_attr(get_the_title()) . "'>" . esc_html($instance['excerpt_morelink_text']) . "</a></span></p>";
                                        break;
                                    case 'content':
                                        the_content();
                                        break;
                                }
                                if ($instance['wrap_content'] == 1) {
                                    echo '</div>';
                                }
                                break;
                        }
                    }
                    echo '</' . $el . '>';
                    echo $this->html_after($columns, $i);
                }
            }
            wp_reset_query();
            if ($count < (int) $instance['number_posts']) {
                while ($count < (int) $instance['number_posts']) {
                    $count++;
                    echo $this->html_before($columns, $count);
                    echo "&nbsp;";
                    echo $this->html_after($columns, $count);
                }
            }
            echo $after_widget;
        }
    }
function xtreme_author_box()
{
    $str = "";
    $stra = "";
    $el = 'div';
    $photo = 'div';
    if (xtreme_is_html5()) {
        $el = 'section';
        $photo = 'figure';
    }
    if (get_the_author_meta('description')) {
        $str .= "<" . $el . " class='vcard' id='authorbox'>";
        $str .= "<" . $photo . " class='avatar photo'>";
        $str .= get_avatar(get_the_author_meta('user_email'), apply_filters('xtreme_authorbox_avatar_size', '60'));
        $str .= "</" . $photo . ">";
        $name = "<span class='nickname'>" . get_the_author() . "</span>";
        $str .= "<h3 class='fn n'>" . __('About', XF_TEXTDOMAIN) . " " . $name . "</h3>";
        $str .= "<p class='note'>" . get_the_author_meta('description') . "</p>";
        $stra .= "<p class='url fn'>";
        $stra .= "<a href='" . get_author_posts_url(get_the_author_meta('ID')) . "' title='" . sprintf(esc_attr__('View all posts by %s', XF_TEXTDOMAIN), get_the_author()) . "'>";
        $stra .= sprintf(esc_attr__('View all posts by %s', XF_TEXTDOMAIN), $name) . " <span class='sign'>&rarr;</span></a>";
        $stra .= "</p>";
        $stra .= "</" . $el . ">";
    }
    echo $str;
    do_action('xtreme_authorbox_inside_vcard');
    echo $stra;
}