function exchange_retrieve_and_store_pr_tokens() { $programme_rounds = BaseController::get_all_from_type('programme_round', 'ids'); if (empty($programme_rounds)) { return; } $prepare_store = array(); foreach ($programme_rounds as $p) { $token = get_post_meta($p, 'update_token', true); if (!empty($token) && is_string($token)) { $prepare_store[$p] = $token; } } if (!empty($prepare_store)) { set_transient('tandem_pr_token_store', $prepare_store, 12 * HOUR_IN_SECONDS); return $prepare_store; } }
function exchange_programme_rounds_parent_meta_box($post) { $parents = BaseController::get_all_from_type('programme_round'); if (!empty($parents)) { $output = '<select name="parent_id" class="widefat">'; // !Important! Don't change the 'parent_id' name attribute. $output .= '<option value="null">None</option>'; foreach ($parents as $parent) { $output .= sprintf('<option value="%s"%s>%s</option>', esc_attr($parent->ID), selected($parent->ID, $post->post_parent, false), esc_html($parent->post_title)); } $output .= '</select>'; } else { $output = __('You have to add a programme round first', 'exchange-plugin'); } echo $output; }
<section class="story__section"> <div class="section-inner"> <figure class="section__slice section__image"> <div id="programmes"> <?php $img_root = get_template_directory() . '/assets/images/'; global $post; $all_pages = BaseController::get_all_from_type('page'); $programmes = get_page_children($post->ID, $all_pages); foreach ($programmes as $page_obj) { $anchor = '<a href="#">'; if (!$page_obj instanceof WP_Post || 'publish' !== $page_obj->post_status) { continue; } else { $anchor = exchange_create_link(BaseController::exchange_factory($page_obj), false); $slug = array_search($page_obj->post_title, $GLOBALS['EXCHANGE_PLUGIN_CONFIG']['IMAGES']['programme-logos']); if (!empty($slug)) { echo $anchor . exchange_build_svg($img_root . 'svg/T_logo_' . $slug . '_WEB.svg', true) . '</a>'; } } } ?> </div> <?php if (class_exists('Caption')) { $caption_text = '<p>Building it together. Illustration copyright © Erica Brisson, 2014-15</p>'; $modifiers = array('classes' => array('text-right')); $caption = new Caption($caption_text, 'image'); $caption->publish(); } ?>