Created
October 29, 2015 11:37
-
-
Save viruthagiri/0334254ca734dabab6af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //listview template customization. | |
| // This file is under development. So its not included in functions.php | |
| function whoop_category_list_view_ul_extra_class($extra_class) { | |
| $extra_class = 'whoop-view'; | |
| return $extra_class; | |
| } | |
| add_filter('geodir_category_list_view_ul_extra_class', 'whoop_category_list_view_ul_extra_class', 10, 1); | |
| function whoop_geodir_is_reviews_show($is_display, $pageview) { | |
| if ($pageview == 'listview') { | |
| $is_display = false; | |
| } | |
| return $is_display; | |
| } | |
| add_filter('geodir_is_reviews_show', 'whoop_geodir_is_reviews_show', 10, 2); | |
| function whoop_geodir_show_listing_post_excerpt($is_display, $pageview) { | |
| $is_display = false; | |
| return $is_display; | |
| } | |
| add_filter('geodir_show_listing_post_excerpt', 'whoop_geodir_show_listing_post_excerpt', 10, 2); | |
| function whoop_geodir_before_listing_post_title($view, $post) { | |
| ?> | |
| <div class="geodir-entry-content"> | |
| <?php | |
| } | |
| add_action('geodir_before_listing_post_title', 'whoop_geodir_before_listing_post_title', 10, 2); | |
| function whoop_geodir_listing_after_pinpoint($post_id) { | |
| ?> | |
| </div> | |
| <?php | |
| } | |
| add_action('geodir_listing_after_pinpoint', 'whoop_geodir_listing_after_pinpoint', 10, 1); | |
| function whoop_geodir_before_review_html($post, $view) { | |
| ?> | |
| <div class="geodir-big-header-ratings"> | |
| <?php | |
| global $post; | |
| $post_avgratings = geodir_get_post_rating($post->ID); | |
| echo geodir_get_rating_stars($post_avgratings, $post->ID); | |
| ?> | |
| <a href="<?php comments_link(); ?>" class="geodir-big-header-rc"><?php geodir_comments_number($post->rating_count); ?></a> | |
| <?php | |
| $current_post_type = geodir_get_current_posttype(); | |
| $category_taxonomy = geodir_get_taxonomies( $current_post_type ); | |
| $terms = get_the_terms($post->id, $category_taxonomy[0]); | |
| if(!empty($terms)){ | |
| echo "<span class='geodir-category clearfix geodir-big-header-cats'>"; | |
| echo '<i class="fa fa-tags whoop-cat-i"></i>'; | |
| foreach($terms as $term){ | |
| $term = get_term_by( 'id', $term->term_id, $category_taxonomy[0]); | |
| echo "<a href='".esc_attr( get_term_link($term) ) . "'>$term->name</a>"; | |
| } | |
| echo "</span>"; | |
| } | |
| } | |
| add_action('geodir_before_review_html', 'whoop_geodir_before_review_html', 10, 2); | |
| function whoop_geodir_listview_before_article_close($post, $view) { | |
| ?> | |
| </div> | |
| <div class="geodir-whoop-address"> | |
| <?php | |
| $html =""; | |
| $cf_address = geodir_get_field_infoby('htmlvar_name','post',$post->post_type); | |
| $cf_contact = geodir_get_field_infoby('htmlvar_name','geodir_contact',$post->post_type); | |
| $cf_website = geodir_get_field_infoby('htmlvar_name','geodir_website',$post->post_type); | |
| if ($cf_address->show_on_listing == '1') { | |
| if($post->post_address){ $html .= '<span>'.$post->post_address.'</span><br>';} | |
| if($post->post_city){ $html .= '<span>'.$post->post_city.'</span>, ';} | |
| if($post->post_region){ $html .= '<span>'.$post->post_region.'</span> ';} | |
| if($post->post_zip){ $html .= '<span>'.$post->post_zip.'</span><br>';} | |
| if($post->post_country){ $html .= '<span>'.__( $post->post_country, GEODIRECTORY_FRAMEWORK ).'</span><br>';} | |
| } | |
| if ($cf_contact->show_on_listing == '1') { | |
| if ( $post->geodir_contact ) { | |
| $html .= '<span><i class="fa fa-phone"></i><a href="tel:' . $post->geodir_contact . '" target="_blank" rel="nofollow"> ' . $post->geodir_contact . '</a></span><br>'; | |
| } | |
| } | |
| if ($cf_website->show_on_listing == '1') { | |
| if ( $post->geodir_website ) { | |
| $html .= '<span><i class="fa fa-link"></i><a href="' . $post->geodir_website . '" target="_blank" rel="nofollow">' . __( ' Website', GEODIRECTORY_FRAMEWORK ) . '</a></span><br>'; | |
| } | |
| } | |
| echo $html; | |
| ?> | |
| </div> | |
| <!-- .entry-meta --> | |
| <?php //do_action('geodir_after_listing_post_excerpt', $post); ?> | |
| </div> | |
| </div> | |
| <?php | |
| } | |
| add_action('geodir_listview_before_article_close', 'whoop_geodir_listview_before_article_close', 10, 2); | |
| function whoop_geodir_listview_after_article_close($post, $view) { | |
| $args = array( | |
| 'status' => 'approve', | |
| 'number' => 1, | |
| 'parent' => 0, | |
| 'post_id' => $post->ID, // use post_id, not post_ID | |
| ); | |
| $comments = get_comments($args); | |
| if ($comments) { | |
| ?> | |
| <div class="geodir-whoop-listing-review"> | |
| <?php | |
| foreach($comments as $comment) { | |
| if ($comment->user_id) { | |
| $user_profile_url = get_author_posts_url($comment->user_id); | |
| } else { | |
| $user_profile_url = ''; | |
| } | |
| if ($user_profile_url) { | |
| echo '<a href="' . $user_profile_url . '">'; | |
| } | |
| echo get_avatar( $comment, 33 ); | |
| if ($user_profile_url) { | |
| echo '</a>'; | |
| } | |
| ?> | |
| <div> | |
| <?php echo strip_tags($comment->comment_content); ?> | |
| </div> | |
| <?php | |
| } | |
| ?> | |
| </div> | |
| <?php } | |
| } | |
| add_action('geodir_listview_after_article_close', 'whoop_geodir_listview_after_article_close', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment