Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * The template for displaying Category pages.
- *
- * Learn more: http://codex.wordpress.org/Template_Hierarchy
- *
- * @package WordPress
- * @subpackage FlatAds
- * @since FlatAds 1.0
- */
- get_header();
- global $redux_demo, $maximRange;
- $max_range = $redux_demo['max_range'];
- if(!empty($max_range)) {
- $maximRange = $max_range;
- } else {
- $maximRange = 1000;
- }
- ?>
- <section id="category-featured-ads-title">
- <div class="container">
- <?php
- $cat_id = get_cat_ID(single_cat_title('', false));
- $this_category = get_category($cat);
- if ($this_category->category_parent == 0) {
- $tag = $cat_id;
- $tag_extra_fields = get_option(MY_CATEGORY_FIELDS);
- if (isset($tag_extra_fields[$tag])) {
- $category_icon_code = $tag_extra_fields[$tag]['category_icon_code'];
- $category_icon_color = $tag_extra_fields[$tag]['category_icon_color'];
- }
- } else {
- $parent_category = get_category($this_category->category_parent);
- $getParentCatId = $parent_category->cat_ID;
- $tag_extra_fields = get_option(MY_CATEGORY_FIELDS);
- if (isset($tag_extra_fields[$getParentCatId])) {
- $category_icon_code = $tag_extra_fields[$getParentCatId]['category_icon_code'];
- $category_icon_color = $tag_extra_fields[$getParentCatId]['category_icon_color'];
- }
- }
- if(!empty($category_icon_code)) {
- ?>
- <div class="category-icon-box" style="background-color: <?php echo $category_icon_color; ?>;"><?php $category_icon = stripslashes($category_icon_code); echo $category_icon; ?></div>
- <?php } ?>
- <?php
- $cat_id = get_cat_ID(single_cat_title('', false));
- $cat_parent_ID = isset( $cat_id->category_parent ) ? $cat_id->category_parent : '';
- if ($cat_parent_ID == 0) {
- $tag = $cat_id;
- } else {
- $tag = $cat_parent_ID;
- }
- $category = get_category($tag);
- $count = $category->category_count;
- $catName = get_cat_name( $tag );
- echo '<h2>';
- echo $catName;
- echo '</h2>';
- ?>
- </div>
- </section>
- <section id="big-map">
- <div id="flatads-main-map"></div>
- <?php
- global $redux_demo;
- $header_version = $redux_demo['header-version'];
- ?>
- <?php if($header_version == 1) { ?>
- <div id="advanced-search-widget">
- <div class="container">
- <div class="advanced-search-widget-content">
- <div class="advanced-search-title">
- <?php _e( 'Search around my position', 'agrg' ); ?>
- </div>
- <div class="advanced-search-slider">
- <div class="geo-location-button">
- <div class="geo-location-switch off"><i class="fa fa-location-arrow"></i></div>
- </div>
- <div id="advance-search-slider" class="value-slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all" aria-disabled="false">
- <a class="ui-slider-handle ui-state-default ui-corner-all" href="#">
- <span class="range-pin">
- <input type="text" name="geo-radius" id="geo-radius" value="100" data-default-value="100">
- </span>
- </a>
- </div>
- </div>
- </div>
- </div>
- </div>
- <?php } elseif($header_version == 2) { ?>
- <div id="advanced-search-widget-version2">
- <div class="container">
- <div class="advanced-search-widget-content">
- <form action="<?php echo home_url(); ?>" method="get" id="views-exposed-form-search-view-other-ads-page" accept-charset="UTF-8">
- <div id="edit-search-api-views-fulltext-wrapper" class="views-exposed-widget views-widget-filter-search_api_views_fulltext">
- <div class="views-widget">
- <div class="control-group form-type-textfield form-item-search-api-views-fulltext form-item">
- <div class="controls">
- <input placeholder="Enter keyword..." type="text" id="edit-search-api-views-fulltext" name="s" value="" size="30" maxlength="128" class="form-text">
- </div>
- </div>
- </div>
- </div>
- <div id="edit-ad-location-wrapper" class="views-exposed-widget views-widget-filter-field_ad_location">
- <div class="views-widget">
- <div class="control-group form-type-select form-item-ad-location form-item">
- <div class="controls">
- <select id="edit-ad-location" name="post_location" class="form-select" style="display: none;">
- <option value="All" selected="selected">Location...</option>
- <?php
- $args_location = array( 'posts_per_page' => -1 );
- $lastposts = get_posts( $args_location );
- $all_post_location = array();
- foreach( $lastposts as $post ) {
- $all_post_location[] = get_post_meta( $post->ID, 'post_location', true );
- }
- $directors = array_unique($all_post_location);
- foreach ($directors as $director) { ?>
- <option value="<?php echo $director; ?>"><?php echo $director; ?></option>
- <?php }
- ?>
- <?php wp_reset_query(); ?>
- </select>
- </div>
- </div>
- </div>
- </div>
- <div id="edit-field-category-wrapper" class="views-exposed-widget views-widget-filter-field_category">
- <div class="views-widget">
- <div class="control-group form-type-select form-item-field-category form-item">
- <div class="controls">
- <select id="edit-field-category" name="category_name" class="form-select" style="display: none;">
- <option value="All" selected="selected">Category...</option>
- <?php
- $args = array(
- 'hierarchical' => '0',
- 'hide_empty' => '0'
- );
- $categories = get_categories($args);
- foreach ($categories as $cat) {
- if ($cat->category_parent == 0) {
- $catID = $cat->cat_ID;
- ?>
- <option value="<?php echo $cat->cat_name; ?>"><?php echo $cat->cat_name; ?></option>
- <?php
- $args2 = array(
- 'hide_empty' => '0',
- 'parent' => $catID
- );
- $categories = get_categories($args2);
- foreach ($categories as $cat) { ?>
- <option value="<?php echo $cat->slug; ?>">- <?php echo $cat->cat_name; ?></option>
- <?php } ?>
- <?php } else { ?>
- <?php }
- } ?>
- </select>
- </div>
- </div>
- </div>
- </div>
- <div class="advanced-search-slider">
- <div class="geo-location-button">
- <div class="geo-location-switch off"><i class="fa fa-location-arrow"></i></div>
- </div>
- <div id="advance-search-slider" class="value-slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all" aria-disabled="false">
- <a class="ui-slider-handle ui-state-default ui-corner-all" href="#">
- <span class="range-pin">
- <input type="text" name="geo-radius" id="geo-radius" value="100" data-default-value="100">
- </span>
- </a>
- </div>
- </div>
- <input type="text" name="geo-location" id="geo-location" value="off" data-default-value="off">
- <input type="text" name="geo-radius-search" id="geo-radius-search" value="500" data-default-value="500">
- <input type="text" name="geo-search-lat" id="geo-search-lat" value="0" data-default-value="0">
- <input type="text" name="geo-search-lng" id="geo-search-lng" value="0" data-default-value="0">
- <div class="views-exposed-widget views-submit-button">
- <button class="btn btn-primary form-submit" id="edit-submit-search-view" name="" value="Search" type="submit"><?php printf( __( 'Search', 'agrg' )); ?></button>
- </div>
- </form>
- </div>
- </div>
- </div>
- <?php } ?>
- </section>
- <?php
- global $redux_demo;
- $featured_ads_option = $redux_demo['featured-options-on'];
- ?>
- <?php if($featured_ads_option == 1) { ?>
- <section id="featured-ads-category">
- <div class="container">
- <h3><?php _e( 'Check out our Premium Featured Ads', 'agrg' ); ?></h3>
- <div id="tabs" class="full">
- <?php $cat_id = get_cat_ID(single_cat_title('', false)); ?>
- <ul class="tabs quicktabs-tabs quicktabs-style-nostyle">
- <li class="grid-feat-ad-style"><a class="" href="#">Grid View</a></li>
- <li class="list-feat-ad-style"><a class="" href="#">List View</a></li>
- </ul>
- <div class="pane">
- <div id="carousel-buttons">
- <a href="#" id="carousel-prev">← Previous </a>
- <a href="#" id="carousel-next"> Next →</a>
- </div>
- <div id="projects-carousel"> <?php global $paged, $wp_query, $wp; $args = wp_parse_args($wp->matched_query); $cat_id = get_cat_ID(single_cat_title('', false)); $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $wp_query->query('post_type=post&posts_per_page=-1&cat='.$cat_id);
- $current = -1; ?>
- <?php while ($wp_query->have_posts()) : $wp_query->the_post();
- $featured_post = "0";
- $post_price_plan_activation_date = get_post_meta($post->ID, 'post_price_plan_activation_date', true);
- $post_price_plan_expiration_date = get_post_meta($post->ID, 'post_price_plan_expiration_date', true);
- $post_price_plan_expiration_date_noarmal = get_post_meta($current_post, 'post_price_plan_expiration_date_normal', true);
- $todayDate = strtotime(date('m/d/Y h:i:s'));
- $expireDate = $post_price_plan_expiration_date;
- if(!empty($post_price_plan_activation_date)) {
- if(($todayDate < $expireDate) or $post_price_plan_expiration_date == 0) {
- $featured_post = "1";
- }
- } ?>
- <?php if($featured_post == "1") {
- $current++;
- ?>
- <div class="ad-box span3">
- <a class="ad-image" href="<?php the_permalink(); ?>">
- <?php require_once(TEMPLATEPATH . '/inc/BFI_Thumb.php'); ?>
- <?php
- $thumb_id = get_post_thumbnail_id();
- $thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail-size', true);
- $params = array( 'width' => 440, 'height' => 290, 'crop' => true );
- echo "<img class='add-box-main-image' src='" . bfi_thumb( "$thumb_url[0]", $params ) . "'/>";
- $attachments = get_children(array('post_parent' => $post->ID,
- 'post_status' => 'inherit',
- 'post_type' => 'attachment',
- 'post_mime_type' => 'image',
- 'order' => 'ASC',
- 'orderby' => 'menu_order ID'));
- $currentImg = 0;
- foreach($attachments as $att_id => $attachment) {
- $full_img_url = wp_get_attachment_url($attachment->ID);
- $currentImg++;
- if($currentImg == 2) {
- echo "<img class='add-box-second-image' src='" . bfi_thumb( "$full_img_url", $params ) . "'/>";
- }
- }
- if($currentImg < 2) {
- echo "<img class='add-box-second-image' src='" . bfi_thumb( "$thumb_url[0]", $params ) . "'/>";
- }
- ?>
- </a>
- <div class="ad-box-content">
- <span class="ad-category">
- <?php
- $category = get_the_category();
- if ($category[0]->category_parent == 0) {
- $tag = $category[0]->cat_ID;
- $tag_extra_fields = get_option(MY_CATEGORY_FIELDS);
- if (isset($tag_extra_fields[$tag])) {
- $category_icon_code = $tag_extra_fields[$tag]['category_icon_code'];
- $category_icon_color = $tag_extra_fields[$tag]['category_icon_color'];
- }
- } else {
- $tag = $category[0]->category_parent;
- $tag_extra_fields = get_option(MY_CATEGORY_FIELDS);
- if (isset($tag_extra_fields[$tag])) {
- $category_icon_code = $tag_extra_fields[$tag]['category_icon_code'];
- $category_icon_color = $tag_extra_fields[$tag]['category_icon_color'];
- }
- }
- if(!empty($category_icon_code)) {
- ?>
- <div class="category-icon-box" style="background-color: <?php echo $category_icon_color; ?>;"><?php $category_icon = stripslashes($category_icon_code); echo $category_icon; ?></div>
- <?php }
- $your_image_url = "";
- ?>
- </span>
- <a href="<?php the_permalink(); ?>"><?php $theTitle = get_the_title(); $theTitle = (strlen($theTitle) > 40) ? substr($theTitle,0,37).'...' : $theTitle; echo $theTitle; ?></a>
- <?php $post_price = get_post_meta($post->ID, 'post_price', true); ?>
- <div class="add-price"><span><?php echo $post_price; ?></span></div>
- </div>
- </div>
- <?php } ?>
- <?php endwhile; ?>
- <?php wp_reset_query(); ?>
- </div>
- <?php wp_enqueue_script( 'jquery-carousel', get_template_directory_uri().'/js/jquery.carouFredSel-6.2.1-packed.js', array('jquery'),'',true); ?>
- <!-- end scripts -->
- </div>
- <div class="pane">
- <?php
- global $paged, $wp_query, $wp;
- $args = wp_parse_args($wp->matched_query);
- $cat_id = get_cat_ID(single_cat_title('', false));
- $temp = $wp_query;
- $wp_query= null;
- $wp_query = new WP_Query();
- $wp_query->query('post_type=post&posts_per_page=-1&cat='.$cat_id);
- $current = -1;
- echo "dddd";
- ?>
- <?php while ($wp_query->have_posts()) : $wp_query->the_post();
- $featured_post = "0";
- $post_price_plan_activation_date = get_post_meta($post->ID, 'post_price_plan_activation_date', true);
- $post_price_plan_expiration_date = get_post_meta($post->ID, 'post_price_plan_expiration_date', true);
- $post_price_plan_expiration_date_noarmal = get_post_meta($current_post, 'post_price_plan_expiration_date_normal', true);
- $todayDate = strtotime(date('m/d/Y h:i:s'));
- $expireDate = $post_price_plan_expiration_date;
- if(!empty($post_price_plan_activation_date)) {
- if(($todayDate < $expireDate) or $post_price_plan_expiration_date == 0) {
- $featured_post = "1";
- }
- } ?>
- <?php if($featured_post == "1") {
- $current++;
- echo "eeee";
- ?>
- <div class="list-featured-ads">
- <div class="list-feat-ad-image">
- <a class="ad-image" href="<?php the_permalink(); ?>">
- <?php require_once(TEMPLATEPATH . '/inc/BFI_Thumb.php'); ?>
- <?php
- $thumb_id = get_post_thumbnail_id();
- $thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail-size', true);
- $params = array( 'width' => 440, 'height' => 290, 'crop' => true );
- echo "<img class='add-box-main-image' src='" . bfi_thumb( "$thumb_url[0]", $params ) . "'/>";
- $attachments = get_children(array('post_parent' => $post->ID,
- 'post_status' => 'inherit',
- 'post_type' => 'attachment',
- 'post_mime_type' => 'image',
- 'order' => 'ASC',
- 'orderby' => 'menu_order ID'));
- $currentImg = 0;
- foreach($attachments as $att_id => $attachment) {
- $full_img_url = wp_get_attachment_url($attachment->ID);
- $currentImg++;
- if($currentImg == 2) {
- echo "<img class='add-box-second-image' src='" . bfi_thumb( "$full_img_url", $params ) . "'/>";
- }
- }
- if($currentImg < 2) {
- echo "<img class='add-box-second-image' src='" . bfi_thumb( "$thumb_url[0]", $params ) . "'/>";
- }
- ?>
- </a>
- </div>
- <div class="list-feat-ad-content">
- <div class="list-feat-ad-title">
- <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
- <?php $post_price = get_post_meta($post->ID, 'post_price', true); ?>
- <div class="add-price"><span><?php echo $post_price; ?></span></div>
- </div>
- <div class="list-feat-ad-excerpt">
- <p>
- <?php
- $content = get_the_content();
- echo wp_trim_words( $content , '20' );
- ?>
- </p>
- </div>
- <div class="read-more"> <a href="<?php the_permalink(); ?>"><?php _e( 'Details', 'agrg' ); ?></a></div>
- </div>
- </div>
- <?php } ?>
- <?php endwhile; ?>
- <?php wp_reset_query(); ?>
- </div>
- </div>
- </div>
- </section>
- <?php } ?>
- <section id="ads-category-content">
- <div class="container">
- <div class="span9 first">
- <ul class="tabs quicktabs-tabs quicktabs-style-nostyle">
- <li >
- <a style="font-size: 18px !important; font-weight: bold;" class="current" href="#latest"><?php _e( 'Latest Ads', 'agrg' ); ?></a>
- </li>
- <li>
- <a style="font-size: 18px !important; font-weight: bold; color: #1aaf5d;"class="" href="#free" ><?php _e( 'Free Ads', 'agrg' ); ?></a>
- </li>
- <li>
- <a style="font-size: 18px !important; font-weight: bold; color: #ff8800;" class="" href="#wanted"><?php _e( 'Wanted Ads', 'agrg' ); ?></a>
- </li>
- <li>
- <a style="font-size: 18px !important; font-weight: bold; color: #ef1207;" class="" href="#forsale"><?php _e( 'For Sale Ads', 'agrg' ); ?></a>
- </li>
- <li>
- <a style="font-size: 18px !important; font-weight: bold; color: #af1b6e;" class="" href="#swap"><?php _e( 'Swap Ads', 'agrg' ); ?></a>
- </li>
- </ul>
- <div class="pane latest-ads-holder">
- <div class="latest-ads-grid-holder">
- <?php
- global $paged, $wp_query, $wp;
- $args = wp_parse_args($wp->matched_query);
- if ( !empty ( $args['paged'] ) && 0 == $paged ) {
- $wp_query->set('paged', $args['paged']);
- $paged = $args['paged'];
- }
- $cat_id = get_cat_ID(single_cat_title('', false));
- $temp = $wp_query;
- $wp_query= null;
- $wp_query = new WP_Query();
- $wp_query->query('post_type=post&posts_per_page=12&paged='.$paged.'&cat='.$cat_id);
- $current = -1;
- $current2 = 0;
- ?>
- <?php
- $x = $wp_query->have_posts();
- if (empty($x)){
- echo "<br><center><span class="error" style="color: #bfbfbf; margin-bottom: 20px; font-size: 18px; font-weight: bold;">No ads in this category.</span></center>";
- }
- while ($wp_query->have_posts()) : $wp_query->the_post(); $current++; $current2++;
- ?>
- <div class="ad-box span3 latest-posts-grid <?php if($current%3 == 0) { echo 'first'; } ?>">
- <a class="ad-image" href="<?php the_permalink(); ?>">
- <?php require_once(TEMPLATEPATH . '/inc/BFI_Thumb.php'); ?>
- <?php $thumb_id = get_post_thumbnail_id(); if (trim($thumb_id =="")) { $thumb_id = get_site_url(); $thumb_id .= "/noi.png"; $params = array( 'width' => 440, 'height' => 290, 'crop' => true ); echo "<img class='add-box-main-image' src="$thumb_id"/>"; } else{ $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts( $args ); if ( $attachments ) { foreach ( $attachments as $attachment ) { echo '<li>'; echo wp_get_attachment_image( $attachment->ID, 'full' ); echo '<p>'; echo apply_filters( 'the_title', $attachment->post_title ); echo '</p></li>'; } } $thumb_id = get_post_thumbnail_id(); $thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail-size', true); $params = array( 'width' => 440, 'height' => 290, 'crop' => true ); echo "<img class='add-box-main-image' src='" . bfi_thumb( "$thumb_url[0]", $params ) . "'/>"; $attachments = get_children(array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID')); $currentImg = 0; foreach($attachments as $att_id => $attachment) { $full_img_url = wp_get_attachment_url($attachment->ID); $currentImg++; } } ?>
- </a>
- <div class="ad-box-content">
- <div class="add-price"><span class="add-price" style="text-transform: uppercase;"><?php $post_price = get_post_meta($post->ID, 'post_price', true);
- if (trim($post_price =="FREE")) {
- $post_price = get_post_meta($post->ID, 'post_price', true);
- echo "<span class="ad-page-pricegreen">$post_price</span> ";
- }
- else if (trim($post_price =="Free")) {
- $post_price = get_post_meta($post->ID, 'post_price', true);
- echo "<span class="ad-page-pricegreen">$post_price</span>";
- }
- else if (trim($post_price == "WANTED")){
- $post_price = get_post_meta($post->ID, 'post_price', true);
- echo "<span class="ad-page-priceorange">$post_price</span> ";
- }else if (trim($post_price == "Wanted")){
- $post_price = get_post_meta($post->ID, 'post_price', true);
- echo "<span class="ad-page-priceorange">$post_price</span> ";
- }else if (trim($post_price == "SWAP")){ $post_price = get_post_meta($post->ID, 'post_price', true); echo "<span class="ad-page-pricepurple">$post_price</span> "; }
- else{
- $post_price = get_post_meta($post->ID, 'post_price', true);
- echo "<span class="ad-page-pricered">$post_price</span>";
- }
- ?> </span></div> <a href="<?php the_permalink(); ?>"><?php $theTitle = get_the_title(); $theTitle = (strlen($theTitle) > 40) ? substr($theTitle,0,37).'...' : $theTitle; echo $theTitle; ?></a>
- </div>
- </div>
- <?php endwhile; ?>
- </div>
- <!-- Begin wpcrown_pagination-->
- <?php
- if( $wp_rewrite->using_permalinks() )
- $wpcrown_pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg('s',get_pagenum_link(1) ) ) . 'page/%#%/#latest', 'paged');
- if (empty($x)){
- } else{
- if( !empty($wp_query->query_vars['s']) ) {
- $wpcrown_pagination['add_args'] = array('s'=>get_query_var('s'));
- } else{
- echo '<div class="pagination">' . paginate_links($wpcrown_pagination) . '</div>'; }
- }
- $checker = 1;
- ?>
- <!-- End wpcrown_pagination-->
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement