• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_dropdown_languages函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_dropdown_languages函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_dropdown_languages函数的具体用法?PHP wp_dropdown_languages怎么用?PHP wp_dropdown_languages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_dropdown_languages函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: wp_user_profiles_language_metabox

/**
 * Render the language metabox for user profile screen
 *
 * @since 0.1.0
 *
 * @param WP_User $user The WP_User object to be edited.
 */
function wp_user_profiles_language_metabox($user = null)
{
    // Defaults
    $languages = get_available_languages();
    $user_locale = $user->locale;
    $fallback = get_locale();
    // Already en_US
    if ('en_US' === $user->locale) {
        $user_locale = false;
        // Language not available
    } elseif (!in_array($user->locale, $languages, true)) {
        $user_locale = $fallback;
    }
    ?>

	<table class="form-table">
		<tr class="user-language-wrap">
			<th scope="row">
				<label for="locale"><?php 
    esc_html_e('Language', 'wp-user-profiles');
    ?>
</label>
			</th>
			<td><?php 
    // Drop it down
    wp_dropdown_languages(array('name' => 'locale', 'id' => 'locale', 'selected' => $user_locale, 'languages' => $languages, 'show_available_translations' => false));
    ?>
			</td>
		</tr>
	</table>

	<?php 
}
开发者ID:stuttter,项目名称:wp-user-profiles,代码行数:40,代码来源:account-language.php


示例2: test_wp_dropdown_languages

 /**
  * @ticket 35294
  */
 function test_wp_dropdown_languages()
 {
     $args = array('id' => 'foo', 'name' => 'bar', 'languages' => array('de_DE'), 'translations' => $this->wp_dropdown_languages_filter(), 'selected' => 'de_DE', 'echo' => false);
     $actual = wp_dropdown_languages($args);
     $this->assertContains('id="foo"', $actual);
     $this->assertContains('name="bar"', $actual);
     $this->assertContains('<option value="" lang="en" data-installed="1">English (United States)</option>', $actual);
     $this->assertContains('<option value="de_DE" lang="de" selected=\'selected\' data-installed="1">Deutsch</option>', $actual);
     $this->assertContains('<option value="it_IT" lang="it">Italiano</option>', $actual);
 }
开发者ID:joemcgill,项目名称:develop.wordpress,代码行数:13,代码来源:l10n.php


示例3: _e

    $languages[] = WPLANG;
}
if (!empty($languages) || !empty($translations)) {
    ?>
	<tr>
		<th width="33%" scope="row"><label for="WPLANG"><?php 
    _e('Site Language');
    ?>
</label></th>
		<td>
			<?php 
    $locale = get_locale();
    if (!in_array($locale, $languages)) {
        $locale = '';
    }
    wp_dropdown_languages(array('name' => 'WPLANG', 'id' => 'WPLANG', 'selected' => $locale, 'languages' => $languages, 'translations' => $translations, 'show_available_translations' => (!is_multisite() || is_super_admin()) && wp_can_install_language_pack()));
    // Add note about deprecated WPLANG constant.
    if (defined('WPLANG') && '' !== WPLANG && $locale !== WPLANG) {
        if (is_super_admin()) {
            ?>
					<p class="description">
						<strong><?php 
            _e('Note:');
            ?>
</strong> <?php 
            printf(__('The %s constant in your %s file is no longer needed.'), '<code>WPLANG</code>', '<code>wp-config.php</code>');
            ?>
					</p>
					<?php 
        }
        _deprecated_argument('define()', '4.0', sprintf(__('The %s constant in your %s file is no longer needed.'), 'WPLANG', 'wp-config.php'));
开发者ID:BoldGrid,项目名称:WordPress,代码行数:31,代码来源:options-general.php


示例4: _e

    _e('Language Settings');
    ?>
</h3>
			<table class="form-table">
				<tr>
					<th><label for="WPLANG"><?php 
    _e('Default Language');
    ?>
</label></th>
					<td>
						<?php 
    $lang = get_site_option('WPLANG');
    if (!in_array($lang, $languages)) {
        $lang = '';
    }
    wp_dropdown_languages(array('name' => 'WPLANG', 'id' => 'WPLANG', 'selected' => $lang, 'languages' => $languages));
    ?>
					</td>
				</tr>
			</table>
			<?php 
}
?>

		<h3><?php 
_e('Menu Settings');
?>
</h3>
		<table id="menu" class="form-table">
			<tr>
				<th scope="row"><?php 
开发者ID:uwitec,项目名称:findgreatmaster,代码行数:31,代码来源:settings.php


示例5: _e

    _e('Language Settings');
    ?>
</h3>
			<table class="form-table">
				<tr>
					<th><label for="WPLANG"><?php 
    _e('Default Language');
    ?>
</label></th>
					<td>
						<?php 
    $lang = get_site_option('WPLANG');
    if (!in_array($lang, $languages)) {
        $lang = '';
    }
    wp_dropdown_languages(array('name' => 'WPLANG', 'id' => 'WPLANG', 'selected' => $lang, 'languages' => $languages, 'translations' => $translations, 'show_available_translations' => wp_can_install_language_pack()));
    ?>
					</td>
				</tr>
			</table>
			<?php 
}
?>

		<h3><?php 
_e('Menu Settings');
?>
</h3>
		<table id="menu" class="form-table">
			<tr>
				<th scope="row"><?php 
开发者ID:Plego,项目名称:toyoa,代码行数:31,代码来源:settings.php


示例6: _e

	<th scope="row">
		<label for="site_language"><?php 
            _e('Site Language');
            ?>
</label>
	</th>
	<td>
		<?php 
            $user_locale = get_user_option('locale', $profileuser->ID);
            if ('en_US' === $user_locale) {
                // en_US
                $user_locale = false;
            } elseif (!in_array($user_locale, $languages, true)) {
                $user_locale = get_locale();
            }
            wp_dropdown_languages(array('name' => 'locale', 'id' => 'locale', 'selected' => $user_locale, 'languages' => $languages, 'show_available_translations' => false));
            ?>
	</td>
</tr>
<?php 
        }
        ?>

<?php 
        /**
         * Fires at the end of the 'Personal Options' settings table on the user editing screen.
         *
         * @since 2.7.0
         *
         * @param WP_User $profileuser The current WP_User object.
         */
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:31,代码来源:user-edit.php


示例7: show_blog_form

/**
 * Generates and displays the Signup and Create Site forms
 *
 * @since MU
 *
 * @param string          $blogname   The new site name.
 * @param string          $blog_title The new site title.
 * @param WP_Error|string $errors     A WP_Error object containing existing errors. Defaults to empty string.
 */
function show_blog_form($blogname = '', $blog_title = '', $errors = '')
{
    if (!is_wp_error($errors)) {
        $errors = new WP_Error();
    }
    $current_network = get_network();
    // Blog name
    if (!is_subdomain_install()) {
        echo '<label for="blogname">' . __('Site Name:') . '</label>';
    } else {
        echo '<label for="blogname">' . __('Site Domain:') . '</label>';
    }
    if ($errmsg = $errors->get_error_message('blogname')) {
        ?>
		<p class="error"><?php 
        echo $errmsg;
        ?>
</p>
	<?php 
    }
    if (!is_subdomain_install()) {
        echo '<span class="prefix_address">' . $current_network->domain . $current_network->path . '</span><input name="blogname" type="text" id="blogname" value="' . esc_attr($blogname) . '" maxlength="60" /><br />';
    } else {
        echo '<input name="blogname" type="text" id="blogname" value="' . esc_attr($blogname) . '" maxlength="60" /><span class="suffix_address">.' . ($site_domain = preg_replace('|^www\\.|', '', $current_network->domain)) . '</span><br />';
    }
    if (!is_user_logged_in()) {
        if (!is_subdomain_install()) {
            $site = $current_network->domain . $current_network->path . __('sitename');
        } else {
            $site = __('domain') . '.' . $site_domain . $current_network->path;
        }
        /* translators: %s: site address */
        echo '<p>(<strong>' . sprintf(__('Your address will be %s.'), $site) . '</strong>) ' . __('Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!') . '</p>';
    }
    // Blog Title
    ?>
	<label for="blog_title"><?php 
    _e('Site Title:');
    ?>
</label>
	<?php 
    if ($errmsg = $errors->get_error_message('blog_title')) {
        ?>
		<p class="error"><?php 
        echo $errmsg;
        ?>
</p>
	<?php 
    }
    echo '<input name="blog_title" type="text" id="blog_title" value="' . esc_attr($blog_title) . '" />';
    ?>

	<?php 
    // Site Language.
    $languages = signup_get_available_languages();
    if (!empty($languages)) {
        ?>
		<p>
			<label for="site-language"><?php 
        _e('Site Language:');
        ?>
</label>
			<?php 
        // Network default.
        $lang = get_site_option('WPLANG');
        if (isset($_POST['WPLANG'])) {
            $lang = $_POST['WPLANG'];
        }
        // Use US English if the default isn't available.
        if (!in_array($lang, $languages)) {
            $lang = '';
        }
        wp_dropdown_languages(array('name' => 'WPLANG', 'id' => 'site-language', 'selected' => $lang, 'languages' => $languages, 'show_available_translations' => false));
        ?>
		</p>
	<?php 
    }
    // Languages.
    ?>

	<div id="privacy">
        <p class="privacy-intro">
            <label for="blog_public_on"><?php 
    _e('Privacy:');
    ?>
</label>
            <?php 
    _e('Allow search engines to index this site.');
    ?>
            <br style="clear:both" />
            <label class="checkbox" for="blog_public_on">
//.........这里部分代码省略.........
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:101,代码来源:wp-signup.php


示例8: _e

<?php

namespace admin_language_per_user;

?>
<table class="form-table">
	<tr>
		<th scope="row">
			<label for="<?php 
echo self::meta_name;
?>
"><?php 
_e('Site Language');
?>
</label>
		</th>
		<td>
		<?php 
wp_dropdown_languages(array('name' => self::meta_name, 'id' => self::meta_name, 'selected' => $locale, 'languages' => $languages, 'translations' => $translations, 'show_available_translations' => false));
?>
		</td>
	</tr>
</table><?php 
开发者ID:unclego,项目名称:admin-language-per-user,代码行数:23,代码来源:user-profile.php


示例9: locale_dropdown_meta_box_callback

 /**
  * Print language locale dropdown meta-box
  *
  * @from 1.0
  */
 public function locale_dropdown_meta_box_callback($post)
 {
     global $sublanguage_admin;
     wp_nonce_field('language_locale_dropdown_action', 'language_locale_dropdown_nonce');
     wp_dropdown_languages(array('selected' => '', 'languages' => array_filter($sublanguage_admin->get_language_column('post_content')), 'name' => 'language_locale_dropdown', 'id' => 'language_locale_dropdown'));
 }
开发者ID:Blueprint-Marketing,项目名称:sublanguage,代码行数:11,代码来源:admin-languages.php


示例10: fallback_locale_field

 /**
  * Download the chosen fallback language on save and create the language dropdown similar to the default language dropdown
  */
 public function fallback_locale_field()
 {
     $languages = get_available_languages();
     $translations = wp_get_available_translations();
     $fallback_locale = $this->fallback_locale;
     // Handle translation install.
     if (!empty($fallback_locale) && !in_array($fallback_locale, $languages) && (!is_multisite() || is_super_admin())) {
         require_once ABSPATH . 'wp-admin/includes/translation-install.php';
         if (wp_can_install_language_pack()) {
             $language = wp_download_language_pack($fallback_locale);
             if ($language) {
                 $fallback_locale = $language;
             }
         }
     }
     wp_dropdown_languages(array('name' => 'fallback_locale', 'id' => 'fallback_locale', 'selected' => $fallback_locale, 'languages' => $languages, 'translations' => $translations, 'show_available_translations' => (!is_multisite() || is_super_admin()) && wp_can_install_language_pack()));
 }
开发者ID:2ndkauboy,项目名称:language-fallback,代码行数:20,代码来源:language-fallback.php



注:本文中的wp_dropdown_languages函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_dropdown_pages函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_dropdown_cats函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap