/**
 * Loads a post content template based off the post type and/or the post format.  This functionality is 
 * not feasible with the WordPress get_template_part() function, so we have to rely on some custom logic 
 * and locate_template().
 *
 * Note that using this function assumes that you're creating a content template to handle attachments. 
 * This filter must be removed since we're bypassing the WP template hierarchy and focusing on templates 
 * specific to the content.
 *
 * @since  1.6.0
 * @access public
 * @return string
 */
function hybrid_get_content_template()
{
    /* Set up an empty array and get the post type. */
    $templates = array();
    $post_type = get_post_type();
    /* Assume the theme developer is creating an attachment template. */
    if ('attachment' === $post_type) {
        remove_filter('the_content', 'prepend_attachment');
        $mime_type = get_post_mime_type();
        list($type, $subtype) = false !== strpos($mime_type, '/') ? explode('/', $mime_type) : array($mime_type, '');
        $templates[] = "content-attachment-{$type}.php";
        $templates[] = "content/attachment-{$type}.php";
    }
    /* If the post type supports 'post-formats', get the template based on the format. */
    if (post_type_supports($post_type, 'post-formats')) {
        /* Get the post format. */
        $post_format = get_post_format() ? get_post_format() : 'standard';
        /* Template based off post type and post format. */
        $templates[] = "content-{$post_type}-{$post_format}.php";
        $templates[] = "content/{$post_type}-{$post_format}.php";
        /* Template based off the post format. */
        $templates[] = "content-{$post_format}.php";
        $templates[] = "content/{$post_format}.php";
    }
    /* Template based off the post type. */
    $templates[] = "content-{$post_type}.php";
    $templates[] = "content/{$post_type}.php";
    /* Fallback 'content.php' template. */
    $templates[] = 'content.php';
    $templates[] = 'content/content.php';
    /* Allow devs to filter the content template hierarchy. */
    $templates = apply_filters('hybrid_content_template_hierarchy', $templates);
    /* Apply filters and return the found content template. */
    include apply_filters('hybrid_content_template', locate_template($templates, false, false));
}
Example #2
0
function thinkup_input_blogformat()
{
    if (get_post_format() == 'gallery') {
        echo '<div class="blog-icon gallery"><a href="' . get_permalink() . '"><i class="icon-picture icon-large"></i></a></div>';
    } else {
        if (get_post_format() == 'image') {
            echo '<div class="blog-icon image"><a href="' . get_permalink() . '"><i class="icon-picture icon-large"></i></a></div>';
        } else {
            if (get_post_format() == 'video') {
                echo '<div class="blog-icon video"><a href="' . get_permalink() . '"><i class="icon-film icon-large"></i></a></div>';
            } else {
                if (get_post_format() == 'audio') {
                    echo '<div class="blog-icon audio"><a href="' . get_permalink() . '"><i class="icon-volume-up icon-large"></i></a></div>';
                } else {
                    if (get_post_format() == 'status') {
                        echo '<div class="blog-icon status"><a href="' . get_permalink() . '"><i class="icon-rss icon-large"></i></a></div>';
                    } else {
                        if (get_post_format() == 'quote') {
                            echo '<div class="blog-icon quote"><a href="' . get_permalink() . '"><i class="icon-quote-left icon-large"></i></a></div>';
                        } else {
                            if (get_post_format() == 'link') {
                                echo '<div class="blog-icon link"><a href="' . get_permalink() . '"><i class="icon-link icon-large"></i></a></div>';
                            } else {
                                if (get_post_format() == 'chat') {
                                    echo '<div class="blog-icon chat"><a href="' . get_permalink() . '"><i class="icon-comment-alt icon-large"></i></a></div>';
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Example #3
0
/**
 * Custom render function for Infinite Scroll.
 */
function brewery_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', get_post_format());
    }
}
        /**
         * The default template for displaying single post content
         *
         * @package Customizr
         * @since Customizr 3.0
         */
        function tc_post_content()
        {
            //check conditional tags : we want to show single post or single custom post types
            global $post;
            $tc_show_single_post_content = isset($post) && 'page' != $post->post_type && 'attachment' != $post->post_type && is_singular() && !tc__f('__is_home_empty');
            if (!apply_filters('tc_show_single_post_content', $tc_show_single_post_content)) {
                return;
            }
            //display an icon for div if there is no title
            $icon_class = in_array(get_post_format(), array('quote', 'aside', 'status', 'link')) ? apply_filters('tc_post_format_icon', 'format-icon') : '';
            ob_start();
            do_action('__before_content');
            ?>
    

          <section class="entry-content <?php 
            echo $icon_class;
            ?>
">
              <?php 
            the_content(__('Continue reading <span class="meta-nav">&rarr;</span>', 'customizr'));
            ?>
              <?php 
            wp_link_pages(array('before' => '<div class="pagination pagination-centered">' . __('Pages:', 'customizr'), 'after' => '</div>'));
            ?>
          </section><!-- .entry-content -->

        <?php 
            do_action('__after_content');
            $html = ob_get_contents();
            if ($html) {
                ob_end_clean();
            }
            echo apply_filters('tc_post_content', $html);
        }
/**
 * Custom render function for Infinite Scroll.
 */
function us_web_standards_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', get_post_format());
    }
}
/**
 * Custom render function for Infinite Scroll.
 */
function component_s_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('components/content', get_post_format());
    }
}
 protected function check_get_post_response($response, $post_obj, $context = 'view')
 {
     $response = json_ensure_response($response);
     $response_data = $response->get_data();
     $this->assertEquals($post_obj->ID, $response_data['ID']);
     $this->assertEquals($post_obj->post_name, $response_data['slug']);
     $this->assertEquals($post_obj->post_status, $response_data['status']);
     $this->assertEquals($post_obj->post_author, $response_data['author']);
     $this->assertArrayHasKey('parent', $response_data);
     $this->assertEquals(get_permalink($post_obj->ID), $response_data['link']);
     $this->assertEquals($post_obj->menu_order, $response_data['menu_order']);
     $this->assertEquals($post_obj->comment_status, $response_data['comment_status']);
     $this->assertEquals($post_obj->ping_status, $response_data['ping_status']);
     $this->assertEquals($post_obj->post_password, $response_data['password']);
     $this->assertEquals(is_sticky($post_obj->ID), $response_data['sticky']);
     // Check post parent.
     if ($post_obj->post_parent) {
         if (is_int($response_data['parent'])) {
             $this->assertEquals($post_obj->post_parent, $response_data['parent']);
         } else {
             $this->assertEquals($post_obj->post_parent, $response_data['parent']['ID']);
             $this->check_get_post_response($response_data['parent'], get_post($response_data['parent']['ID']), 'view-parent');
         }
     } else {
         $this->assertEmpty($response_data['parent']);
     }
     // Check post format.
     $post_format = get_post_format($post_obj->ID);
     if (empty($post_format)) {
         $this->assertEquals('standard', $response_data['format']);
     } else {
         $this->assertEquals(get_post_format($post_obj->ID), $response_data['format']);
     }
     // Check post dates.
     if ($post_obj->post_date_gmt === '0000-00-00 00:00:00') {
         $this->assertNull($response_data['date']);
         $this->assertNull($response_data['date_gmt']);
     } else {
         $this->assertEquals(json_mysql_to_rfc3339($post_obj->post_date), $response_data['date']);
         $this->assertEquals(json_mysql_to_rfc3339($post_obj->post_date_gmt), $response_data['date_gmt']);
     }
     if ($post_obj->post_modified_gmt === '0000-00-00 00:00:00') {
         $this->assertNull($response_data['modified']);
         $this->assertNull($response_data['modified_gmt']);
     } else {
         $this->assertEquals(json_mysql_to_rfc3339($post_obj->post_modified), $response_data['modified']);
         $this->assertEquals(json_mysql_to_rfc3339($post_obj->post_modified_gmt), $response_data['modified_gmt']);
     }
     // Check filtered values.
     $this->assertEquals(get_the_title($post_obj->ID), $response_data['title']);
     // TODO: apply content filter for more accurate testing.
     $this->assertEquals(wpautop($post_obj->post_content), $response_data['content']);
     // TODO: apply excerpt filter for more accurate testing.
     $this->assertEquals(wpautop($post_obj->post_excerpt), $response_data['excerpt']);
     $this->assertEquals($post_obj->guid, $response_data['guid']);
     if ($context === 'edit') {
         $this->assertEquals($post_obj->post_content, $response_data['content_raw']);
         $this->assertEquals($post_obj->post_excerpt, $response_data['excerpt_raw']);
     }
 }
/**
 * Custom render function for Infinite Scroll.
 */
function abc_nuorisotominta_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', get_post_format());
    }
}
/**
 * Custom render function for Infinite Scroll.
 */
function tabula_rasa_owlandpeaock_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', get_post_format());
    }
}
Example #10
0
/**
 * Custom render function for Infinite Scroll.
 */
function sensitive_skin_bootstrap_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', get_post_format());
    }
}
Example #11
0
/**
 * Custom render function for Infinite Scroll.
 */
function chomarat_2015_theme_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', get_post_format());
    }
}
Example #12
0
/**
 * Custom render function for Infinite Scroll.
 */
function heisenberg_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('page-templates/content', get_post_format());
    }
}
Example #13
0
function wedge_render_infinite_posts()
{
    while (have_posts()) {
        the_post();
        get_template_part('content', get_post_format());
    }
}
/**
 * Custom render function for Infinite Scroll.
 */
function devpro_theme_by_benjamin_knecht_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', get_post_format());
    }
}
Example #15
0
/**
 * Custom render function for Infinite Scroll.
 */
function privacyhorisontheme_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', get_post_format());
    }
}
Example #16
0
/**
 * Custom render function for Infinite Scroll.
 */
function mcclellandinsurance_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', get_post_format());
    }
}
function zp_custom_blog_page()
{
    global $post, $paged;
    $include = genesis_get_option('blog_cat');
    $exclude = genesis_get_option('blog_cat_exclude') ? explode(',', str_replace(' ', '', genesis_get_option('blog_cat_exclude'))) : '';
    if (get_query_var('paged')) {
        $paged = get_query_var('paged');
    } elseif (get_query_var('page')) {
        $paged = get_query_var('page');
    } else {
        $paged = 1;
    }
    //* Arguments
    $args = array('cat' => $include, 'category__not_in' => $exclude, 'posts_per_page' => genesis_get_option('blog_cat_num'), 'paged' => $paged);
    query_posts($args);
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            do_action('genesis_before_entry');
            printf('<article %s>', genesis_attr('entry'));
            // check post format and call template
            $format = get_post_format();
            get_template_part('content', $format);
            do_action('genesis_after_entry_content');
            //do_action( 'genesis_entry_footer' );
            echo '</article>';
            do_action('genesis_after_entry');
        }
    }
    //* Genesis navigation
    genesis_posts_nav();
    //* Restore original query
    wp_reset_query();
}
Example #18
0
/**
 * Custom render function for Infinite Scroll.
 */
function wpsp_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('partials/content', get_post_format());
    }
}
 /**
  * Shortcode functionality to show posts.
  *
  * @since 1.0.0
  */
 function theme_posts_shortcode($atts)
 {
     $output = false;
     // Pull in shortcode attributes and set defaults
     $defaults = array('category' => '', 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => '10', 'tag' => '');
     // Process shortcode attribtues
     $atts = shortcode_atts($defaults, $atts, 'show-posts');
     // Set up initial query for post
     $args = array('category_name' => $atts['category'], 'order' => $atts['order'], 'orderby' => $atts['orderby'], 'posts_per_page' => $atts['posts_per_page'], 'tag' => $atts['tag'], 'ignore_sticky_posts' => 1, 'no_found_rows' => true);
     $query = new WP_Query($args);
     if ($query->have_posts()) {
         global $wp_query;
         // Backup the main query.
         $saved_query = $wp_query;
         // Replace the main query by reference.
         $wp_query = $query;
         // Capture the output so we can return it to the shortcode process.
         ob_start();
         echo '<div class="show-posts-wrapper">';
         while ($wp_query->have_posts()) {
             $wp_query->the_post();
             get_template_part('content', get_post_format());
         }
         echo '</div>';
         $output = ob_get_clean();
         // Clean up after ourselves.
         $wp_query = $saved_query;
         wp_reset_postdata();
     }
     return $output;
 }
/**
 * Custom render function for Infinite Scroll.
 */
function redemptive_developments_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', get_post_format());
    }
}
function al_portfolio_meta_tags()
{
    $post_type = get_post_type();
    if ('portfolio' == $post_type) {
        $title = get_post_meta(get_the_ID(), "al_pf_og_title", TRUE);
        $title = !empty($title) ? $title : get_the_title();
        $meta = array('og:title' => $title, 'og:url' => get_permalink());
        $desc = get_post_meta(get_the_ID(), "al_pf_og_description", TRUE);
        $desc = !empty($desc) ? $desc : false;
        if ($desc) {
            $meta['og:description'] = $desc;
        }
        if (has_post_thumbnail()) {
            $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            $meta['og:image'] = $thumbnail[0];
        }
        if (get_post_format() == 'gallery') {
            $images = rwmb_meta('al_pf_gallery_images', 'type=image&size=full');
            if (is_array($images)) {
                foreach ($images as $image) {
                    $meta['images'][] = $image['url'];
                }
            }
        }
        foreach ($meta as $key => $value) {
            if ($key == 'images') {
                foreach ($value as $image) {
                    echo '<meta property="og:image" content="' . $image . '" />';
                }
            } else {
                echo '<meta property="' . $key . '" content="' . $value . '" />';
            }
        }
    }
}
Example #22
0
/**
 * Custom render function for Infinite Scroll.
 */
function chuchadon_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', post_type_supports(get_post_type(), 'post-formats') ? get_post_format() : get_post_type());
    }
}
Example #23
0
/**
 * Loop for Infinite Scroll
 */
function alienship_infinite_scroll_init()
{
    while (have_posts()) {
        the_post();
        get_template_part('/templates/parts/content', get_post_format());
    }
}
Example #24
0
function matraman_lite_post_type()
{
    if (has_post_format('gallery')) {
        echo '<i class="icon post-type icon-photos-pictures"></i>';
    }
    if (has_post_format('audio')) {
        echo '<i class="icon post-type icon-headphone"></i>';
    }
    if (has_post_format('chat')) {
        echo '<i class="icon post-type icon-chat-talk"></i>';
    }
    if (has_post_format('image')) {
        echo '<i class="icon post-type icon-camera"></i>';
    }
    if (has_post_format('link')) {
        echo '<i class="icon post-type icon-link"></i>';
    }
    if (has_post_format('quote')) {
        echo '<i class="icon post-type icon-quote-left"></i>';
    }
    if (has_post_format('video')) {
        echo '<i class="icon post-type icon-film-maker"></i>';
    }
    if (has_post_format('status')) {
        echo '<i class="icon post-type icon-message-talk"></i>';
    }
    if (!get_post_format() && !is_sticky()) {
        echo '<i class="icon post-type icon-book"></i>';
    }
    if (is_sticky()) {
        echo '<i class="icon post-type icon-pin"></i>';
    }
}
Example #25
0
/**
 * Custom render function for Infinite Scroll.
 */
function doublecheeseburger_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', get_post_format());
    }
}
Example #26
0
 function modify_post($entry)
 {
     $format = get_post_format($entry->ID);
     if (empty($format)) {
         $format = "standard";
     }
     switch ($format) {
         case 'standard':
             $this->filter_title($entry);
             break;
         case 'gallery':
             $this->filter_title($entry);
             $this->filter_gallery($entry);
             break;
         case 'video':
             $this->filter_title($entry);
             $this->filter_video($entry);
             break;
         case 'image':
             $this->filter_title($entry);
             $this->filter_image($entry);
             break;
         case 'link':
             $this->filter_link($entry);
             break;
         case 'quote':
             $this->filter_quote($entry);
             break;
         case 'audio':
             $this->filter_title($entry);
             $this->filter_audio($entry);
             break;
     }
 }
 function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
     $sticky = get_option('sticky_posts');
     $number = empty($instance['number']) ? 1 : (int) $instance['number'];
     $cat = empty($instance['category']) ? 0 : (int) $instance['category'];
     if (is_single()) {
         array_push($sticky, get_the_ID());
     }
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     } else {
         echo '<br />';
     }
     $featuredPosts = new WP_Query(array('posts_per_page' => $number, 'cat' => $cat, 'post__not_in' => $sticky, 'no_found_rows' => true));
     while ($featuredPosts->have_posts()) {
         $featuredPosts->the_post();
         global $mb_content_area, $more;
         $mb_content_area = 'sidebar';
         get_template_part('content', get_post_format());
     }
     wp_reset_postdata();
     echo $after_widget;
 }
/**
 * Custom render function for Infinite Scroll.
 */
function portarlington_cce_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', get_post_format());
    }
}
Example #29
0
 /**
  * @see CPAC_Column::get_raw_value()
  * @since 2.0.3
  */
 function get_raw_value($post_id)
 {
     if (!($format = get_post_format($post_id))) {
         return false;
     }
     return $format;
 }
Example #30
0
/**
 * Custom render function for Infinite Scroll.
 */
function plainbootstrapbybrenton_infinite_scroll_render()
{
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', get_post_format());
    }
}