Advertisement
carlh1

sozocial_index.php

Mar 11th, 2013
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * AIT WordPress Theme
  5. *
  6. * Copyright (c) 2012, Affinity Information Technology, s.r.o. (http://ait-themes.com)
  7. */
  8.  
  9. // directory search
  10. $latteParams['type'] = (isset($_GET['dir-search']) && isset($_GET['s'])) ? true : false;
  11. if($latteParams['type']){
  12. // show all items on map
  13. if(isset($aitThemeOptions->search->searchShowMap)){
  14. $radius = array();
  15. if(isset($_GET['geo'])){
  16. $radius[] = $_GET['geo-radius'];
  17. $radius[] = $_GET['geo-lat'];
  18. $radius[] = $_GET['geo-lng'];
  19. }
  20. $latteParams['items'] = getItems(intval($_GET['categories']),intval($_GET['locations']),$GLOBALS['wp_query']->query_vars['s'],$radius);
  21. }
  22.  
  23. $posts = $wp_query->posts;
  24. foreach ($posts as $item) {
  25. $item->link = get_permalink($item->ID);
  26. $image = wp_get_attachment_image_src( get_post_thumbnail_id($item->ID) );
  27. if($image !== false){
  28. $item->thumbnailDir = $image[0];
  29. } else {
  30. $item->thumbnailDir = $aitThemeOptions->directory->defaultItemImage;
  31. }
  32. $item->excerptDir = aitGetPostExcerpt($item->post_excerpt,$item->post_content);
  33. }
  34.  
  35. $latteParams['posts'] = $posts;
  36.  
  37. } else {
  38.  
  39. $latteParams['posts'] = WpLatte::createPostEntity($GLOBALS['wp_query']->posts);
  40.  
  41. // if this is "Blog" page get the right template
  42. if($GLOBALS['wp_query']->is_home && $GLOBALS['wp_query']->is_posts_page){
  43. $template = get_page_template();
  44. if($template = apply_filters('template_include', $template)){
  45. if(substr($template, -8, 8) != 'page.php'){
  46. require_once $template;
  47. return; // ends executing this script
  48. }
  49. }
  50. }
  51.  
  52. // no page was selected for "Posts page" from WP Admin in Settings->Reading
  53. $latteParams['isIndexPage'] = true;
  54.  
  55. if(isset($GLOBALS['wp_query']->queried_object)){
  56.  
  57. $latteParams['post'] = WpLatte::createPostEntity(
  58. $GLOBALS['wp_query']->queried_object,
  59. array(
  60. 'meta' => $GLOBALS['pageOptions'],
  61. ));
  62.  
  63. $latteParams['isIndexPage'] = false;
  64. }
  65.  
  66. }
  67.  
  68. WPLatte::createTemplate(basename(__FILE__, '.php'), $latteParams)->render();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement