Ejemplo n.º 1
0
"><strong><a href="<?php 
        echo get_permalink();
        ?>
" title="View <?php 
        echo the_title();
        ?>
"><?php 
        echo the_title();
        ?>
</a></strong>

					<div class="search-results">
<?php 
        $tmp = get_the_content();
        $new_content = strip_tags($tmp, '<p>');
        $content_trimmed = trim_by_chars($new_content, '100', nh_continue_reading_link());
        echo '<p>' . $content_trimmed . '</p>';
        // Get post cats
        echo '<p><span class="byline">in</span> ';
        $categories = get_the_category();
        if ($categories) {
            foreach ($categories as $cat) {
                $cat_name = $cat->name;
                $cat_id = get_cat_ID($cat_name);
                $cat_link = get_category_link($cat_id);
                echo '<a href="' . $cat_link . '" title="View ' . $cat->name . '">';
                echo $cat->name;
                echo '</a> + ';
            }
        }
        // Get post cities
Ejemplo n.º 2
0
        }
        wp_reset_query();
    } else {
        // show posts that match the users city or any city
        $normal_args = array('posts_per_page' => 4, 'orderby' => 'date', 'order' => DESC, 'tax_query' => array('relation' => 'AND', array('taxonomy' => 'category', 'field' => 'slug', 'terms' => array('guides')), array('taxonomy' => 'nh_cities', 'field' => 'slug', 'terms' => array($user_city_slug, 'any-city'))));
        $normal_query = new WP_Query($normal_args);
        while ($normal_query->have_posts()) {
            $normal_query->the_post();
            $imgSrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
            $post_cities = wp_get_post_terms($post->ID, 'nh_cities');
            $term = array_pop($post_cities);
            echo '<li class="guides-list" id="post-' . $post->ID . '"><a rel="bookmark" title="See ' . get_the_title() . '" href="' . get_permalink() . '">';
            echo '<img class="guide_image_bg" src="' . $style_url . '/lib/timthumb.php?src=' . $imgSrc[0] . '&w=184&h=115&zc=1&a=tl&q=95" alt="Photo from ' . get_the_title() . '" /></a>';
            echo '<div class="home-caption">';
            $pad = ' ...';
            $pic_title = trim_by_chars(get_the_title(), '50', $pad);
            echo '<p><a class="nhline link-other" rel="bookmark" title="See ' . get_the_title() . '" href="' . get_permalink() . '">' . $pic_title . '</a></p>';
            if ($term->name == $user_city) {
                echo '<p class="city-caption">' . $term->name . '</p>';
            } else {
                echo '<p class="city-caption">Any City</p>';
            }
            echo '</div>';
            echo '</li>';
        }
        wp_reset_query();
    }
    ?>
	<div class="see_all"><a class="nhline" href="<?php 
    echo $app_url;
    ?>