Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- get_header(); ?>
- <section id="primary">
- <div id="content" role="main">
- <?php if ( have_posts() ) : ?>
- <header class="page-header">
- <h1 class="page-title"><?php
- printf( __( 'Category Archives: %s', 'twentyeleven' ), '<span>' . single_cat_title( '', false ) . '</span>' );
- ?></h1>
- <?php
- $category_description = category_description();
- if ( ! empty( $category_description ) )
- echo apply_filters( 'category_archive_meta', '<div class="category-archive-meta">' . $category_description . '</div>' );
- ?>
- </header>
- <?php twentyeleven_content_nav( 'nav-below' ); ?>
- <?php /* Start the Loop */ ?>
- <?php function catch_that_image() {
- global $post, $posts;
- $first_img = '';
- ob_start();
- ob_end_clean();
- $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
- $first_img = $matches [1] [0];
- if(empty($first_img)){ //Defines a default image
- $first_img = "/images/default.jpg";
- }
- return $first_img;
- } ?>
- <table>
- <tr>
- <?php $colCount = 0; $rowCount = 0; $columnLimit = 3; $rowLimit = 1; ?>
- <?php while ( have_posts() ) : the_post(); ?>
- <?php if(function_exists('wp_page_numbers')) : wp_page_numbers(); endif; ?>
- <?php if($colCount == 0){echo '<tr>'; $rowCount++;} ?>
- <td>
- <a href = "<?php the_permalink() ?>">
- <img src="<?php echo catch_that_image(); ?>" style="width:150px;height:autopx;padding:25px 30px 5px 30px;vertical-align: middle;"/>
- </a>
- <a class="more-link" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><center><?php the_title_attribute(); ?></center></a>
- </td>
- <?php $colCount++; if($colCount >= $columnLimit){ echo '</tr>'; $colCount = 0; if($rowCount >= $rowLimit){break;}} ?>
- <?php endwhile; ?>
- </tr>
- </table>
- <?php twentyeleven_content_nav( 'nav-below' ); ?>
- <?php else : ?>
- <article id="post-0" class="post no-results not-found">
- <header class="entry-header">
- <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
- </header><!-- .entry-header -->
- <div class="entry-content">
- <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
- <?php get_search_form(); ?>
- </div><!-- .entry-content -->
- </article><!-- #post-0 -->
- <?php endif; ?>
- </div><!-- #content -->
- </section><!-- #primary -->
- <?php get_sidebar(); ?>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement