本文整理匯總了PHP中BaseController::get_all_from_type方法的典型用法代碼示例。如果您正苦於以下問題:PHP BaseController::get_all_from_type方法的具體用法?PHP BaseController::get_all_from_type怎麽用?PHP BaseController::get_all_from_type使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BaseController
的用法示例。
在下文中一共展示了BaseController::get_all_from_type方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: exchange_retrieve_and_store_pr_tokens
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;
}
}
示例2: exchange_programme_rounds_parent_meta_box
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;
}
示例3: get_template_directory
<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();
}
?>