/**
  *
  *
  * @since 1.1.3
  * */
 function add_breadcrumb($sep)
 {
     $bc_show_location_url = st()->get_option('bc_show_location_url', 'on');
     $location_id = get_post_meta(get_the_ID(), 'id_location', TRUE);
     if (!$location_id) {
         $location_id = get_post_meta(get_the_ID(), 'location_id', TRUE);
     }
     $array = array();
     $parents = get_post_ancestors($location_id);
     if (!empty($parents) and is_array($parents)) {
         foreach ($parents as $key => $value) {
             $link = get_home_url('/');
             if ($bc_show_location_url == 'on') {
                 $post_type = get_post_type();
                 $page_search = st_get_page_search_result($post_type);
                 if (!empty($page_search)) {
                     $link = esc_url(add_query_arg(array('page_id' => $page_search, 'location_id' => $value, 'location_name' => get_the_title($value)), $link));
                 } else {
                     $link = esc_url(add_query_arg(array('post_type' => get_post_type(), 's' => '', 'location_id' => $value, 'location_name' => get_the_title($value)), $link));
                 }
             } else {
                 $link = get_permalink($value);
             }
             echo '<li><a href="' . $link . '">' . get_the_title($value) . '</a></li>';
         }
     }
     //var_dump($location_id);
     if ($location_id) {
         $link = get_home_url('/');
         if ($bc_show_location_url == 'on') {
             $post_type = get_post_type();
             $page_search = st_get_page_search_result($post_type);
             if (!empty($page_search)) {
                 $link = esc_url(add_query_arg(array('page_id' => $page_search, 'location_id' => $location_id, 'location_name' => get_the_title($location_id)), $link));
             } else {
                 $link = esc_url(add_query_arg(array('post_type' => get_post_type(), 's' => '', 'location_id' => $location_id, 'location_name' => get_the_title($location_id)), $link));
             }
         } else {
             $link = get_permalink($value);
         }
         echo '<li><a href="' . $link . '">' . get_the_title($location_id) . '</a></li>';
     }
 }
예제 #2
0
$col = 12 / $st_col;
if ($st_type == 'st_cars') {
    $location_text = 'location_id_pick_up';
} else {
    $location_text = 'location_id';
}
while (have_posts()) {
    the_post();
    ?>
        <div class="col-md-<?php 
    echo esc_attr($col);
    ?>
 col-sm-6 col-xs-12 loop-normal ">
            <div class="thumb">
                <?php 
    $page_search = st_get_page_search_result($st_type);
    if (!empty($page_search) and get_post_type($page_search) == 'page') {
        $link = add_query_arg(array($location_text => get_the_ID()), get_the_permalink($page_search));
    } else {
        $link = add_query_arg(array('s' => '', 'post_type' => $st_type, $location_text => get_the_ID()), home_url('/'));
    }
    if ($link_to == 'single') {
        $link = get_the_permalink();
    }
    ?>
                <a class="hover-img" href="<?php 
    echo esc_url($link);
    ?>
">
                    <?php 
    $img = get_the_post_thumbnail(get_the_ID(), array(800, 600, 'bfi_thumb' => true));
예제 #3
0
 /**
  *
  *
  * @since 1.1.3
  * */
 function add_breadcrumb($sep)
 {
     $bc_show_location_url = st()->get_option('bc_show_location_url', 'on');
     $location_id = get_post_meta(get_the_ID(), 'id_location', true);
     if (!$location_id) {
         $location_id = get_post_meta(get_the_ID(), 'location_id', true);
     }
     if (!$location_id) {
         $location_string = get_post_meta(get_the_ID(), 'multi_location', true);
         if (!is_array($location_string)) {
             $location_array = explode(",", $location_string);
         } elseif (is_array($location_string)) {
             $location_array = $location_string;
         }
         $location_id = array();
         if (is_array($location_array) and !empty($location_array)) {
             foreach ($location_array as $key => $value) {
                 $var = str_replace("_", "", $value);
                 $location_id[] = $var;
             }
         }
         $location_id = $location_id[0];
         // from 1.1.7 default get first location item child
     }
     $array = array();
     $parents = get_post_ancestors($location_id);
     if (!empty($parents) and is_array($parents)) {
         for ($i = count($parents) - 1; $i >= 0; $i--) {
             $value = $parents[$i];
             $link = get_home_url('/');
             if ($bc_show_location_url == 'on') {
                 $post_type = get_post_type();
                 $page_search = st_get_page_search_result($post_type);
                 if (!empty($page_search) and get_post_type($page_search) == 'page') {
                     $link = esc_url(add_query_arg(array('location_id' => $value, 'location_name' => get_the_title($value)), get_permalink($page_search)));
                 } else {
                     $link = esc_url(add_query_arg(array('post_type' => get_post_type(), 's' => '', 'location_id' => $value, 'location_name' => get_the_title($value)), $link));
                 }
             } else {
                 $link = get_permalink($value);
             }
             echo '<li><a href="' . $link . '">' . get_the_title($value) . '</a></li>';
         }
     }
     if ($location_id) {
         $link = get_home_url('/');
         if ($bc_show_location_url == 'on') {
             $post_type = get_post_type();
             $page_search = st_get_page_search_result($post_type);
             if (!empty($page_search) and get_post_type($page_search) == 'page') {
                 $link = esc_url(add_query_arg(array('page_id' => $page_search, 'location_id' => $location_id, 'location_name' => get_the_title($location_id)), $link));
             } else {
                 $link = esc_url(add_query_arg(array('post_type' => get_post_type(), 's' => '', 'location_id' => $location_id, 'location_name' => get_the_title($location_id)), $link));
             }
         } else {
             $link = get_permalink($location_id);
         }
         echo '<li><a href="' . $link . '">' . get_the_title($location_id) . '</a></li>';
     }
 }