本文整理汇总了PHP中wp_sprintf函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_sprintf函数的具体用法?PHP wp_sprintf怎么用?PHP wp_sprintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_sprintf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wplf_send_email_copy
function wplf_send_email_copy($return)
{
// do nothing if form validation failed
if (!$return->ok) {
return;
}
$form_id = intval($_POST['_form_id']);
// _form_id is already validated and we know it exists by this point
$form_title = esc_html(get_the_title($form_id));
$form_meta = get_post_meta($form_id);
$referrer = esc_url_raw($_POST['referrer']);
if (isset($form_meta['_wplf_email_copy_enabled']) && $form_meta['_wplf_email_copy_enabled'][0]) {
$to = isset($form_meta['_wplf_email_copy_to']) ? $form_meta['_wplf_email_copy_to'][0] : get_option('admin_email');
$subject = wp_sprintf(__('New submission from %s', 'wp-libre-form'), $referrer);
$content = wp_sprintf(__('Form "%s" (ID %d) was submitted with values below: ', 'wp-libre-form'), $form_title, $form_id);
$content = apply_filters('wplf_email_copy_content_start', $content, $form_title, $form_id) . "\n\n";
foreach ($_POST as $key => $value) {
if ('_' === $key[0]) {
continue;
}
if (is_array($value)) {
// in case input type="radio" submits an array
$value = implode(', ', $value);
}
$content .= esc_html($key) . ': ' . esc_html(print_r($value, true)) . "\n";
}
wp_mail(apply_filters('wplf_email_copy_to', $to), apply_filters('wplf_email_copy_subject', $subject), apply_filters('wplf_email_copy_content', $content), apply_filters('wplf_email_copy_headers', ''), apply_filters('wplf_email_copy_attachments', array()));
}
}
示例2: sanitize_settings
protected function sanitize_settings()
{
$this->sanitize_setting('bool', 'default', __('Default Blacklist', 'better-wp-security'));
$this->sanitize_setting('bool', 'enable_ban_lists', __('Ban Lists', 'better-wp-security'));
$this->sanitize_setting('newline-separated-ips', 'host_list', __('Ban Hosts', 'better-wp-security'));
if (is_array($this->settings['host_list'])) {
require_once ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-ip-tools.php';
$whitelisted_hosts = array();
$current_ip = ITSEC_Lib::get_ip();
foreach ($this->settings['host_list'] as $host) {
if (is_user_logged_in() && ITSEC_Lib_IP_Tools::intersect($current_ip, ITSEC_Lib_IP_Tools::ip_wild_to_ip_cidr($host))) {
$this->set_can_save(false);
/* translators: 1: input name, 2: invalid host */
$this->add_error(sprintf(__('The following host in %1$s matches your current IP and cannot be banned: %2$s', 'better-wp-security'), __('Ban Hosts', 'better-wp-security'), $host));
continue;
}
if (ITSEC_Lib::is_ip_whitelisted($host)) {
$whitelisted_hosts[] = $host;
}
}
if (!empty($whitelisted_hosts)) {
$this->set_can_save(false);
/* translators: 1: input name, 2: invalid host list */
$this->add_error(wp_sprintf(_n('The following IP in %1$s is whitelisted and cannot be banned: %2$l', 'The following IPs in %1$s are whitelisted and cannot be banned: %2$l', count($whitelisted_hosts), 'better-wp-security'), __('Ban Hosts', 'better-wp-security'), $whitelisted_hosts));
}
}
$this->sanitize_setting(array($this, 'sanitize_agent_list_entry'), 'agent_list', __('Ban User Agents', 'better-wp-security'));
}
示例3: on_activate
/**
* Check some thinks on plugin activation
*
* @since 0.0.1
* @access public
* @static
* @return void
*/
public static function on_activate()
{
// check WordPress version
if (!version_compare($GLOBALS['wp_version'], '4.0', '>=')) {
deactivate_plugins(RW_Distributed_Profile_Server::$plugin_filename);
die(wp_sprintf('<strong>%s:</strong> ' . __('This plugin requires WordPress 4.0 or newer to work', RW_Site_Config::get_textdomain()), RW_Site_Config::get_plugin_data('Name')));
}
// check php version
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
deactivate_plugins(RW_Site_Config::$plugin_filename);
die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires PHP 5.3 or newer to work. Your current PHP version is %1s, please update.', RW_Site_Config::get_textdomain()), RW_Site_Config::get_plugin_data('Name'), PHP_VERSION));
}
if (defined('RW_SITE_CONFIG_PLUGINS_CONFIG')) {
if (false === get_site_option('rw_site_config_plugins')) {
$plugins = unserialize(RW_SITE_CONFIG_PLUGINS_CONFIG);
update_site_option('rw_site_config_plugins', $plugins);
}
}
if (defined('RW_SITE_CONFIG_OPTIONS_CONFIG')) {
if (false === get_site_option('rw_site_config_options')) {
$options = unserialize(RW_SITE_CONFIG_OPTIONS_CONFIG);
update_site_option('rw_site_config_options', $options);
}
}
}
示例4: widget
/**
* Outputs the content of the widget
*
* @param array $args
* @param array $instance
*/
public function widget($args, $instance) {
$title = apply_filters('widget_title', $instance['title']);
$more_link = apply_filters('widget_more_link', $instance['more_link']);
$visibility_count = apply_filters('widget_visibility_count', $instance['visibility_count']);
$scrollbar = apply_filters('widget_scrollbar', $instance['scrollbar']);
echo $args['before_widget'];
echo '<div class="event-widget">';
if (!empty($instance['title'])) {
echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
}
$events_per_page = empty($scrollbar) ? $visibility_count:20;
$events = get_posts(array('post_type' => 'event', 'posts_per_page' => $events_per_page));
$hasScroll = !empty($scrollbar) ? 'hasScroll':'';
$eventHtml = '<div class="content events '.$hasScroll.'">';
foreach ($events as $event) {
$attachment_id = get_post_thumbnail_id($event->ID);
$featured_image = wp_get_attachment_url($attachment_id);
//$featured_image = get_the_post_thumbnail($event->ID,array(64,64),array('class'=>'events-list-img'));
$featured_image = empty($attachment_id) ? get_stylesheet_directory_uri().'/images/default-event.png': $featured_image;
$link = get_permalink($event->ID);
$title = wp_trim_words($event->post_title, 10, '...');
$event_start_date = get_field('event_start_date_time',$event->ID);
$event_s_d = date('M d, Y', strtotime($event_start_date));
$event_s_d_2 = date('Y-m-d', strtotime($event_start_date));
$event_s_d_1 = date_create($event_s_d_2);
$event_end_date = get_field('event_end_date_time',$event->ID);
$event_e_d = date('M d, Y', strtotime($event_end_date));
$event_e_d_2 = date('Y-m-d', strtotime($event_end_date));
$event_e_d_1 = date_create($event_e_d_2);
$event_date_diff = date_diff($event_e_d_1, $event_s_d_1);
$event_date_diff_for =$event_date_diff->format("%R%a");
$pcontent = wp_trim_words($event->post_content, 8, '...');
$eventHtml .= '<div class="events-list">';
$eventHtml .= sprintf('<img class="events-list-img" src="%2$s" alt="%1$s" />', $event->post_title, $featured_image);
if($event_date_diff_for == "+0"){
$eventHtml .= sprintf('<p class="events-date">%1$s</p>', $event_s_d);
}else{
$eventHtml .= sprintf('<p class="events-date">%1$s - %2$s</p>', $event_s_d, $event_e_d);
}
$eventHtml .= sprintf('<a href="%2$s" title="%1$s" class="events-list-title">%1$s</a>', $title, $link);
$eventHtml .= sprintf('<p class="events-list-excerpt">%1$s</p>', $pcontent);
$eventHtml .= sprintf('<a class="link-box" href="%2$s" title="%1$s" class="events-list-title"></a>', $title, $link);
$eventHtml .= '</div>';
}
$eventHtml .= '</div>';
echo $eventHtml;
if(!empty($more_link)){
echo wp_sprintf('<div class="event-wfooter more-links"><a class="readmore" href="%s" title="More Events">More Events</a></div>',$more_link);
}
echo '</div>';
echo $args['after_widget'];
}
示例5: onPluginActivation
static function onPluginActivation()
{
if (phpVersionSupported()) {
if (!WpLinkedDataInitializer::isPeclHttpInstalled()) {
add_option('show_pecl_http_missing_warning', true);
}
} else {
deactivate_plugins(__FILE__);
wp_die(wp_sprintf('%1s: ' . __('Sorry, This plugin has taken a bold step in requiring PHP 5.3.0+. Your server is currently running PHP %2s, Please bug your host to upgrade to a recent version of PHP which is less bug-prone.', 'wp-linked-data'), __FILE__, PHP_VERSION));
}
}
示例6: on_activate
/**
* Check some thinks on plugin activation
*
* @since 0.0.1
* @access public
* @static
* @return void
*/
public static function on_activate()
{
// check WordPress version
if (!version_compare($GLOBALS['wp_version'], '4.0', '>=')) {
deactivate_plugins(RW_More_Rpi_Virtuell_Widget::$plugin_filename);
die(wp_sprintf('<strong>%s:</strong> ' . __('This plugin requires WordPress 4.0 or newer to work', RW_More_Rpi_Virtuell_Widget::get_textdomain()), RW_More_Rpi_Virtuell_Widget::get_plugin_data('Name')));
}
// check php version
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
deactivate_plugins(RW_More_Rpi_Virtuell_Widget::$plugin_filename);
die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires PHP 5.3 or newer to work. Your current PHP version is %1s, please update.', RW_More_Rpi_Virtuell_Widget::get_textdomain()), RW_More_Rpi_Virtuell_Widget::get_plugin_data('Name'), PHP_VERSION));
}
}
开发者ID:rpi-virtuell,项目名称:rw-more-rpi-virtuell-widget,代码行数:21,代码来源:RW_More_Rpi_Virtuell_Widget_Installation.php
示例7: on_activate
/**
* Check some thinks on plugin activation
*
* @since 0.0.1
* @access public
* @static
* @return void
*/
public static function on_activate()
{
// check WordPress version
if (!version_compare($GLOBALS['wp_version'], '4.0', '>=')) {
deactivate_plugins(RW_Group_Blogs::$plugin_filename);
die(wp_sprintf('<strong>%s:</strong> ' . __('This plugin requires WordPress 4.0 or newer to work', RW_Group_Blogs::get_textdomain()), RW_Group_Blogs::get_plugin_data('Name')));
}
// check php version
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
deactivate_plugins(RW_Group_Blogs::$plugin_filename);
die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires PHP 5.3 or newer to work. Your current PHP version is %1s, please update.', RW_Group_Blogs::get_textdomain()), RW_Group_Blogs::get_plugin_data('Name'), PHP_VERSION));
}
wp_schedule_event(time(), 'hourly', 'rw_group_blogs_cron');
}
示例8: on_activate
/**
* Check some thinks on plugin activation
*
* @since 0.0.1
* @access public
* @static
* @return void
*/
public static function on_activate()
{
// check WordPress version
if (!version_compare($GLOBALS['wp_version'], '4.0', '>=')) {
deactivate_plugins(RW_Demo_Plugin::$plugin_filename);
//@TODO Klassename
die(wp_sprintf('<strong>%s:</strong> ' . __('This plugin requires WordPress 4.0 or newer to work', RW_Demo_Plugin::get_textdomain()), RW_Demo_Plugin::get_plugin_data('Name')));
}
// check php version
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
deactivate_plugins(RW_Demo_Plugin::$plugin_filename);
// @TODO Klassenanme
die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires PHP 5.3 or newer to work. Your current PHP version is %1s, please update.', RW_Demo_Plugin::get_textdomain()), RW_Demo_Plugin::get_plugin_data('Name'), PHP_VERSION));
}
// check buddypress @TODO Nur wenn BuddyPress activity für das Plugin nötig ist
if (!function_exists('bp_activities')) {
deactivate_plugins(RW_Demo_Plugin::$plugin_filename);
//@TODO Klassenname
die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires BuddyPress to work.', RW_Sticky_Activity::get_textdomain()), RW_Sticky_Activity::get_plugin_data('Name'), PHP_VERSION));
}
// @TODO Hier weitere Checks einbaun die das Plugin ggf als Abhängigkeiten hat. MU, bbPress usw
}
示例9: show_activation_message
public function show_activation_message()
{
$new_packages = $GLOBALS['ithemes-updater-settings']->get_new_packages();
if (empty($new_packages)) {
return;
}
natcasesort($new_packages);
require_once $GLOBALS['ithemes_updater_path'] . '/functions.php';
$names = array();
foreach ($new_packages as $package) {
$names = Ithemes_Updater_Functions::get_package_name($package);
}
if (is_multisite() && is_network_admin()) {
$url = network_admin_url('settings.php') . "?page={$this->page_name}";
} else {
$url = admin_url('options-general.php') . "?page={$this->page_name}";
}
echo '<div class="updated fade"><p>' . wp_sprintf(__('To receive automatic updates for %l, use the <a href="%s">iThemes Licensing</a> page found in the Settings menu.', 'it-l10n-Builder-Madison'), $names, $url) . '</p></div>';
$GLOBALS['ithemes-updater-settings']->update_packages();
}
示例10: admin_page_load
//.........这里部分代码省略.........
case 'verify_secrets_mismatch':
$error = esc_html($error);
$this->error = sprintf(__("<strong>Your Jetpack has a glitch.</strong> Something went wrong that’s never supposed to happen. Guess you’re just lucky: %s", 'jetpack'), "<code>{$error}</code>");
if (!Jetpack::is_active()) {
$this->error .= '<br />';
$this->error .= sprintf(__('Try connecting again.', 'jetpack'));
}
break;
}
$message_code = Jetpack::state('message');
$active_state = Jetpack::state('activated_modules');
if (!empty($active_state)) {
$available = Jetpack::get_available_modules();
$active_state = explode(',', $active_state);
$active_state = array_intersect($active_state, $available);
if (count($active_state)) {
foreach ($active_state as $mod) {
$this->stat('module-activated', $mod);
}
} else {
$active_state = false;
}
}
switch ($message_code) {
case 'modules_activated':
$this->message = sprintf(__('Welcome to <strong>Jetpack %s</strong>!', 'jetpack'), JETPACK__VERSION);
if ($active_state) {
$titles = array();
foreach ($active_state as $mod) {
if ($mod_headers = Jetpack::get_module($mod)) {
$titles[] = '<strong>' . preg_replace('/\\s+(?![^<>]++>)/', ' ', $mod_headers['name']) . '</strong>';
}
}
if ($titles) {
$this->message .= '<br /><br />' . wp_sprintf(__('The following new modules have been activated: %l.', 'jetpack'), $titles);
}
}
if ($reactive_state = Jetpack::state('reactivated_modules')) {
$titles = array();
foreach (explode(',', $reactive_state) as $mod) {
if ($mod_headers = Jetpack::get_module($mod)) {
$titles[] = '<strong>' . preg_replace('/\\s+(?![^<>]++>)/', ' ', $mod_headers['name']) . '</strong>';
}
}
if ($titles) {
$this->message .= '<br /><br />' . wp_sprintf(__('The following modules have been updated: %l.', 'jetpack'), $titles);
}
}
break;
case 'module_activated':
if ($module = Jetpack::get_module(Jetpack::state('module'))) {
$this->message = sprintf(__('<strong>%s Activated!</strong> You can deactivate at any time by clicking Learn More and then Deactivate on the module card.', 'jetpack'), $module['name']);
$this->stat('module-activated', Jetpack::state('module'));
}
break;
case 'module_deactivated':
if ($module = Jetpack::get_module(Jetpack::state('module'))) {
$this->message = sprintf(__('<strong>%s Deactivated!</strong> You can activate it again at any time using the activate button on the module card.', 'jetpack'), $module['name']);
$this->stat('module-deactivated', Jetpack::state('module'));
}
break;
case 'module_configured':
$this->message = __('<strong>Module settings were saved.</strong> ', 'jetpack');
break;
case 'already_authorized':
$this->message = __('<strong>Your Jetpack is already connected.</strong> ', 'jetpack');
break;
case 'authorized':
$this->message = __("<strong>You’re fueled up and ready to go.</strong> ", 'jetpack');
$this->message .= "<br />\n";
$this->message .= __('The features below are now active. Click the learn more buttons to explore each feature.', 'jetpack');
break;
}
$deactivated_plugins = Jetpack::state('deactivated_plugins');
if (!empty($deactivated_plugins)) {
$deactivated_plugins = explode(',', $deactivated_plugins);
$deactivated_titles = array();
foreach ($deactivated_plugins as $deactivated_plugin) {
if (!isset($this->plugins_to_deactivate[$deactivated_plugin])) {
continue;
}
$deactivated_titles[] = '<strong>' . str_replace(' ', ' ', $this->plugins_to_deactivate[$deactivated_plugin][1]) . '</strong>';
}
if ($deactivated_titles) {
if ($this->message) {
$this->message .= "<br /><br />\n";
}
$this->message .= wp_sprintf(_n('Jetpack contains the most recent version of the old %l plugin.', 'Jetpack contains the most recent versions of the old %l plugins.', count($deactivated_titles), 'jetpack'), $deactivated_titles);
$this->message .= "<br />\n";
$this->message .= _n('The old version has been deactivated and can be removed from your site.', 'The old versions have been deactivated and can be removed from your site.', count($deactivated_titles), 'jetpack');
}
}
if ($this->message || $this->error) {
add_action('jetpack_notices', array(&$this, 'admin_notices'));
}
if (isset($_GET['configure']) && Jetpack::is_module($_GET['configure'])) {
do_action('jetpack_module_configuration_load_' . $_GET['configure']);
}
add_filter('jetpack_short_module_description', 'wptexturize');
}
示例11: jetpack_shortcodes_more_info_connected
function jetpack_shortcodes_more_info_connected()
{
?>
<div class="jp-info-img">
<a href="http://en.support.wordpress.com/shortcodes/">
<img class="jp-info-img" src="<?php
echo plugins_url(basename(dirname(dirname(__FILE__))) . '/_inc/images/screenshots/shortcodes.png');
?>
" alt="<?php
esc_attr_e('Shortcode Embeds', 'jetpack');
?>
" width="300" height="150" />
</a>
</div>
<h4><?php
esc_html_e('Shortcode Embeds', 'jetpack');
?>
</h4>
<p><?php
esc_html_e('Shortcodes allow you to easily and safely embed media from other places in your site. With just one simple code, you can tell WordPress to embed YouTube, Flickr, and other media.', 'jetpack');
?>
</p>
<p><?php
esc_html_e('Enter a shortcode directly into the Post/Page editor to embed media. For specific instructions follow the links below.', 'jetpack');
?>
</p>
<?php
$codes = array('archives' => 'http://support.wordpress.com/archives-shortcode/', 'audio' => 'http://support.wordpress.com/audio/', 'blip.tv' => 'http://support.wordpress.com/videos/bliptv/', 'dailymotion' => 'http://support.wordpress.com/videos/dailymotion/', 'flickr' => 'http://support.wordpress.com/videos/flickr-video/', 'scribd' => 'http://support.wordpress.com/scribd/', 'slideshare' => 'http://support.wordpress.com/slideshows/slideshare/', 'soundcloud' => 'http://support.wordpress.com/audio/soundcloud-audio-player/', 'vimeo' => 'http://support.wordpress.com/videos/vimeo/', 'youtube' => 'http://support.wordpress.com/videos/youtube/', 'polldaddy' => 'http://support.polldaddy.com/wordpress-shortcodes/');
$codes['wpvideo (VideoPress)'] = 'http://en.support.wordpress.com/videopress/';
$available = '';
foreach ($codes as $code => $url) {
$available[] = '<a href="' . $url . '" target="_blank">[' . $code . ']</a>';
}
?>
<p><?php
echo wp_sprintf(esc_html__('Available shortcodes are: %l.', 'jetpack'), $available);
?>
</p>
<?php
}
示例12: geodir_pagination
/**
* Returns paginated HTML string based on the given parameters.
*
* @since 1.0.0
* @since 1.5.5 Fixed pagination links when location selected.
* @package GeoDirectory
* @global object $wpdb WordPress Database object.
* @global object $wp_query WordPress Query object.
* @param string $before The HTML to prepend.
* @param string $after The HTML to append.
* @param string $prelabel The previous link label.
* @param string $nxtlabel The next link label.
* @param int $pages_to_show Number of pages to display on the pagination. Default: 5.
* @param bool $always_show Do you want to show the pagination always? Default: false.
*/
function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false)
{
global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
if (empty($prelabel)) {
$prelabel = '<strong>«</strong>';
}
if (empty($nxtlabel)) {
$nxtlabel = '<strong>»</strong>';
}
$half_pages_to_show = round($pages_to_show / 2);
if (geodir_is_page('home') || get_option('geodir_set_as_home') && is_home()) {
// dont apply default pagination for geodirectory home page.
return;
}
if (!is_single()) {
if (function_exists('geodir_location_geo_home_link')) {
remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
}
$numposts = $wp_query->found_posts;
$max_page = ceil($numposts / $posts_per_page);
if (empty($paged)) {
$paged = 1;
}
if ($max_page > 1 || $always_show) {
// Extra pagination info
$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
$start_no = ($paged - 1) * $posts_per_page + 1;
$end_no = min($paged * $posts_per_page, $numposts);
if ($geodir_pagination_more_info != '') {
$pagination_info = '<div class="gd-pagination-details">' . wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts) . '</div>';
if ($geodir_pagination_more_info == 'before') {
$before = $before . $pagination_info;
} else {
if ($geodir_pagination_more_info == 'after') {
$after = $pagination_info . $after;
}
}
}
echo "{$before} <div class='Navi'>";
if ($paged >= $pages_to_show - 1) {
echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>';
}
previous_posts_link($prelabel);
for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
if ($i >= 1 && $i <= $max_page) {
if ($i == $paged) {
echo "<strong class='on'>{$i}</strong>";
} else {
echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
}
}
}
next_posts_link($nxtlabel, $max_page);
if ($paged + $half_pages_to_show < $max_page) {
echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>';
}
echo "</div> {$after}";
}
if (function_exists('geodir_location_geo_home_link')) {
add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
}
}
}
示例13: explode
$post_term = explode(',', trim($post_term, ','));
}
$post_term = array_unique($post_term);
if (!empty($post_term)) {
foreach ($post_term as $post_term) {
$post_term = trim($post_term);
if ($post_term != '') {
$term = get_term_by('id', $post_term, $post_taxonomy);
$links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>{$term->name}</a>";
$terms[] = $term;
}
}
}
break;
}
$taxonomies[$post_taxonomy] = wp_sprintf('%s: %l.', ucwords($listing_label . ' Category'), $links, (object) $terms);
}
echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
if (isset($taxonomies[$post_type . '_tags'])) {
echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
}
?>
</p>
<!-- Post terms end -->
<?php
if ((int) get_option('geodir_disable_gb_modal') != 1) {
?>
<!-- Post info tabs start -->
<script type="text/javascript">
jQuery(function () {
jQuery('#post-gallery a').lightBox({
示例14: render_shadow_indicator
/**
* Display a notice at the bottom of the window when inside a shadow
*/
public function render_shadow_indicator()
{
?>
<style>#shadow-indicator { font-family: Arial, sans-serif; position: fixed; bottom: 0; left: 0; right: 0; width: 100%; color: #fff; background: #cc0000; z-index: 3000; font-size:16px; line-height: 1; text-align: center; padding: 5px } #shadow-indicator a.clearlink { text-decoration: underline; color: #fff; }</style>
<div id="shadow-indicator">
<?php
echo wp_sprintf(__('You are currently in %s.', 'wpp-instance-switcher'), getenv('WP_ENV'));
?>
<a class="clearlink" href="/?wpp_shadow=clear"><?php
_e('Exit', 'wpp-instance-switcher');
?>
</a>
</div>
<?php
}
示例15: get_the_taxonomies
/**
* Retrieve all taxonomies associated with a post.
*
* This function can be used within the loop. It will also return an array of
* the taxonomies with links to the taxonomy and name.
*
* @since 2.5.0
*
* @param int $post Optional. Post ID or will use Global Post ID (in loop).
* @param array $args Override the defaults.
* @return array
*/
function get_the_taxonomies($post = 0, $args = array() ) {
$post = get_post( $post );
$args = wp_parse_args( $args, array(
'template' => '%s: %l.',
) );
extract( $args, EXTR_SKIP );
$taxonomies = array();
if ( !$post )
return $taxonomies;
foreach ( get_object_taxonomies($post) as $taxonomy ) {
$t = (array) get_taxonomy($taxonomy);
if ( empty($t['label']) )
$t['label'] = $taxonomy;
if ( empty($t['args']) )
$t['args'] = array();
if ( empty($t['template']) )
$t['template'] = $template;
$terms = get_object_term_cache($post->ID, $taxonomy);
if ( false === $terms )
$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
$links = array();
foreach ( $terms as $term )
$links[] = "<a href='" . esc_attr( get_term_link($term) ) . "'>$term->name</a>";
if ( $links )
$taxonomies[$taxonomy] = wp_sprintf($t['template'], $t['label'], $links, $terms);
}
return $taxonomies;
}