本文整理汇总了PHP中theme_locals函数的典型用法代码示例。如果您正苦于以下问题:PHP theme_locals函数的具体用法?PHP theme_locals怎么用?PHP theme_locals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了theme_locals函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cherry_prepare_download_backup_callback
function cherry_prepare_download_backup_callback()
{
check_ajax_referer('cherry_download_backup', 'wp_nonce_download_backup');
if (!current_user_can('export')) {
wp_die('You do not have permissions to do this', 'Error');
}
$file = isset($_GET['file']) ? $_GET['file'] : '';
if (!$file) {
wp_die('File not provided', 'Error');
}
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile($file);
} else {
echo theme_locals("unfortunately") . $theme_folder . theme_locals("please_try");
}
exit;
}
示例2: myHelpPointers
function myHelpPointers()
{
//First we define our pointers
$pointers = array(array('id' => 'xyz1', 'screen' => 'options-permalink', 'target' => '#submit', 'title' => theme_locals("submit_permalink"), 'content' => theme_locals("submit_permalink_desc"), 'position' => array('edge' => 'top', 'align' => 'left', 'offset' => '0 5')), array('id' => 'xyz2', 'screen' => 'themes', 'target' => '#toplevel_page_options-framework', 'title' => theme_locals("import_sample_data"), 'content' => theme_locals("import_sample_data_desc"), 'position' => array('edge' => 'bottom', 'align' => 'top', 'offset' => '0 -10')), array('id' => 'xyz3', 'screen' => 'toplevel_page_options-framework', 'target' => '#toplevel_page_options-framework', 'title' => theme_locals("import_sample_data"), 'content' => theme_locals("import_sample_data_desc_2"), 'position' => array('edge' => 'left', 'align' => 'top', 'offset' => '0 18')));
//Now we instantiate the class and pass our pointer array to the constructor
$myPointers = new WP_Help_Pointer($pointers);
}
示例3: elegance_widgets_init
function elegance_widgets_init() {
// Sidebar Widget
// Location: the sidebar
register_sidebar(array(
'name' => theme_locals("sidebar"),
'id' => 'main-sidebar',
'description' => theme_locals("sidebar_desc"),
'before_widget' => '<div id="%1$s" class="widget">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
// Footer Widget Area 1
// Location: at the top of the footer, above the copyright
register_sidebar(array(
'name' => theme_locals("footer_1"),
'id' => 'footer-sidebar-1',
'description' => theme_locals("footer_desc"),
'before_widget' => '<div id="%1$s">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
// Footer Widget Area 2
// Location: at the top of the footer, above the copyright
register_sidebar(array(
'name' => theme_locals("footer_2"),
'id' => 'footer-sidebar-2',
'description' => theme_locals("footer_desc"),
'before_widget' => '<div id="%1$s">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
// Footer Widget Area 3
// Location: at the top of the footer, above the copyright
register_sidebar(array(
'name' => theme_locals("footer_3"),
'id' => 'footer-sidebar-3',
'description' => theme_locals("footer_desc"),
'before_widget' => '<div id="%1$s">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
// Footer Widget Area 4
// Location: at the top of the footer, above the copyright
register_sidebar(array(
'name' => theme_locals("footer_4"),
'id' => 'footer-sidebar-4',
'description' => theme_locals("footer_desc"),
'before_widget' => '<div id="%1$s">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
}
示例4: cherry_widgets_init
function cherry_widgets_init()
{
// Sidebar Widget
// Location: the sidebar
register_sidebar(array('name' => theme_locals("sidebar"), 'id' => 'main-sidebar', 'description' => theme_locals("sidebar_desc"), 'before_widget' => '<div id="%1$s" class="widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
// Footer Widget Area
// Location: at the top of the footer, above the copyright
register_sidebar(array('name' => __('Footer Area', CURRENT_THEME), 'id' => 'footer-sidebar', 'description' => theme_locals("footer_desc"), 'before_widget' => '<div id="%1$s">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>'));
}
示例5: theme_folder_single_site
public function theme_folder_single_site( $actions, $theme ){
$theme_template = $theme->template;
if(strtolower($theme_template) == "cherryframework"){
$backup_theme = $theme->stylesheet;
$backup_button = '<a href="../wp-content/themes/'.$theme_template.'/includes/data_management/backup.php?theme_folder=/'.$backup_theme.'" title="'.theme_locals("backup").'" class="backup_theme">'.theme_locals("backup").'</a>';
array_push($actions, $backup_button);
}
return $actions;
}
示例6: button_shortcode
function button_shortcode($atts, $content = null)
{
extract(shortcode_atts(array('link' => 'http://www.google.com', 'text' => theme_locals("read_more"), 'size' => 'normal', 'style' => '', 'target' => '_self', 'display' => '', 'class' => '', 'icon' => 'no'), $atts));
$output = '<a href="' . $link . '" title="' . $text . '" class="btn btn-' . $style . ' btn-' . $size . ' btn-' . $display . ' ' . $class . '" target="' . $target . '">';
if ($icon != 'no') {
$output .= '<i class="icon-' . $icon . '"></i>';
}
$output .= $text;
$output .= '</a><!-- .btn -->';
return $output;
}
示例7: cherry_widgets_init
function cherry_widgets_init()
{
// Custom widget area.
register_sidebar(array('name' => __('Custom Widget Area'), 'id' => 'custom-widget-area', 'description' => __('An optional custom widget area for your site', 'twentyten'), 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => "</li>", 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
// Sidebar Widget
// Location: the sidebar
register_sidebar(array('name' => theme_locals("sidebar"), 'id' => 'main-sidebar', 'description' => theme_locals("sidebar_desc"), 'before_widget' => '<div id="%1$s" class="widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
// Footer Widget Area 1
// Location: at the top of the footer, above the copyright
register_sidebar(array('name' => theme_locals("footer_1"), 'id' => 'footer-sidebar-1', 'description' => theme_locals("footer_desc"), 'before_widget' => '<div id="%1$s">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
// Footer Widget Area 2
// Location: at the top of the footer, above the copyright
register_sidebar(array('name' => theme_locals("footer_2"), 'id' => 'footer-sidebar-2', 'description' => theme_locals("footer_desc"), 'before_widget' => '<div id="%1$s">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
}
示例8: cherry_restore_callback
function cherry_restore_callback()
{
$theme_folder = isset($_GET['theme_folder']) ? $_GET['theme_folder'] : '';
if (!$theme_folder) {
wp_die('File not provided', 'Error');
}
$file = str_replace('\\', '/', WP_CONTENT_DIR) . '/themes_backup/' . $theme_folder . ".zip";
$themes_folder = str_replace('\\', '/', get_theme_root()) . '/' . $theme_folder;
if (file_exists($file)) {
chery_remove_dir($themes_folder);
cherry_unzip_backup($file, $themes_folder);
} else {
echo theme_locals("unfortunately") . $theme_folder . theme_locals("please_try");
}
}
示例9: form
/** @see WP_Widget::form */
function form($instance) {
/* Set up some default widget settings. */
$defaults = array( 'title' => '', 'flickr_id' => '', 'image_amount' => '', 'linktext' => '' );
$instance = wp_parse_args( (array) $instance, $defaults );
$title = esc_attr($instance['title']);
$flickr_id = esc_attr($instance['flickr_id']);
$amount = esc_attr($instance['image_amount']);
$linktext = esc_attr($instance['linktext']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php echo theme_locals("title"); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('flickr_id'); ?>"><?php echo theme_locals("flickr_id"); ?> <input class="widefat" id="<?php echo $this->get_field_id('flickr_id'); ?>" name="<?php echo $this->get_field_name('flickr_id'); ?>" type="text" value="<?php echo $flickr_id; ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('image_amount'); ?>"><?php echo theme_locals("images_count"); ?> <input class="widefat" id="<?php echo $this->get_field_id('image_amount'); ?>" name="<?php echo $this->get_field_name('image_amount'); ?>" type="text" value="<?php echo $amount; ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('linktext'); ?>"><?php echo theme_locals("link_text"); ?> <input class="widefat" id="<?php echo $this->get_field_id('linktext'); ?>" name="<?php echo $this->get_field_name('linktext'); ?>" type="text" value="<?php echo $linktext; ?>" /></label></p>
<?php }
示例10: widget
function widget( $args, $instance ) {
global $wpdb, $comments, $comment;
extract($args, EXTR_SKIP);
$title = apply_filters('widget_title', empty($instance['title']) ? theme_locals("recent_comments_decs") : $instance['title']);
if ( !$number = (int) $instance['number'] )
$number = 5;
else if ( $number < 1 )
$number = 1;
else if ( $number > 15 )
$number = 15;
$comment_len = 100;
if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) {
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' and comment_type not in ('pingback','trackback') ORDER BY comment_date_gmt DESC LIMIT 15");
wp_cache_add( 'recent_comments', $comments, 'widget' );
}
$comments = array_slice( (array) $comments, 0, $number );
?>
<?php echo $before_widget; ?>
<?php if ( $title ) echo $before_title . $title . $after_title; ?>
<ul class="comments-custom unstyled"><?php
if ( $comments ) : foreach ( (array) $comments as $comment) :?>
<li class="comments-custom_li">
<?php if(function_exists('get_avatar')) {
echo '<figure class="thumbnail featured-thumbnail">';
echo get_avatar( get_the_author_meta('email'), '58' ); /* This avatar is the user's gravatar (http://gravatar.com) based on their administrative email address */
echo '</figure>';
} ?>
<h4 class="comments-custom_h"><?php echo $comment->comment_author; ?></h4>
<time><?php echo $comment->comment_date; ?></time>
<div class="clear"></div>
<div class="comments-custom_txt">
<a href="<?php echo get_comment_link( $comment->comment_ID ); ?>" title="<?php echo theme_locals("go_to_c"); ?>"><?php echo strip_tags(substr(apply_filters('get_comment_text', $comment->comment_content), 0, $comment_len)); if (strlen($comment->comment_content) > $comment_len) echo '...';?></a>
</div>
</li>
<?php
endforeach; endif;?>
</ul>
<?php echo $after_widget; ?>
<?php
}
示例11: myHelpPointers
function myHelpPointers() {
//First we define our pointers
$pointers = array(
array(
'id' => 'xyz1', // unique id for this pointer
'screen' => 'options-permalink', // this is the page hook we want our pointer to show on
'target' => '#submit', // the css selector for the pointer to be tied to, best to use ID's
'title' => theme_locals("submit_permalink"),
'content' => theme_locals("submit_permalink_desc"),
'position' => array(
'edge' => 'top', //top, bottom, left, right
'align' => 'left', //top, bottom, left, right, middle
'offset' => '0 5'
)
),
array(
'id' => 'xyz2', // unique id for this pointer
'screen' => 'themes', // this is the page hook we want our pointer to show on
'target' => '#toplevel_page_options-framework', // the css selector for the pointer to be tied to, best to use ID's
'title' => theme_locals("import_sample_data"),
'content' => theme_locals("import_sample_data_desc"),
'position' => array(
'edge' => 'bottom', //top, bottom, left, right
'align' => 'top', //top, bottom, left, right, middle
'offset' => '0 -10'
)
),
array(
'id' => 'xyz3', // unique id for this pointer
'screen' => 'toplevel_page_options-framework', // this is the page hook we want our pointer to show on
'target' => '#toplevel_page_options-framework', // the css selector for the pointer to be tied to, best to use ID's
'title' => theme_locals("import_sample_data"),
'content' => theme_locals("import_sample_data_desc_2"),
'position' => array(
'edge' => 'left', //top, bottom, left, right
'align' => 'top', //top, bottom, left, right, middle
'offset' => '0 18'
)
)
// more as needed
);
//Now we instantiate the class and pass our pointer array to the constructor
$myPointers = new WP_Help_Pointer($pointers);
};
示例12: my_theme_register_required_plugins
/**
* Register the required plugins for this theme.
*
* In this example, we register two plugins - one included with the TGMPA library
* and one from the .org repo.
*
* The variable passed to tgmpa_register_plugins() should be an array of plugin
* arrays.
*
* This function is hooked into tgmpa_init, which is fired within the
* TGM_Plugin_Activation class constructor.
*/
function my_theme_register_required_plugins()
{
/**
* Array of plugin arrays. Required keys are name and slug.
* If the source is NOT from the .org repo, then source is also required.
*/
$plugins = array(array('name' => 'Contact Form 7', 'slug' => 'contact-form-7', 'source' => CHILD_DIR . '/includes/plugins/contact-form-7.zip', 'required' => true, 'version' => '', 'force_activation' => true, 'force_deactivation' => false, 'external_url' => ''), array('name' => 'Cherry Plugin', 'slug' => 'cherry-plugin', 'source' => PARENT_DIR . '/includes/plugins/cherry-plugin.zip', 'required' => true, 'version' => '0.1', 'force_activation' => true, 'force_deactivation' => false, 'external_url' => ''));
/**
* Array of configuration settings. Amend each line as needed.
* If you want the default strings to be available under your own theme domain,
* leave the strings uncommented.
* Some of the strings are added into a sprintf, so see the comments at the
* end of each line for what each argument will be.
*/
$config = array('domain' => CURRENT_THEME, 'default_path' => '', 'parent_menu_slug' => 'themes.php', 'parent_url_slug' => 'themes.php', 'menu' => 'install-required-plugins', 'has_notices' => true, 'is_automatic' => true, 'message' => '', 'strings' => array('page_title' => theme_locals("page_title"), 'menu_title' => theme_locals("menu_title"), 'installing' => theme_locals("installing"), 'oops' => theme_locals("oops_2"), 'notice_can_install_required' => _n_noop(theme_locals("notice_can_install_required"), theme_locals("notice_can_install_required_2")), 'notice_can_install_recommended' => _n_noop(theme_locals("notice_can_install_recommended"), theme_locals("notice_can_install_recommended_2")), 'notice_cannot_install' => _n_noop(theme_locals("notice_cannot_install"), theme_locals("notice_cannot_install_2")), 'notice_can_activate_required' => _n_noop(theme_locals("notice_can_activate_required"), theme_locals("notice_can_activate_required_2")), 'notice_can_activate_recommended' => _n_noop(theme_locals("notice_can_activate_recommended"), theme_locals("notice_can_activate_recommended_2")), 'notice_cannot_activate' => _n_noop(theme_locals("notice_cannot_activate"), theme_locals("notice_cannot_activate_2")), 'notice_ask_to_update' => _n_noop(theme_locals("notice_ask_to_update"), theme_locals("notice_ask_to_update_2")), 'notice_cannot_update' => _n_noop(theme_locals("notice_cannot_update"), theme_locals("notice_cannot_update_2")), 'install_link' => _n_noop(theme_locals("install_link"), theme_locals("install_link_2")), 'activate_link' => _n_noop(theme_locals("activate_link"), theme_locals("activate_link_2")), 'return' => theme_locals("return"), 'plugin_activated' => theme_locals("plugin_activated"), 'complete' => theme_locals("complete"), 'nag_type' => theme_locals("updated")));
tgmpa($plugins, $config);
}
示例13: tz_show_box_category
function tz_show_box_category()
{
global $meta_box_category, $post;
// Use nonce for verification
echo '<input type="hidden" name="tz_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
echo '<table class="form-table">';
foreach ($meta_box_category['fields'] as $field) {
// get current post meta data
$meta = get_post_meta($post->ID, $field['id'], true);
switch ($field['type']) {
//If Text
case 'text':
echo '<tr>', '<th style="width:25%"><label for="', $field['id'], '"><strong>', theme_locals($field['name']), '</strong><span style=" display:block; color:#999; margin:5px 0 0 0; line-height: 18px;">' . theme_locals($field['desc']) . '</span></label></th>', '<td>';
echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : stripslashes(htmlspecialchars($field['std'], ENT_QUOTES)), '" size="30" style="width:75%; margin-right: 20px; float:left;" />';
break;
}
}
echo '</table>';
}
示例14: my_show_box_testi
function my_show_box_testi()
{
global $meta_box_testi, $post;
echo '<p style="padding:10px 0 0 0;">' . theme_locals("testimonial_options_desc") . '</p>';
// Use nonce for verification
echo '<input type="hidden" name="my_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
echo '<table class="form-table">';
foreach ($meta_box_testi['fields'] as $field) {
// get current post meta data
$meta = get_post_meta($post->ID, $field['id'], true);
switch ($field['type']) {
//If Text
case 'text':
echo '<tr style="border-top:1px solid #eeeeee;">', '<th style="width:25%"><label for="', $field['id'], '"><strong>', theme_locals($field['name']), '</strong><span style=" display:block; color:#999; margin:5px 0 0 0; line-height: 18px;">' . theme_locals($field['desc']) . '</span></label></th>', '<td>';
echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : stripslashes(htmlspecialchars($field['std'], ENT_QUOTES)), '" size="30" style="width:75%; margin-right: 20px; float:left;" />';
break;
//If textarea
//If textarea
case 'textarea':
echo '<tr style="border-top:1px solid #eeeeee;">', '<th style="width:25%"><label for="', $field['id'], '"><strong>', theme_locals($field['name']), '</strong><span style="line-height:18px; display:block; color:#999; margin:5px 0 0 0;">' . theme_locals($field['desc']) . '</span></label></th>', '<td>';
echo '<textarea name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : stripslashes(htmlspecialchars($field['std'], ENT_QUOTES)), '" rows="8" cols="5" style="width:100%; margin-right: 20px; float:left;">', $meta ? $meta : stripslashes(htmlspecialchars($field['std'], ENT_QUOTES)), '</textarea>';
break;
//If Select
//If Select
case 'select':
echo '<tr>', '<th style="width:25%"><label for="', $field['id'], '"><strong>', theme_locals($field['name']), '</strong><span style=" display:block; color:#999; margin:5px 0 0 0; line-height: 18px;">' . theme_locals($field['desc']) . '</span></label></th>', '<td>';
echo '<select id="' . $field['id'] . '" name="' . $field['id'] . '">';
foreach ($field['options'] as $option) {
echo '<option';
if ($meta == $option) {
echo ' selected="selected"';
}
echo '>' . $option . '</option>';
}
echo '</select>';
break;
}
}
echo '</table>';
}
示例15: hero_unit_shortcode
function hero_unit_shortcode($atts, $content = null)
{
extract(shortcode_atts(array('title' => '', 'text' => '', 'btn_text' => theme_locals('read_more'), 'btn_link' => '', 'btn_style' => '', 'btn_size' => '', 'target' => '', 'custom_class' => ''), $atts));
$output = '<div class="hero-unit ' . $custom_class . '">';
if ($title != "") {
$output .= '<h1>';
$output .= $title;
$output .= '</h1>';
}
if ($text != "") {
$output .= '<p>';
$output .= $text;
$output .= '</p>';
}
if ($btn_link != "") {
$output .= '<div class="btn-align"><a href="' . $btn_link . '" title="' . $btn_text . '" class="btn btn-' . $btn_style . ' btn-' . $btn_size . ' btn-primary" target="' . $target . '">';
$output .= $btn_text;
$output .= '</a></div>';
}
$output .= '</div><!-- .hero-unit (end) -->';
return $output;
}