Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: Portfolio 2 columns
- */
- get_header()
- ?>
- <div class="container contentwrapper">
- <div class="sixteen columns alpha omega portpage">
- <header><h1 class="headofpage"><?php the_title() ?></h1></header>
- <?php
- echo showPortCategory(get_the_ID());
- $args = array(
- 'post_type' => 'port',
- 'paged' => $paged,
- 'posts_per_page' => get_theme_option("portfolio_work_count"),
- );
- if (isset($_GET['slug'])) {
- $args['tax_query'] = array(
- array(
- 'taxonomy' => 'portcat',
- 'field' => 'slug',
- 'terms' => $_GET['slug']
- )
- );
- }
- $custom_query = new wp_query($args);
- $tempi = 1;
- echo "<div class='portrowed perline2'>";
- while ( $custom_query->have_posts() ) : $custom_query->the_post();
- #We have:
- #get_permalink() - Full url to post;
- #get_the_title() - Post title;
- #get_the_content() - Post text;
- #get_post_time('U', true) - unix timestamp
- $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail');
- $taxonomies = get_taxonomies();
- $term_list = get_the_terms($key, $taxonomies);
- $pf = get_post_format();
- if (empty($pf))
- $pf = "default";
- $new_term_list = get_the_terms($post->ID, "portcat");
- if (is_array($new_term_list)) {
- foreach ($new_term_list as $term) {
- $tempname = strtr($term->name, array(
- ' ' => '-',
- ));
- $echoallterm .= strtolower($tempname) . " ";
- $echoterm = $term->name;
- }
- }
- ?>
- <div id="post-<?php the_ID() ?>" class="post block_shadow columns eight port2perline all <?php echo $echoallterm; ?>">
- <div class="thispost porttype preloader_container">
- <div class="post-type-cont">
- <a href="<?php the_permalink() ?>" title="<?php the_title() ?>" rel="bookmark"><span class="type_<?php echo $pf; ?>"></span></a>
- </div>
- <div class="post-title-cont">
- <h2 class="post-title">
- <a href="<?php the_permalink() ?>" title="<?php the_title() ?>" rel="bookmark"><?php the_title() ?></a>
- </h2>
- <?php
- $content = get_the_content();
- if (preg_match_all('#<h1>(.*)</h1>#i', $content, $matches)) {
- foreach ($matches[1] as $key => $val) {
- $$val = $matches[2][$key];
- }
- }
- ?>
- <h3><?php echo $val ?></h3>
- </div>
- <div class="post-content">
- <?php if (strlen($featured_image[0]) > 0) { ?><img alt='<?php echo get_the_title(); ?>' src='<?php echo TIMTHUMBURL; ?>?w=420&h=230&src=<?php echo $featured_image[0]; ?>'><?php } ?>
- <?php
- if (strlen($post->post_excerpt) > 0) {
- echo get_the_excerpt();
- }
- ?>
- </div>
- <a class="plus_btn" href="<?php the_permalink() ?>">click me</a>
- </div>
- <div class="clear"></div>
- </div><!-- .post -->
- <?php
- unset($echoallterm);
- endwhile;
- wp_reset_query();
- ?>
- </div><!-- // rowed -->
- <?php get_pagination() ?>
- <div class="clear"></div>
- </div>
- </div>
- <div class="clear"></div>
- <?php get_footer() ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement