gpt4 book ai didi

php - WordPress qtranslate 标志下拉菜单

转载 作者:行者123 更新时间:2023-12-01 04:23:05 26 4
gpt4 key购买 nike

我正在使用 wordpress 的“qtranslate”插件在我的网站中使用元语言,

我如何创建一个仅显示其中标志的组合?

我尝试使用以下代码生成下拉列表,但它只显示列表中的标志:

echo qtrans_generateLanguageSelectCode('image');
$header_shortcodes = html_entity_decode(get_option(PREFIX.'_header_shortcodes'), ENT_QUOTES, 'UTF-8');
echo $header_shortcodes = apply_filters('themefuse_shortcodes',$header_shortcodes);

谢谢

最佳答案

我最终采用了这里的解决方案之一并将其与 msdropdown 结合起来。插件

第 1 步:转到插件文件夹并打开 qtranslate/qtranslate_widget.php。行号中有。 112 你会发现 case:'both';现在,该案例在第 123 行结束,在下面添加以下代码(编写了另一个案例)

case 'bothkria': ?>
<div id="language_chooser">
<select name="langchooser" id="langchooser" onchange="$(window.location).attr('href',this.value);">
<?php
/************************
* go over the enabled languages and create all the languages options
* the first marked "selected" is reffered to the current chosen language
* the value is the relevant url and the title is the url of the image.
*
* After creating the selectbox we will run the msdropdown plugin to make it a designed select box
* Of corse dont forget to have a reference to the msdropdown js library
* <script type="text/javascript" src="js/jquery.dd.js"></script>
* you can find it here http://www.marghoobsuleman.com/jquery-image-dropdown
*************************/
foreach(qtrans_getSortedLanguages() as $language)
{
if($q_config['language']==$language) {?>
<option selected="selected" value="<?php echo qtrans_convertURL($url, $language);?>" title="<?php echo get_option('home');?>/wp-content/<?php echo $q_config['flag_location'];?><?php echo $q_config['flag'][$language] ?>"><?php print strtoupper($q_config['pre_domain'][$language]); ?></option>
<?php } else { ?>
<option value="<?php print qtrans_convertURL($url, $language);?>" title="<?php echo get_option('home');?>/wp-content/<?php echo $q_config['flag_location'];?><?php echo $q_config['flag'][$language] ?>"><?php print strtoupper($q_config['pre_domain'][$language]); ?></option>
<?php }
} ?>
</select>
<div id="selectbox_script" style="display:none;">
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready(function(e) {
try {
$("#langchooser").msDropDown();
} catch(e) {
alert(e.message);
}
});
/* ]]> */
</script>
</div>
</div>
<?php break; ?>

关于php - WordPress qtranslate 标志下拉菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8817071/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com