SHARE
TWEET

MB Views get post type

a guest Apr 29th, 2020 10 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {% set args = {post_type: "centrum-handlowe", posts_per_page: 12, facetwp: true } %}
  2. {% set posts = mb.get_posts( args ) %}
  3. <table>
  4.     <thead>
  5.         <tr>
  6.             <th class="sort" data-sort="title">Nazwa centrum</th>
  7.             <th class="sort" data-sort="type">Rodzaj obiektu</th>
  8.             <th class="sort" data-sort="gba">GBA</th>
  9.             <th class="sort" data-sort="gla">GLA</th>
  10.             <th>Właściciel obiektu</th>
  11.             <th>Firma zarządzająca</th>
  12.             <th class="sort" data-sort="parking_place">Liczba miejsc parkingowych</th>
  13.         </tr>
  14.     </thead>
  15.     <tbody class="facetwp-template">
  16.         {% for post in posts %}
  17.         <tr>
  18.             <td class="sc-name"><a href="{{ mb.get_permalink( post ) }}">{{ post.post_title }}</a></td>
  19.             <td class="sc-type">{{ mb.get_post_meta( post.ID, 'sc_object_type_select', true ) }}</td>
  20.             <td class="sc-gba">{{ mb.number_format_i18n( mb.get_post_meta( post.ID, 'sc_gba_number', true ) ) }}</td>
  21.             <td class="sc-gla">{{ mb.number_format_i18n( mb.get_post_meta( post.ID, 'sc_gla_number', true ) ) }}</td>
  22.             <td class="sc-owner">
  23.                 {% set args = {post_type: 'firma', nopaging: true, relationship: {id: 'firma-to-centrum-handlowe', to: post.ID}} %}
  24.                 {% set company = mb.get_posts( args ) | first %}
  25.                 <a href="{{ mb.get_permalink( company ) }}">{{ company.post_title }}</a>
  26.             </td>
  27.             <td class="sc-managedby">
  28.                 {% set args = {post_type: 'firma', nopaging: true, relationship: {id: 'firma-to-centrum-handlowe-manage', to: post.ID}} %}
  29.                 {% set company = mb.get_posts( args ) | first %}
  30.                 <a href="{{ mb.get_permalink( company ) }}">{{ company.post_title }}</a>
  31.             </td>
  32.             <td class="sc-parking">{{ mb.number_format_i18n( mb.get_post_meta( post.ID, 'sc_parking_place_number', true ) ) }}</td>
  33.         </tr>
  34.         {% endfor %}
  35.     </tbody>
  36. </table>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top