{if '{stash:channel_id}'=='71' || '{stash:channel_id}'=='74'}{!-- 71 (Regions) | 74 (Sections) --} {!--Related Children Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.child_entry_id = ct.entry_id WHERE pr.parent_entry_id={stash:entry_id} AND pr.parent_field_id=562 AND ct.status!='closed' AND ct.status!='To Delete' AND ct.status!='Archived' AND ct.status!='draft' && ct.status!='To Monetize' && ct.status!='Needs Kids' && ct.status!='Quiz' && ct.status!='Quiz-Retake' && ct.status!='Visitor Guide' ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {stash:order-by}a{/stash:order-by} {stash:count-by}{count}{/stash:count-by} {/exp:query} {!--Related (Reverse) Region Parent Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date, cd.field_id_285 as list_icon FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.parent_entry_id = ct.entry_id JOIN exp_channel_data cd on ct.entry_id = cd.entry_id WHERE pr.child_entry_id={stash:entry_id} AND pr.parent_field_id=536 AND ct.status='open' ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {stash:order-by}{if list_icon}b{if:else}z{/if}{/stash:order-by} {stash:count-by}{count}{/stash:count-by} {/exp:query} {if:elseif '{stash:channel_id}'=='72'}{!-- 72 (Classification) --} {!--Related Children Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.child_entry_id = ct.entry_id WHERE pr.parent_entry_id={stash:entry_id} AND pr.parent_field_id=562 AND ct.status!='closed' AND ct.status!='To Delete' AND ct.status!='Archived' AND ct.status!='draft' && ct.status!='To Monetize' && ct.status!='Needs Kids' && ct.status!='Quiz' && ct.status!='Quiz-Retake' && ct.status!='Visitor Guide' ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {stash:order-by}a{/stash:order-by} {stash:count-by}{count}{/stash:count-by} {/exp:query} {if '{last_segment}'!='tours' && '{last_segment}'!='accommodations'} {!--Related (Reverse) Region Parent Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date, cd.field_id_285 as list_icon FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.parent_entry_id = ct.entry_id JOIN exp_channel_data cd on ct.entry_id = cd.entry_id WHERE pr.child_entry_id={stash:entry_id} AND (pr.parent_field_id=535 OR pr.parent_field_id=601) AND ct.status='open' ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {stash:order-by}{if list_icon}b{if:else}z{/if}{/stash:order-by} {stash:count-by}{count}{/stash:count-by} {/exp:query} {/if}{!--not tours or accommodations--} {if:elseif '{stash:channel_id}'=='88' || '{stash:channel_id}'=='142'}{!-- Subclass & Store--} {if '{segment_1}'=='store'} {!--Related (Reverse) SubClassification Parent Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.parent_entry_id = ct.entry_id WHERE pr.child_entry_id={stash:entry_id} AND (pr.parent_field_id=601 OR pr.parent_field_id=535 OR pr.parent_field_id=880) AND ct.channel_id!=98 AND ct.channel_id!=77 AND ct.channel_id!=116 AND ct.channel_id!=124 AND (ct.status='open' OR ct.status='Accommodation') ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {/exp:query} {if:else} {!--Related Children Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.child_entry_id = ct.entry_id WHERE pr.parent_entry_id={stash:entry_id} AND pr.parent_field_id=562 AND ct.status!='closed' AND ct.status!='To Delete' AND ct.status!='Archived' AND ct.status!='draft' AND ct.status!='Quiz' AND ct.status!='Quiz-Retake' AND ct.status!='Visitor Guide' ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {stash:order-by}a{/stash:order-by} {stash:count-by}{count}{/stash:count-by} {/exp:query} {!--Related (Reverse) Region Parent Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date, cd.field_id_285 as list_icon FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.parent_entry_id = ct.entry_id JOIN exp_channel_data cd on ct.entry_id = cd.entry_id WHERE pr.child_entry_id={stash:entry_id} AND (pr.parent_field_id=535 OR pr.parent_field_id=601) AND ct.status!='closed' AND ct.status!='To Delete' AND ct.status!='Archived' AND ct.status!='draft' && ct.status!='To Monetize' && ct.status!='Needs Kids' && ct.status!='Quiz' && ct.status!='Quiz-Retake' && ct.status!='Visitor Guide' ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {stash:order-by}{if list_icon}b{if:else}z{/if}{/stash:order-by} {stash:count-by}{count}{/stash:count-by} {/exp:query} {/if}{!--store--} {if:elseif '{stash:channel_id}'=='85'} {if '{last_segment}'=='articles'} {!--Related Children Articles Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.child_entry_id = ct.entry_id WHERE pr.parent_entry_id={stash:entry_id} AND (pr.parent_field_id=562 OR pr.parent_field_id=555) AND ct.status!='closed' AND ct.status!='To Delete' AND ct.status!='Archived' AND ct.status!='draft' && ct.status!='To Monetize' && ct.status!='Needs Kids' && ct.status!='Quiz' && ct.status!='Quiz-Retake' && ct.status!='Visitor Guide' ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {stash:order-by}a{/stash:order-by} {stash:count-by}{count}{/stash:count-by} {/exp:query} {/if}{!--articles} {!--Related (Reverse) Parent Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date, cd.field_id_285 as list_icon FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.parent_entry_id = ct.entry_id JOIN exp_channel_data cd on ct.entry_id = cd.entry_id WHERE pr.child_entry_id={stash:entry_id} AND (pr.parent_field_id=591 OR pr.parent_field_id=595) AND ct.status='open' ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {stash:order-by}{if list_icon}b{if:else}z{/if}{/stash:order-by} {stash:count-by}{count}{/stash:count-by} {/exp:query} {if:elseif '{stash:channel_id}'=='73'}{!--hub-listings--} {if '{exp:stash:related-children-check}'=='yes'} {!--Related Children Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.child_entry_id = ct.entry_id WHERE pr.parent_entry_id={stash:entry_id} AND pr.parent_field_id=562 AND (ct.status!='closed' AND ct.status!='To Delete' AND ct.status!='Archived' AND ct.status!='draft' && ct.status!='To Monetize' && ct.status!='Needs Kids' && ct.status!='Quiz' && ct.status!='Quiz-Retake' && ct.status!='Visitor Guide') ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {stash:order-by}a{/stash:order-by} {stash:count-by}{count}{/stash:count-by} {/exp:query} {!--Related (Reverse) Region Parent Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date, cd.field_id_285 as list_icon FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.parent_entry_id = ct.entry_id JOIN exp_channel_data cd on ct.entry_id = cd.entry_id WHERE pr.child_entry_id={stash:entry_id} AND (pr.parent_field_id=535 OR pr.parent_field_id=601) AND ct.status!='closed' AND ct.status!='To Delete' AND ct.status!='Archived' AND ct.status!='draft' && ct.status!='To Monetize' && ct.status!='Needs Kids' && ct.status!='Quiz' && ct.status!='Quiz-Retake' && ct.status!='Visitor Guide' ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {stash:order-by}{if list_icon}b{if:else}z{/if}{/stash:order-by} {stash:count-by}{count}{/stash:count-by} {/exp:query} {if:elseif '{exp:stash:subclass-check}'=='yes'} {!--Related Children Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date, ct.status as status FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.child_entry_id = ct.entry_id WHERE pr.parent_entry_id={stash:entry_id} AND pr.parent_field_id=562 AND ct.status!='closed' AND ct.status!='To Delete' AND ct.status!='Archived' AND ct.status!='draft' && ct.status!='To Monetize' && ct.status!='Needs Kids' && ct.status!='Quiz' && ct.status!='Quiz-Retake' && ct.status!='Visitor Guide' ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {stash:order-by}a{/stash:order-by} {stash:count-by}{count}{/stash:count-by} {/exp:query} {if:else} {!--Related Children Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.child_entry_id = ct.entry_id WHERE pr.parent_entry_id={stash:entry_id} AND pr.parent_field_id=562 AND ct.status!='closed' AND ct.status!='To Delete' AND ct.status!='Archived' AND ct.status!='draft' && ct.status!='Quiz' && ct.status!='Quiz-Retake' && ct.status!='Visitor Guide' ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {stash:order-by}a{/stash:order-by} {stash:count-by}{count}{/stash:count-by} {/exp:query} {!--Related (Reverse) Region Parent Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date, cd.field_id_285 as list_icon FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.parent_entry_id = ct.entry_id JOIN exp_channel_data cd on ct.entry_id = cd.entry_id WHERE pr.child_entry_id={stash:entry_id} AND (pr.parent_field_id=535 OR pr.parent_field_id=601) AND ct.status!='closed' AND ct.status!='To Delete' AND ct.status!='Archived' AND ct.status!='draft' && ct.status!='To Monetize' && ct.status!='Needs Kids' && ct.status!='Quiz' && ct.status!='Quiz-Retake' && ct.status!='Visitor Guide' ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {stash:order-by}{if list_icon}b{if:else}z{/if}{/stash:order-by} {stash:count-by}{count}{/stash:count-by} {/exp:query} {/if}{!--subclass_--} {if:else} {!--Related Children Entries--} {exp:query sql="SELECT ct.entry_id as list_id, ct.title as list_title, ct.edit_date as date FROM exp_playa_relationships pr JOIN exp_channel_titles ct on pr.child_entry_id = ct.entry_id WHERE pr.parent_entry_id={stash:entry_id} AND pr.parent_field_id=562 AND ct.status!='closed' AND ct.status!='To Delete' AND ct.status!='Archived' AND ct.status!='draft' && ct.status!='To Monetize' && ct.status!='Needs Kids' && ct.status!='Quiz' && ct.status!='Quiz-Retake' && ct.status!='Visitor Guide' ORDER BY pr.rel_id ASC "} {stash:the-id}{list_id}{/stash:the-id} {stash:order-by}a{/stash:order-by} {stash:count-by}{count}{/stash:count-by} {/exp:query} {/if}