function presscore_search_title_shortcode()
 {
     $title = '';
     $wrap_class = '';
     if (is_search()) {
         $title = get_search_query();
     } else {
         if (is_archive()) {
             if (is_category()) {
                 $title = single_cat_title('', false);
             } elseif (is_tag()) {
                 $title = single_tag_title('', false);
             } elseif (is_author()) {
                 the_post();
                 $title = '<a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta("ID"))) . '" title="' . esc_attr(get_the_author()) . '" rel="me">' . get_the_author() . '</a>';
                 $wrap_class .= ' vcard';
                 rewind_posts();
             } elseif (is_day()) {
                 $title = '<span>' . get_the_date() . '</span>';
             } elseif (is_month()) {
                 $title = '<span>' . get_the_date('F Y');
             } elseif (is_year()) {
                 $title = '<span>' . get_the_date('Y');
             } elseif (is_tax('dt_portfolio_category')) {
                 $title = single_term_title('', false);
             } elseif (is_tax('dt_gallery_category')) {
                 $title = single_term_title('', false);
             }
         }
     }
     if ($title) {
         $title = '<span' . ($wrap_class ? ' class="' . esc_attr($wrap_class) . '"' : '') . '>' . $title . '</span>';
     }
     return $title;
 }
Пример #2
0
function get_child_pages()
{
    global $post;
    rewind_posts();
    //stops any previous loops
    query_posts(array('post_type' => 'page', 'posts_per_page' => -1, 'post_status' => publish, 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order'));
    //query and order child pages
    while (have_posts()) {
        the_post();
        $childPermalink = get_permalink($post->ID);
        //post permalink
        $childID = $post->ID;
        //post it
        $childTitle = $post->post_title;
        //post title
        $childExcerpt = $post->post_excerpt;
        //post excerpt
        $childImage = get_the_post_thumbnail($page->ID, 'featured-spotlight');
        //post thumbnail
        echo '<div class="tile">';
        echo '<div class="tile-image">' . $childImage . '</div>';
        echo '<h1 id="cta-h1"><a href="' . $childPermalink . '">' . $childTitle . '</a></h1>';
        echo '<p class="caption"><a href="' . $childPermalink . '"><span>' . $childExcerpt . '</span></a></p>';
        echo '</div>';
    }
    wp_reset_query();
    // reset query
}
Пример #3
0
function get_child_pages()
{
    global $post;
    rewind_posts();
    // stop any previous loops
    query_posts(array('post_type' => 'page', 'posts_per_page' => -1, 'post_status' => publish, 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order'));
    // query and order child pages
    while (have_posts()) {
        the_post();
        $childPermalink = get_permalink($post->ID);
        // post permalink
        $childID = $post->ID;
        // post id
        $childTitle = $post->post_title;
        // post title
        $childExcerpt = $post->post_excerpt;
        // post excerpt
        echo '<article id="page-excerpt-' . $childID . '" class="page-excerpt">';
        echo '<h3><a href="' . $childPermalink . '">' . $childTitle . ' &raquo;</a></h3>';
        echo '<p>' . $childExcerpt . ' <a href="' . $childPermalink . '">Read More&nbsp;&raquo;</a></p>';
        echo '</article>';
    }
    // reset query
    wp_reset_query();
}
Пример #4
0
function get_child_pages()
{
    global $post;
    rewind_posts();
    // stop any previous loops
    query_posts(array('post_type' => 'page', 'posts_per_page' => -1, 'post_status' => publish, 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order'));
    // query and order child pages
    while (have_posts()) {
        the_post();
        $childPermalink = get_permalink($post->ID);
        // post permalink
        $childID = $post->ID;
        // post id
        $childTitle = $post->post_title;
        // post title
        $childExcerpt = $post->post_excerpt;
        // post excerpt
        echo '<article id="page-excerpt-' . $childID . '" class="box-left">';
        echo '<div class="section-box">';
        echo '<p id="button"><a href="' . $childPermalink . '">' . $childTitle . '</a></p>';
        echo '</div>';
        echo '<div class="section-boxes">';
        echo '<p id>' . $childExcerpt . ' <a href="' . $childPermalink . '">';
        ?>
 <i class="fa fa-arrow-circle-right"></i> <?php 
        '</a></p>';
        echo '</div>';
        echo '</article>';
    }
    // reset query
    wp_reset_query();
}
Пример #5
0
 /**
  * @param array $args
  * @param array $instance
  */
 function widget($args, $instance)
 {
     if (empty($instance['template'])) {
         return;
     }
     if (is_admin()) {
         return;
     }
     echo $args['before_widget'];
     $instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     if (!empty($instance['title'])) {
         echo $args['before_title'] . $instance['title'] . $args['after_title'];
     }
     if (strpos('/' . $instance['template'], '/content') !== false) {
         while (have_posts()) {
             the_post();
             locate_template($instance['template'], true, false);
         }
     } else {
         locate_template($instance['template'], true, false);
     }
     echo $args['after_widget'];
     // Reset everything
     rewind_posts();
     wp_reset_postdata();
 }
Пример #6
0
function header_function()
{
    global $vertical;
    if (!is_single() && is_home() && !is_archive()) {
        query_posts("what_to_show=posts&posts_per_page=1");
    }
    if (!is_archive() && !is_search()) {
        ?>
		<style type="text/css" media="screen">
		<?php 
        while (have_posts()) {
            the_post();
            // ececute the specific stylesheet
            print_stylesheet();
            // determine if an image is vertical or not
            if (is_vertical(the_image_url(true))) {
                $vertical = true;
            }
        }
        rewind_posts();
        ?>
		</style>
	<?php 
    }
}
Пример #7
0
function blog_summary_shortcode($attr)
{
    // Describes what attributes to parse from shortcode; only 'count'
    extract(shortcode_atts(array('count' => '5', 'grouptag' => 'ul', 'entrytag' => 'li', 'titletag' => 'h4', 'datetag' => 'span', 'commentstag' => 'span', 'summarytag' => 'div'), $attr));
    // Queries to populate our loop based on shortcode count attribute
    $r = new WP_Query("showposts={$count}&what_to_show=posts&nopaging=0&post_status=publish");
    // Only run if we have posts; can't run this through searches
    if ($r->have_posts() && !is_search()) {
        // If we're using a Sandbox-friendly theme . . .
        if (function_exists('sandbox_body_class')) {
            // We can't have double hfeed classes, otherwise it won't parse
            $groupclasses = 'xoxo';
        } else {
            // Otherwise, use hfeed to ensure hAtom compliance
            $groupclasses = 'xoxo hfeed';
        }
        // Begin the output for shortcode and inserts in the group tag what classes we have
        $output = '<' . $grouptag . ' class="' . $groupclasses . '">';
        // Begins our loop for returning posts
        while ($r->have_posts()) {
            // Sets which post from our loop we're at
            $r->the_post();
            // Allows the_date() with multiple posts within a single day
            unset($previousday);
            // If we're using a Sandbox-friendly theme . . .
            if (function_exists('sandbox_post_class')) {
                // Let's use semantic classes with each entry element
                $entryclasses = sandbox_post_class(false);
            } else {
                // Otherwise, use hentry to ensure hAtom compliance
                $entryclasses = 'hentry';
            }
            // Begin entry wrapper and inserts what classes we got from above
            $output .= "\n" . '<' . $entrytag . ' class="' . $entryclasses . '">';
            // Post title
            $output .= "\n" . '<' . $titletag . ' class="entry-title"><a href="' . get_permalink() . '" title="' . sprintf(__('Permalink to %s', 'blog_summary'), the_title_attribute('echo=0')) . '" rel="bookmark">' . get_the_title() . '</a></' . $titletag . '>';
            // Post date with hAtom support
            $output .= "\n" . '<' . $datetag . ' class="entry-date"><abbr class="published" title="' . get_the_time('Y-m-d\\TH:i:sO') . '">' . sprintf(__('%s', 'blog_summary'), the_date('', '', '', false)) . '</abbr></' . $datetag . '>';
            // Comments number
            $output .= "\n" . '<' . $commentstag . ' class="entry-comments"><a href="' . get_permalink() . '#comments" title="' . sprintf(__('Comments to %s', 'blog_summary'), the_title_attribute('echo=0')) . '">' . sprintf(__('Comments (%s)', 'blog_summary'), apply_filters('comments_number', get_comments_number())) . '</a></' . $commentstag . '>';
            // Post excerpt with hAtom support
            $output .= "\n" . '<' . $summarytag . ' class="entry-summary">' . "\n" . apply_filters('the_excerpt', get_the_excerpt()) . '</' . $summarytag . '>';
            // Close each post LI
            $output .= "\n" . '</' . $entrytag . '>';
            // Finish the have_posts() query
        }
        // while ( $r->have_posts() ) :
        // Close the parent UL
        $output .= "\n" . '</' . $grouptag . '>';
        // Rewinds loop from $r->the_post();
        rewind_posts();
        // End the initial IF statement
    }
    // if ( $r->have_posts() ) :
    // Clears our query to put the loop back where it was
    wp_reset_query();
    // $r = new WP_Query()
    // Returns $output to the shortcode
    return $output;
}
Пример #8
0
 function scripts()
 {
     global $wp_query;
     rewind_posts();
     if (have_posts()) {
         $languages = array();
         $theme = 'tomorrow-night';
         while (have_posts()) {
             the_post();
             $data = get_field('code_blocks');
             if (!empty($data)) {
                 foreach ($data as $chunk) {
                     if ($chunk['language'] != 'none') {
                         $languages[] = $chunk['language'];
                     }
                 }
             }
         }
         if (count($languages) > 0) {
             $theme_url = plugins_url('css/rainbow/' . $theme . '.css', CODEBLOCKS);
             $theme_url = apply_filters('codeblocks/rainbow_theme', $theme_url);
             if (!is_null($theme_url)) {
                 if (is_string($theme_url)) {
                     wp_enqueue_style('rainbow-' . $theme, $theme_url);
                 }
                 wp_enqueue_script('rainbow', plugins_url('js/rainbow.js', CODEBLOCKS));
             }
         }
         wp_reset_query();
     }
 }
 function rewind()
 {
     if ($this->WP_Query) {
         $this->WP_Query->rewind_posts();
     } else {
         rewind_posts();
     }
     $this->position = 0;
 }
Пример #10
0
function wildcat_show404($template)
{
    global $wp_query;
    $wp_query = null;
    $wp_query = new WP_Query();
    $wp_query->query('pagename=error');
    $wp_query->the_post();
    $template404 = get_page_template();
    rewind_posts();
    return $template404;
}
function rt_insert_custom_css()
{
    if (is_page() || is_single()) {
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                echo '<style type="text/css" media="screen">' . get_post_meta(get_the_ID(), 'rt_custom_css', true) . '</style>';
            }
        }
        rewind_posts();
    }
}
Пример #12
0
function thinkup_title_select()
{
    global $post;
    if (is_page()) {
        printf(__('%s', 'sento'), get_the_title());
    } elseif (is_attachment()) {
        printf(__('Blog Post Image: ', 'sento') . '%s', esc_attr(get_the_title($post->post_parent)));
    } else {
        if (is_single()) {
            printf(__('%s', 'sento'), get_the_title());
        } else {
            if (is_search()) {
                printf(__('Search Results: ', 'sento') . '%s', get_search_query());
            } else {
                if (is_404()) {
                    printf(__('Page Not Found', 'sento'));
                } else {
                    if (is_category()) {
                        printf(__('Category Archives: ', 'sento') . '%s', single_cat_title('', false));
                    } elseif (is_tag()) {
                        printf(__('Tag Archives: ', 'sento') . '%s', single_tag_title('', false));
                    } elseif (is_author()) {
                        the_post();
                        printf(__('Author Archives: ', 'sento') . '%s', get_the_author());
                        rewind_posts();
                    } elseif (is_day()) {
                        printf(__('Daily Archives: ', 'sento') . '%s', get_the_date());
                    } elseif (is_month()) {
                        printf(__('Monthly Archives: ', 'sento') . '%s', get_the_date('F Y'));
                    } elseif (is_year()) {
                        printf(__('Yearly Archives: ', 'sento') . '%s', get_the_date('Y'));
                    } elseif (is_post_type_archive('portfolio')) {
                        printf(__('Portfolio', 'sento'));
                    } elseif (is_post_type_archive('client')) {
                        printf(__('Our Clients', 'sento'));
                    } elseif (is_post_type_archive('team')) {
                        printf(__('Our Team', 'sento'));
                    } elseif (is_post_type_archive('testimonial')) {
                        printf(__('Customer Testimonials', 'sento'));
                    } elseif (is_post_type_archive('product') and function_exists('thinkup_woo_titleshop_archive')) {
                        printf(thinkup_woo_titleshop_archive());
                    } elseif (thinkup_check_isblog()) {
                        printf(__('Blog', 'sento'));
                    } elseif (is_tax()) {
                        echo get_queried_object()->name;
                    } else {
                        printf(__('%s', 'sento'), get_the_title());
                    }
                }
            }
        }
    }
}
Пример #13
0
function wptouch_fdn_is_custom_latest_posts_page()
{
    global $post;
    $settings = foundation_get_settings();
    if ($settings->latest_posts_page == 'none') {
        return false;
    } else {
        rewind_posts();
        wptouch_the_post();
        rewind_posts();
        return apply_filters('foundation_is_custom_latest_posts_page', $settings->latest_posts_page == $post->ID);
    }
}
Пример #14
0
 public function add_og_elements()
 {
     $this->_metas['og:site_name'] = strip_tags(get_bloginfo('name'));
     $this->_metas['og:locale'] = strtolower(str_replace('-', '_', get_bloginfo('language')));
     $this->_metas['og:type'] = $this->_get_type();
     /*$img = $this->_add_image();
     		if($img)
     			$this->_metas['og:image'] = $img;*/
     if (is_home()) {
         $this->_metas['og:title'] = NY_OG_Main_Admin::option('blog_title');
         $posts_page_id = get_option('page_for_posts');
         if ($posts_page_id) {
             $this->_metas['og:url'] = get_permalink($posts_page_id);
         } else {
             $this->_metas['og:url'] = site_url();
         }
         $this->_metas['og:description'] = NY_OG_Main_Admin::option('blog_description');
         $this->_add_image();
     } else {
         if (is_front_page()) {
             $this->_metas['og:title'] = NY_OG_Main_Admin::option('home_title');
             $this->_metas['og:url'] = site_url();
             $this->_metas['og:description'] = stripslashes(NY_OG_Main_Admin::option('home_description'));
             $this->_add_image();
         } else {
             if (is_singular()) {
                 the_post();
                 $this->_metas['og:title'] = $this->_get_title();
                 $this->_metas['og:url'] = get_permalink();
                 $this->_metas['og:description'] = $this->_get_description();
                 $this->_add_image();
                 rewind_posts();
             } else {
                 if (is_tax() or is_category() or is_tag()) {
                     $this->_metas['og:title'] = $this->get_tax_data('title');
                     $this->_metas['og:url'] = $this->get_tax_data('link');
                     $description = $this->get_tax_data('description');
                     if ($description) {
                         $this->_metas['og:description'] = $description;
                     }
                     $image = NY_OG_Main_Admin::option('image');
                     if ($image) {
                         $this->_metas['og:image'] = $image;
                     }
                 }
             }
         }
     }
     $this->_output();
 }
Пример #15
0
 /**
  * Constructs PostIterator
  */
 public function __construct()
 {
     $this->valid = function () {
         return have_posts();
     };
     $this->current = function () {
         global $post;
         the_post();
         return $post;
     };
     $this->rewind = function () {
         rewind_posts();
     };
 }
Пример #16
0
function veryplaintxt_body_class($print = true)
{
    global $wp_query, $current_user;
    $c = array('wordpress');
    veryplaintxt_date_classes(time(), $c);
    is_home() ? $c[] = 'home' : null;
    is_archive() ? $c[] = 'archive' : null;
    is_date() ? $c[] = 'date' : null;
    is_search() ? $c[] = 'search' : null;
    is_paged() ? $c[] = 'paged' : null;
    is_attachment() ? $c[] = 'attachment' : null;
    is_404() ? $c[] = 'four04' : null;
    if (is_single()) {
        the_post();
        $c[] = 'single';
        if (isset($wp_query->post->post_date)) {
            veryplaintxt_date_classes(mysql2date('U', $wp_query->post->post_date), $c, 's-');
        }
        foreach ((array) get_the_category() as $cat) {
            $c[] = 's-category-' . $cat->category_nicename;
        }
        $c[] = 's-author-' . get_the_author_login();
        rewind_posts();
    } else {
        if (is_author()) {
            $author = $wp_query->get_queried_object();
            $c[] = 'author';
            $c[] = 'author-' . $author->user_nicename;
        } else {
            if (is_category()) {
                $cat = $wp_query->get_queried_object();
                $c[] = 'category';
                $c[] = 'category-' . $cat->category_nicename;
            } else {
                if (is_page()) {
                    the_post();
                    $c[] = 'page';
                    $c[] = 'page-author-' . get_the_author_login();
                    rewind_posts();
                }
            }
        }
    }
    if ($current_user->ID) {
        $c[] = 'loggedin';
    }
    $c = join(' ', apply_filters('body_class', $c));
    return $print ? print $c : $c;
}
Пример #17
0
 public static function blog($page_id = null)
 {
     if (!$page_id) {
         return self::archive('post');
     }
     wb_set('current_url', get_permalink($page_id));
     query_posts(array('page_id' => $page_id));
     the_post();
     $template = get_archive_template();
     rewind_posts();
     wb_link_hack(true);
     include $template;
     wb_link_hack(false);
     wp_reset_query();
 }
Пример #18
0
 function show404($template)
 {
     global $wp_query;
     $template404 = $template;
     $pageid = $this->settings['404page_page_id'];
     if ($pageid > 0) {
         $wp_query = null;
         $wp_query = new WP_Query();
         $wp_query->query('page_id=' . $pageid);
         $wp_query->the_post();
         $template404 = get_page_template();
         rewind_posts();
     }
     return $template404;
 }
function tutsplus_display_banner()
{
    $args = array('post_type' => 'contentarea', 'location' => 'banner');
    $query = new WP_Query($args);
    if ($query->have_posts()) {
        echo '<aside class="banner">';
        while ($query->have_posts()) {
            $query->the_post();
            echo '<article class="contentarea">';
            the_content();
            echo '</article>';
        }
        echo '</aside>';
        rewind_posts();
    }
}
Пример #20
0
 /**
  * Erzeugt die elevanten Meta-Elemente für die Seite / den Artikel
  */
 public function add_elements()
 {
     if (is_singular()) {
         the_post();
         $this->_metas['og:title'] = $this->_get_title();
         $this->_metas['og:type'] = is_single() ? 'article' : 'website';
         $this->_metas['og:url'] = get_permalink();
         $this->_metas['og:description'] = $this->_get_description();
         $this->_metas['og:site_name'] = strip_tags(get_bloginfo('name'));
         $this->_metas['og:locale'] = strtolower(str_replace('-', '_', get_bloginfo('language')));
         $this->_add_image();
         $this->_add_post_tags();
         $this->_output();
         rewind_posts();
     }
 }
Пример #21
0
/**
 * Show author box (if on an author page)
 *
 * @package Infinity
 * @subpackage base
 */
function infinity_base_author_box()
{
    if (is_author()) {
        // queue the first post, that way we know who the author is when we
        // try to get their name, URL, description, avatar, etc.
        if (have_posts()) {
            the_post();
            // if a user has filled out their description, show a bio on their entries.
            if (get_the_author_meta('description')) {
                infinity_get_template_part('templates/parts/author-box');
            }
            // reset the loop so we don't break later queries
            rewind_posts();
        }
    }
}
function tutsplus_display_sidebars()
{
    $args = array('post_type' => 'contentarea', 'location' => 'sidebar');
    $query = new WP_Query($args);
    if ($query->have_posts()) {
        echo '<aside class="sidebar widget-area">';
        while ($query->have_posts()) {
            $query->the_post();
            echo '<article class="widget contentarea">';
            echo '<h3 class="widget-title">' . get_the_title() . '</h3>';
            the_content();
            echo '</article>';
        }
        echo '</aside>';
        rewind_posts();
    }
}
Пример #23
0
function likebtn_add_og_elements()
{
    if (_likebtn_og_enabled()) {
        remove_action('wp_head', 'jetpack_og_tags');
    } else {
        return;
    }
    $metas = array();
    $metas['og:site_name'] = strip_tags(get_bloginfo('name'));
    $metas['og:locale'] = strtolower(str_replace('-', '_', get_bloginfo('language')));
    $metas['og:type'] = _likebtn_og_get_type();
    the_post();
    $metas['og:title'] = _likebtn_og_get_title();
    $metas['og:url'] = get_permalink();
    $metas['og:description'] = _likebtn_og_get_description();
    $metas['og:image'] = _likebtn_og_add_image();
    rewind_posts();
    _likebtn_og_output($metas);
}
Пример #24
0
function the_breadcrumb()
{
    $sep = '   &rsaquo;  ';
    if (!is_front_page()) {
        echo '<div class="breadcrumbs wrapper">';
        echo '<a href="';
        echo get_option('home');
        echo '">';
        bloginfo('name');
        echo '</a>' . $sep;
        if (is_category() || is_single()) {
            the_category(', ');
        } elseif (is_archive() || is_single()) {
            if (is_day()) {
                printf(__('%s', 'text_domain'), get_the_date());
            } elseif (is_month()) {
                printf(__('%s', 'text_domain'), get_the_date(_x('F Y', 'monthly archives date format', 'text_domain')));
            } elseif (is_year()) {
                printf(__('%s', 'text_domain'), get_the_date(_x('Y', 'yearly archives date format', 'text_domain')));
            } else {
                _e('Blog Archives', 'text_domain');
            }
        }
        if (is_single()) {
            echo $sep;
            the_title();
        }
        if (is_page()) {
            echo the_title();
        }
        if (is_home()) {
            global $post;
            $page_for_posts_id = get_option('page_for_posts');
            if ($page_for_posts_id) {
                $post = get_page($page_for_posts_id);
                setup_postdata($post);
                the_title();
                rewind_posts();
            }
        }
        echo '</div>';
    }
}
/**
 * get_the_ddlayout
 *
 * Gets the layout
 *
 */
function get_the_ddlayout($layout = '', $args = array())
{
    global $wpddlayout;
    $queried_object = $wpddlayout->get_queried_object();
    $post = $wpddlayout->get_query_post_if_any($queried_object);
    if (null !== $post && $post->post_type === 'page') {
        $template = basename(get_page_template());
        $wpddlayout->save_option(array('templates' => array($template => $layout)));
    }
    if (!isset($args['initialize_loop']) || $args['initialize_loop'] != false) {
        // setup the loop
        if (is_single() || is_page()) {
            have_posts();
            the_post();
            rewind_posts();
        }
    }
    $content = $wpddlayout->get_layout_content_for_render($layout, $args);
    return $content;
}
Пример #26
0
 function presscore_get_page_title()
 {
     $title = '';
     if (is_page() || is_single()) {
         $title = get_the_title();
     } else {
         if (is_search()) {
             $title = sprintf(_x('Search Results for: %s', 'archive template title', 'the7mk2'), '<span>' . get_search_query() . '</span>');
         } else {
             if (is_archive()) {
                 if (is_category()) {
                     $title = sprintf(_x('Category Archives: %s', 'archive template title', 'the7mk2'), '<span>' . single_cat_title('', false) . '</span>');
                 } elseif (is_tag()) {
                     $title = sprintf(_x('Tag Archives: %s', 'archive template title', 'the7mk2'), '<span>' . single_tag_title('', false) . '</span>');
                 } elseif (is_author()) {
                     the_post();
                     $title = sprintf(_x('Author Archives: %s', 'archive template title', 'the7mk2'), '<span class="vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta("ID"))) . '" title="' . esc_attr(get_the_author()) . '" rel="me">' . get_the_author() . '</a></span>');
                     rewind_posts();
                 } elseif (is_day()) {
                     $title = sprintf(_x('Daily Archives: %s', 'archive template title', 'the7mk2'), '<span>' . get_the_date() . '</span>');
                 } elseif (is_month()) {
                     $title = sprintf(_x('Monthly Archives: %s', 'archive template title', 'the7mk2'), '<span>' . get_the_date('F Y') . '</span>');
                 } elseif (is_year()) {
                     $title = sprintf(_x('Yearly Archives: %s', 'archive template title', 'the7mk2'), '<span>' . get_the_date('Y') . '</span>');
                 } elseif (is_tax('dt_portfolio_category')) {
                     $title = sprintf(_x('Portfolio Archives: %s', 'archive template title', 'the7mk2'), '<span>' . single_term_title('', false) . '</span>');
                 } elseif (is_tax('dt_gallery_category')) {
                     $title = sprintf(_x('Albums Archives: %s', 'archive template title', 'the7mk2'), '<span>' . single_term_title('', false) . '</span>');
                 } else {
                     $title = _x('Archives:', 'archive template title', 'the7mk2');
                 }
             } elseif (is_404()) {
                 $title = _x('Page not found', 'index title', 'the7mk2');
             } else {
                 $title = _x('Blog', 'index title', 'the7mk2');
             }
         }
     }
     return apply_filters('presscore_get_page_title', $title);
 }
function ejls_get_article()
{
    if (is_page() || is_single()) {
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                $contentArr['@type'] = 'Article';
                $contentArr['headline'] = get_the_title();
                $time = strtotime(get_the_time('c'));
                $contentArr['datePublished'] = date('c', $time);
                $contentArr['image'] = ejls_post_thumbnail();
                $contentArr['url'] = get_permalink();
                $contentArr['articleBody'] = strip_tags(get_the_content());
                $contentArr['author']['@type'] = 'Person';
                $contentArr['author']['name'] = get_the_author();
                $contentArr['publisher']['@type'] = 'Organization';
                $contentArr['publisher']['name'] = get_bloginfo('name');
            }
        }
        rewind_posts();
        return $contentArr;
    }
}
Пример #28
0
 function ff_get_all_portfolio_tags($numberOfPosts = 0)
 {
     $portfolioTagsArray = array();
     $postCounter = 0;
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             $postCounter++;
             if ($numberOfPosts > 0 && $postCounter > $numberOfPosts) {
                 break;
             }
             global $post;
             $t = wp_get_post_terms($post->ID, 'ff-portfolio-tag');
             if (!empty($t)) {
                 foreach ($t as $onePortfolioTag) {
                     $portfolioTagsArray[$onePortfolioTag->slug] = $onePortfolioTag;
                 }
             }
         }
     }
     rewind_posts();
     // Escaped HTML with tags
     return $portfolioTagsArray;
 }
Пример #29
0
						<?php 
    if (is_category()) {
        printf(__('Category Archives: %s', 'outlines'), '<span>' . single_cat_title('', false) . '</span>');
    } elseif (is_tag()) {
        printf(__('Tag Archives: %s', 'outlines'), '<span>' . single_tag_title('', false) . '</span>');
    } elseif (is_author()) {
        /* Queue the first post, that way we know
         * what author we're dealing with (if that is the case).
         */
        the_post();
        printf(__('Author Archives: %s', 'outlines'), '<span class="vcard"><a class="url fn n" href="' . get_author_posts_url(get_the_author_meta("ID")) . '" title="' . esc_attr(get_the_author()) . '" rel="me">' . get_the_author() . '</a></span>');
        /* Since we called the_post() above, we need to
         * rewind the loop back to the beginning that way
         * we can run the loop properly, in full.
         */
        rewind_posts();
    } elseif (is_day()) {
        printf(__('Daily Archives: %s', 'outlines'), '<span>' . get_the_date() . '</span>');
    } elseif (is_month()) {
        printf(__('Monthly Archives: %s', 'outlines'), '<span>' . get_the_date('F Y') . '</span>');
    } elseif (is_year()) {
        printf(__('Yearly Archives: %s', 'outlines'), '<span>' . get_the_date('Y') . '</span>');
    } else {
        _e('Archives', 'outlines');
    }
    ?>
					</h1>
					<?php 
    if (is_category()) {
        // show an optional category description
        $category_description = category_description();
Пример #30
0
function sandbox_body_class($print = true)
{
    global $wp_query, $current_user;
    // It's surely a WordPress blog, right?
    $c = array('wordpress');
    // Applies the time- and date-based classes (below) to BODY element
    sandbox_date_classes(time(), $c);
    // Generic semantic classes for what type of content is displayed
    is_front_page() ? $c[] = 'home' : null;
    // For the front page, if set
    is_home() ? $c[] = 'blog' : null;
    // For the blog posts page, if set
    is_archive() ? $c[] = 'archive' : null;
    is_date() ? $c[] = 'date' : null;
    is_search() ? $c[] = 'search' : null;
    is_paged() ? $c[] = 'paged' : null;
    is_attachment() ? $c[] = 'attachment' : null;
    is_404() ? $c[] = 'four04' : null;
    // CSS does not allow a digit as first character
    // Special classes for BODY element when a single post
    if (is_single()) {
        $postID = $wp_query->post->ID;
        the_post();
        // Adds 'single' class and class with the post ID
        $c[] = 'single postid-' . $postID;
        // Adds classes for the month, day, and hour when the post was published
        if (isset($wp_query->post->post_date)) {
            sandbox_date_classes(mysql2date('U', $wp_query->post->post_date), $c, 's-');
        }
        // Adds category classes for each category on single posts
        if ($cats = get_the_category()) {
            foreach ($cats as $cat) {
                $c[] = 's-category-' . $cat->slug;
            }
        }
        // Adds tag classes for each tags on single posts
        if ($tags = get_the_tags()) {
            foreach ($tags as $tag) {
                $c[] = 's-tag-' . $tag->slug;
            }
        }
        // Adds MIME-specific classes for attachments
        if (is_attachment()) {
            $mime_type = get_post_mime_type();
            $mime_prefix = array('application/', 'image/', 'text/', 'audio/', 'video/', 'music/');
            $c[] = 'attachmentid-' . $postID . ' attachment-' . str_replace($mime_prefix, "", "{$mime_type}");
        }
        // Adds author class for the post author
        $c[] = 's-author-' . sanitize_title_with_dashes(strtolower(get_the_author_login()));
        rewind_posts();
    } elseif (is_author()) {
        $author = $wp_query->get_queried_object();
        $c[] = 'author';
        $c[] = 'author-' . $author->user_nicename;
    } elseif (is_category()) {
        $cat = $wp_query->get_queried_object();
        $c[] = 'category';
        $c[] = 'category-' . $cat->slug;
    } elseif (is_tag()) {
        $tags = $wp_query->get_queried_object();
        $c[] = 'tag';
        $c[] = 'tag-' . $tags->slug;
    } elseif (is_page()) {
        $pageID = $wp_query->post->ID;
        $page_children = wp_list_pages("child_of={$pageID}&echo=0");
        the_post();
        $c[] = 'page pageid-' . $pageID;
        $c[] = 'page-author-' . sanitize_title_with_dashes(strtolower(get_the_author('login')));
        // Checks to see if the page has children and/or is a child page; props to Adam
        if ($page_children) {
            $c[] = 'page-parent';
        }
        if ($wp_query->post->post_parent) {
            $c[] = 'page-child parent-pageid-' . $wp_query->post->post_parent;
        }
        if (is_page_template()) {
            // Hat tip to Ian, themeshaper.com
            $c[] = 'page-template page-template-' . str_replace('.php', '-php', get_post_meta($pageID, '_wp_page_template', true));
        }
        rewind_posts();
    } elseif (is_search()) {
        the_post();
        if (have_posts()) {
            $c[] = 'search-results';
        } else {
            $c[] = 'search-no-results';
        }
        rewind_posts();
    }
    // For when a visitor is logged in while browsing
    if ($current_user->ID) {
        $c[] = 'loggedin';
    }
    // Paged classes; for 'page X' classes of index, single, etc.
    if ((($page = $wp_query->get('paged')) || ($page = $wp_query->get('page'))) && $page > 1) {
        // Thanks to Prentiss Riddle, twitter.com/pzriddle, for the security fix below.
        $page = intval($page);
        // Ensures that an integer (not some dangerous script) is passed for the variable
        $c[] = 'paged-' . $page;
        if (is_single()) {
            $c[] = 'single-paged-' . $page;
        } elseif (is_page()) {
            $c[] = 'page-paged-' . $page;
        } elseif (is_category()) {
            $c[] = 'category-paged-' . $page;
        } elseif (is_tag()) {
            $c[] = 'tag-paged-' . $page;
        } elseif (is_date()) {
            $c[] = 'date-paged-' . $page;
        } elseif (is_author()) {
            $c[] = 'author-paged-' . $page;
        } elseif (is_search()) {
            $c[] = 'search-paged-' . $page;
        }
    }
    // Separates classes with a single space, collates classes for BODY
    $c = join(' ', apply_filters('body_class', $c));
    // Available filter: body_class
    // And tada!
    return $print ? print $c : $c;
}