Advertisement
Guest User

Untitled

a guest
Jun 9th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.66 KB | None | 0 0
  1. function custom_listing_template() {
  2.  
  3.     global $wpsl, $wpsl_settings, $post;
  4.  
  5.     $storeID = "<%= id %>";
  6.  
  7.     $args = array(
  8.         'posts_per_page'    => -1,
  9.         'order'             => 'ASC',
  10.         'orderby'           => 'name',
  11.         'post_type'         => 'advisor',
  12.         'post_status'       => 'publish',
  13.         'meta_query' => array(
  14.            array(
  15.                'key' => '_go_digital_theme_advisor_post_extras_branch',
  16.                'value' => (int)$storeID,
  17.                'compare' => '=',
  18.            ),
  19.         ),
  20.     );
  21.  
  22.     $posts_array = get_posts( $args );
  23.  
  24.     var_dump($posts_array);
  25.    
  26.     $listing_template = '<li data-store-id="<%= id %>">' . "\r\n";
  27.         $listing_template .= "\t\t" . '<div class="wpsl-store-location">' . "\r\n";
  28.         $listing_template .= "\t\t\t" . '<p><%= thumb %>' . "\r\n";
  29.         $listing_template .= "\t\t\t\t" . wpsl_store_header_template( 'listing' ) . "\r\n"; // Check which header format we use
  30.         $listing_template .= "\t\t\t\t" . '<span class="wpsl-street"><%= address %></span>' . "\r\n";
  31.         $listing_template .= "\t\t\t\t" . '<% if ( address2 ) { %>' . "\r\n";
  32.         $listing_template .= "\t\t\t\t" . '<span class="wpsl-street"><%= address2 %></span>' . "\r\n";
  33.         $listing_template .= "\t\t\t\t" . '<% } %>' . "\r\n";
  34.         $listing_template .= "\t\t\t\t" . '<span>' . wpsl_address_format_placeholders() . '</span>' . "\r\n"; // Use the correct address format
  35.  
  36.         if ( !$wpsl_settings['hide_country'] ) {
  37.             $listing_template .= "\t\t\t\t" . '<span class="wpsl-country"><%= country %></span>' . "\r\n";
  38.         }
  39.        
  40.         $listing_template .= "\t\t\t" . '</p>' . "\r\n";
  41.        
  42.         // Show the phone, fax or email data if they exist.
  43.         if ( $wpsl_settings['show_contact_details'] ) {
  44.             $listing_template .= "\t\t\t" . '<p class="wpsl-contact-details">' . "\r\n";
  45.             $listing_template .= "\t\t\t" . '<% if ( phone ) { %>' . "\r\n";
  46.             $listing_template .= "\t\t\t" . '<span><strong>' . esc_html( $wpsl->i18n->get_translation( 'phone_label', __( 'Phone', 'wpsl' ) ) ) . '</strong>: <%= formatPhoneNumber( phone ) %></span>' . "\r\n";
  47.             $listing_template .= "\t\t\t" . '<% } %>' . "\r\n";
  48.             $listing_template .= "\t\t\t" . '<% if ( fax ) { %>' . "\r\n";
  49.             $listing_template .= "\t\t\t" . '<span><strong>' . esc_html( $wpsl->i18n->get_translation( 'fax_label', __( 'Fax', 'wpsl' ) ) ) . '</strong>: <%= fax %></span>' . "\r\n";
  50.             $listing_template .= "\t\t\t" . '<% } %>' . "\r\n";
  51.             $listing_template .= "\t\t\t" . '<% if ( email ) { %>' . "\r\n";
  52.             $listing_template .= "\t\t\t" . '<span><strong>' . esc_html( $wpsl->i18n->get_translation( 'email_label', __( 'Email', 'wpsl' ) ) ) . '</strong>: <%= email %></span>' . "\r\n";
  53.             $listing_template .= "\t\t\t" . '<% } %>' . "\r\n";
  54.             $listing_template .= "\t\t\t" . '</p>' . "\r\n";
  55.         }
  56.        
  57.         $listing_template .= "\t\t\t" . wpsl_more_info_template() . "\r\n"; // Check if we need to show the 'More Info' link and info
  58.         $listing_template .= "\t\t" . '</div>' . "\r\n";
  59.         $listing_template .= "\t\t" . '<div class="wpsl-direction-wrap">' . "\r\n";
  60.        
  61.         if ( !$wpsl_settings['hide_distance'] ) {
  62.             $listing_template .= "\t\t\t" . '<%= distance %> ' . esc_html( wpsl_get_distance_unit() ) . '' . "\r\n";
  63.         }
  64.        
  65.         $listing_template .= "\t\t\t" . '<%= createDirectionUrl() %>' . "\r\n";
  66.         $listing_template .= "\t\t" . '</div>' . "\r\n";
  67.         $listing_template .= "\t" . '</li>';
  68.  
  69.     return $listing_template;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement