Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * The main template file.
- *
- * This is the most generic template file in a WordPress theme
- * and one of the two required files for a theme (the other being style.css).
- * It is used to display a page when nothing more specific matches a query.
- * E.g., it puts together the home page when no home.php file exists.
- * Learn more: http://codex.wordpress.org/Template_Hierarchy
- *
- * @package Spun
- */
- get_header(); ?>
- <div id="primary" class="content-area">
- <div id="content" class="site-content" role="main">
- <?php if ( is_home() && ! is_paged() ) : ?>
- <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
- <?php endif; ?>
- <?php if ( have_posts() ) : ?>
- <?php /* Start the Loop */ ?>
- <?php while ( have_posts() ) : the_post(); ?>
- <?php
- /* Include the Post-Format-specific template for the content.
- * If you want to overload this in a child theme then include a file
- * called content-___.php (where ___ is the Post Format name) and that will be used instead.
- */
- get_template_part( 'content', 'home' );
- ?>
- <?php endwhile; ?>
- <?php
- /* Get custom circles */
- $args = array(
- 'post_type' => 'custom_circles'
- );
- $custom_circles = new WP_Query( $args );
- if( $custom_circles->have_posts() ) {
- while( $custom_circles->have_posts() ) {
- $custom_circles->the_post();
- // Get the link
- $link = get_custom_field( 'link' );
- //Add in "http://" if it isn't there already
- if ( strpos( $link, 'http://' ) === false ) {
- $link = 'http://' . $link;
- }
- // I don't know how to return something useful from
- // get_custom_field that'll let me know if no image
- // has been specified, so I'm doing this elongation:
- // Convert the image to an integer
- $image_id = (int) get_custom_field( 'image:wrapper');
- //If it's more than zero then it has matched
- if ( $image_id !== 0 ) {
- $thumb_id = get_custom_field( 'image' );
- $thumb = wp_get_attachment_image($thumb_id, 'home-post wp-post-image');
- }
- else {
- $thumb = '<span class="no-thumbnail">' . esc_attr( the_title_attribute( 'echo=0' ) ) . '</span>';
- $postclass = 'no-thumbnail';
- }
- ?>
- <article id="post-<?php the_ID(); ?>" <?php post_class( $postclass ); ?>>
- <a href="<?php echo $link; ?>" title="<?php the_title() ?>" rel="bookmark">
- <?php echo $thumb; ?>
- </a>
- </article><!-- #post-<?php the_ID(); ?> -->
- <?php
- }
- }
- ?>
- <?php spun_content_nav( 'nav-below' ); ?>
- <?php elseif ( current_user_can( 'edit_posts' ) ) : ?>
- <?php get_template_part( 'content', 'none' ); ?>
- <?php endif; ?>
- </div><!-- #content .site-content -->
- </div><!-- #primary .content-area -->
- <?php get_sidebar(); ?>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement