AI助手支持GPT4.0
This plugin creates Bootstrap accordion from custom posts.
此插件通过自定义帖子创建Bootstrap手风琴。
Requires Bootstrap 3.x, if your theme is not Bootstrap based you will not be able to use this plugin.
需要Bootstrap 3.x,如果您的主题不是基于Bootstrap的,则将无法使用此插件。
Fully compatible with WPML, just translate your posts and use shortcodes as explained below.
与WPML完全兼容,只需翻译您的帖子并使用简码,如下所述。
Plugin currently does not support Woocommerce.
插件当前不支持Woocommerce。 p>
You may check Post Types to see how to do it.
您可以检查帖子类型以了解操作方法。 li>
ol>
Example from WP Codex – for testing, copy and paste code below to theme functions.php
WP Codex的示例–用于测试,复制下面的代码并将其粘贴到主题函数中。php p>
add_action( 'init', 'create_post_type' ); add_action('init','create_post_type'); function create_post_type() { 函数create_post_type(){ register_post_type( 'Accordion', register_post_type('手风琴', array( 数组( 'labels' => array( '标签'=>数组( 'name' => __( 'Accordions' ), '名称'=> __('手风琴'), 'singular_name' => __( 'Accordion' ) 'singular_name'=> __('手风琴') ), ), 'public' => true, 'public'=>是, 'has_archive' => true, 'has_archive'=>是, ) ) ); ); }} code> pre>Add shortcode to page or post where you want to use accordion在要使用手风琴的页面或帖子中添加简码 li> ol>If you used code above to create custom posts type you would use following shortcode:如果您使用上面的代码创建自定义帖子类型,则将使用以下短代码: p>[gw_accordion custom_post="Accordion"] [gw_accordion custom_post =“ Accordion”] code> pre>Optionally, you may add CSS class(可选)您可以添加CSS类 p>[gw_accordion custom_post="Accordion" class="my_css_class"] [gw_accordion custom_post =“ Accordion” class =“ my_css_class”] code> pre>You can also add code to your theme您还可以将代码添加到主题中 p> <?php echo do_shortcode('[[gw_accordion custom_post =“ Accordion”');?> code> pre>or with CSS class或使用CSS类 p> <?php echo do_shortcode('[[gw_accordion custom_post =“ Accordion” class =“ my_css_class”]');?> code> pre>You also may set ordering , default is by ID and Ascending (ASC)您还可以设置顺序,默认为ID和升序(ASC) p>[gw_accordion custom_post=”Accordion” class=”my_css_class” order_by=”title” order=”asc”] [gw_accordion custom_post =“ Accordion” class =“ my_css_class” order_by =“ title” order =“ asc”] p>Demo演示 h3>Check Demo 检查演示 li> ol>Known Issues已知问题 h3>If your theme use smooth scroll script like this one如果您的主题使用像这样的平滑滚动脚本 p> jQuery(function() { jQuery(function(){ jQuery('a[href*="#"]:not([href="#"]').click(function() { jQuery('a [href * =“#”]:not([href =“#”]')。click(function(){ if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 如果(location.pathname.replace(/ ^ \ //,'')== this.pathname.replace(/ ^ \ //,'')&& location.hostname == this.hostname){ var target = jQuery(this.hash); var target = jQuery(this.hash); target = target.length ?目标= target.length? target : jQuery('[name=' + this.hash.slice(1) +']'); target:jQuery('[name ='+ this.hash.slice(1)+']'); if (target.length) { 如果(target.length){ jQuery('html,body').animate({ jQuery('html,body')。animate({ scrollTop: target.offset().top scrollTop:target.offset()。top }, 2000); },2000); return false; 返回false; } } } } }); }); });}); code> pre>You may need to change this line您可能需要更改此行 p> jQuery('a[href*="#"]:not([href="#"]') jQuery('a [href * =“#”]:not([href =“#”]') code> pre>To look like this看起来像这样 p> jQuery('a[href*="#"]:not([href="#"], a:not([data-toggle])') jQuery('a [href * =“#”]:not([href =“#”],a:not([data-toggle])') code> pre>to avoid conflict避免冲突 p>
add_action('init','create_post_type'); function create_post_type() { 函数create_post_type(){ register_post_type( 'Accordion', register_post_type('手风琴', array( 数组( 'labels' => array( '标签'=>数组( 'name' => __( 'Accordions' ), '名称'=> __('手风琴'), 'singular_name' => __( 'Accordion' ) 'singular_name'=> __('手风琴') ), ), 'public' => true, 'public'=>是, 'has_archive' => true, 'has_archive'=>是, ) ) ); ); }}
function create_post_type() {
函数create_post_type(){
register_post_type( 'Accordion',
register_post_type('手风琴',
array(
数组(
'labels' => array(
'标签'=>数组(
'name' => __( 'Accordions' ),
'名称'=> __('手风琴'),
'singular_name' => __( 'Accordion' )
'singular_name'=> __('手风琴')
),
),
'public' => true,
'public'=>是,
'has_archive' => true,
'has_archive'=>是,
)
)
);
);
}
code> pre>
If you used code above to create custom posts type you would use following shortcode:
如果您使用上面的代码创建自定义帖子类型,则将使用以下短代码: p>
[gw_accordion custom_post="Accordion"] [gw_accordion custom_post =“ Accordion”] code> pre>Optionally, you may add CSS class(可选)您可以添加CSS类 p>[gw_accordion custom_post="Accordion" class="my_css_class"] [gw_accordion custom_post =“ Accordion” class =“ my_css_class”] code> pre>You can also add code to your theme您还可以将代码添加到主题中 p> <?php echo do_shortcode('[[gw_accordion custom_post =“ Accordion”');?> code> pre>or with CSS class或使用CSS类 p> <?php echo do_shortcode('[[gw_accordion custom_post =“ Accordion” class =“ my_css_class”]');?> code> pre>You also may set ordering , default is by ID and Ascending (ASC)您还可以设置顺序,默认为ID和升序(ASC) p>[gw_accordion custom_post=”Accordion” class=”my_css_class” order_by=”title” order=”asc”] [gw_accordion custom_post =“ Accordion” class =“ my_css_class” order_by =“ title” order =“ asc”] p>Demo演示 h3>Check Demo 检查演示 li> ol>Known Issues已知问题 h3>If your theme use smooth scroll script like this one如果您的主题使用像这样的平滑滚动脚本 p> jQuery(function() { jQuery(function(){ jQuery('a[href*="#"]:not([href="#"]').click(function() { jQuery('a [href * =“#”]:not([href =“#”]')。click(function(){ if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 如果(location.pathname.replace(/ ^ \ //,'')== this.pathname.replace(/ ^ \ //,'')&& location.hostname == this.hostname){ var target = jQuery(this.hash); var target = jQuery(this.hash); target = target.length ?目标= target.length? target : jQuery('[name=' + this.hash.slice(1) +']'); target:jQuery('[name ='+ this.hash.slice(1)+']'); if (target.length) { 如果(target.length){ jQuery('html,body').animate({ jQuery('html,body')。animate({ scrollTop: target.offset().top scrollTop:target.offset()。top }, 2000); },2000); return false; 返回false; } } } } }); }); });}); code> pre>You may need to change this line您可能需要更改此行 p> jQuery('a[href*="#"]:not([href="#"]') jQuery('a [href * =“#”]:not([href =“#”]') code> pre>To look like this看起来像这样 p> jQuery('a[href*="#"]:not([href="#"], a:not([data-toggle])') jQuery('a [href * =“#”]:not([href =“#”],a:not([data-toggle])') code> pre>to avoid conflict避免冲突 p>
[gw_accordion custom_post =“ Accordion”]
Optionally, you may add CSS class
(可选)您可以添加CSS类 p>
[gw_accordion custom_post="Accordion" class="my_css_class"] [gw_accordion custom_post =“ Accordion” class =“ my_css_class”] code> pre>You can also add code to your theme您还可以将代码添加到主题中 p> <?php echo do_shortcode('[[gw_accordion custom_post =“ Accordion”');?> code> pre>or with CSS class或使用CSS类 p> <?php echo do_shortcode('[[gw_accordion custom_post =“ Accordion” class =“ my_css_class”]');?> code> pre>You also may set ordering , default is by ID and Ascending (ASC)您还可以设置顺序,默认为ID和升序(ASC) p>[gw_accordion custom_post=”Accordion” class=”my_css_class” order_by=”title” order=”asc”] [gw_accordion custom_post =“ Accordion” class =“ my_css_class” order_by =“ title” order =“ asc”] p>Demo演示 h3>Check Demo 检查演示 li> ol>Known Issues已知问题 h3>If your theme use smooth scroll script like this one如果您的主题使用像这样的平滑滚动脚本 p> jQuery(function() { jQuery(function(){ jQuery('a[href*="#"]:not([href="#"]').click(function() { jQuery('a [href * =“#”]:not([href =“#”]')。click(function(){ if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 如果(location.pathname.replace(/ ^ \ //,'')== this.pathname.replace(/ ^ \ //,'')&& location.hostname == this.hostname){ var target = jQuery(this.hash); var target = jQuery(this.hash); target = target.length ?目标= target.length? target : jQuery('[name=' + this.hash.slice(1) +']'); target:jQuery('[name ='+ this.hash.slice(1)+']'); if (target.length) { 如果(target.length){ jQuery('html,body').animate({ jQuery('html,body')。animate({ scrollTop: target.offset().top scrollTop:target.offset()。top }, 2000); },2000); return false; 返回false; } } } } }); }); });}); code> pre>You may need to change this line您可能需要更改此行 p> jQuery('a[href*="#"]:not([href="#"]') jQuery('a [href * =“#”]:not([href =“#”]') code> pre>To look like this看起来像这样 p> jQuery('a[href*="#"]:not([href="#"], a:not([data-toggle])') jQuery('a [href * =“#”]:not([href =“#”],a:not([data-toggle])') code> pre>to avoid conflict避免冲突 p>
[gw_accordion custom_post =“ Accordion” class =“ my_css_class”]
You can also add code to your theme
您还可以将代码添加到主题中 p>
<?php echo do_shortcode('[[gw_accordion custom_post =“ Accordion”');?> code> pre>or with CSS class或使用CSS类 p> <?php echo do_shortcode('[[gw_accordion custom_post =“ Accordion” class =“ my_css_class”]');?> code> pre>You also may set ordering , default is by ID and Ascending (ASC)您还可以设置顺序,默认为ID和升序(ASC) p>[gw_accordion custom_post=”Accordion” class=”my_css_class” order_by=”title” order=”asc”] [gw_accordion custom_post =“ Accordion” class =“ my_css_class” order_by =“ title” order =“ asc”] p>Demo演示 h3>Check Demo 检查演示 li> ol>Known Issues已知问题 h3>If your theme use smooth scroll script like this one如果您的主题使用像这样的平滑滚动脚本 p> jQuery(function() { jQuery(function(){ jQuery('a[href*="#"]:not([href="#"]').click(function() { jQuery('a [href * =“#”]:not([href =“#”]')。click(function(){ if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 如果(location.pathname.replace(/ ^ \ //,'')== this.pathname.replace(/ ^ \ //,'')&& location.hostname == this.hostname){ var target = jQuery(this.hash); var target = jQuery(this.hash); target = target.length ?目标= target.length? target : jQuery('[name=' + this.hash.slice(1) +']'); target:jQuery('[name ='+ this.hash.slice(1)+']'); if (target.length) { 如果(target.length){ jQuery('html,body').animate({ jQuery('html,body')。animate({ scrollTop: target.offset().top scrollTop:target.offset()。top }, 2000); },2000); return false; 返回false; } } } } }); }); });}); code> pre>You may need to change this line您可能需要更改此行 p> jQuery('a[href*="#"]:not([href="#"]') jQuery('a [href * =“#”]:not([href =“#”]') code> pre>To look like this看起来像这样 p> jQuery('a[href*="#"]:not([href="#"], a:not([data-toggle])') jQuery('a [href * =“#”]:not([href =“#”],a:not([data-toggle])') code> pre>to avoid conflict避免冲突 p>
<?php echo do_shortcode('[[gw_accordion custom_post =“ Accordion”');?>
or with CSS class
或使用CSS类 p>
<?php echo do_shortcode('[[gw_accordion custom_post =“ Accordion” class =“ my_css_class”]');?> code> pre>You also may set ordering , default is by ID and Ascending (ASC)您还可以设置顺序,默认为ID和升序(ASC) p>[gw_accordion custom_post=”Accordion” class=”my_css_class” order_by=”title” order=”asc”] [gw_accordion custom_post =“ Accordion” class =“ my_css_class” order_by =“ title” order =“ asc”] p>Demo演示 h3>Check Demo 检查演示 li> ol>Known Issues已知问题 h3>If your theme use smooth scroll script like this one如果您的主题使用像这样的平滑滚动脚本 p> jQuery(function() { jQuery(function(){ jQuery('a[href*="#"]:not([href="#"]').click(function() { jQuery('a [href * =“#”]:not([href =“#”]')。click(function(){ if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 如果(location.pathname.replace(/ ^ \ //,'')== this.pathname.replace(/ ^ \ //,'')&& location.hostname == this.hostname){ var target = jQuery(this.hash); var target = jQuery(this.hash); target = target.length ?目标= target.length? target : jQuery('[name=' + this.hash.slice(1) +']'); target:jQuery('[name ='+ this.hash.slice(1)+']'); if (target.length) { 如果(target.length){ jQuery('html,body').animate({ jQuery('html,body')。animate({ scrollTop: target.offset().top scrollTop:target.offset()。top }, 2000); },2000); return false; 返回false; } } } } }); }); });}); code> pre>You may need to change this line您可能需要更改此行 p> jQuery('a[href*="#"]:not([href="#"]') jQuery('a [href * =“#”]:not([href =“#”]') code> pre>To look like this看起来像这样 p> jQuery('a[href*="#"]:not([href="#"], a:not([data-toggle])') jQuery('a [href * =“#”]:not([href =“#”],a:not([data-toggle])') code> pre>to avoid conflict避免冲突 p>
<?php echo do_shortcode('[[gw_accordion custom_post =“ Accordion” class =“ my_css_class”]');?>
You also may set ordering , default is by ID and Ascending (ASC)
您还可以设置顺序,默认为ID和升序(ASC) p>
[gw_accordion custom_post=”Accordion” class=”my_css_class” order_by=”title” order=”asc”]
[gw_accordion custom_post =“ Accordion” class =“ my_css_class” order_by =“ title” order =“ asc”] p>
If your theme use smooth scroll script like this one
如果您的主题使用像这样的平滑滚动脚本 p>
jQuery(function() { jQuery(function(){ jQuery('a[href*="#"]:not([href="#"]').click(function() { jQuery('a [href * =“#”]:not([href =“#”]')。click(function(){ if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 如果(location.pathname.replace(/ ^ \ //,'')== this.pathname.replace(/ ^ \ //,'')&& location.hostname == this.hostname){ var target = jQuery(this.hash); var target = jQuery(this.hash); target = target.length ?目标= target.length? target : jQuery('[name=' + this.hash.slice(1) +']'); target:jQuery('[name ='+ this.hash.slice(1)+']'); if (target.length) { 如果(target.length){ jQuery('html,body').animate({ jQuery('html,body')。animate({ scrollTop: target.offset().top scrollTop:target.offset()。top }, 2000); },2000); return false; 返回false; } } } } }); }); });}); code> pre>You may need to change this line您可能需要更改此行 p> jQuery('a[href*="#"]:not([href="#"]') jQuery('a [href * =“#”]:not([href =“#”]') code> pre>To look like this看起来像这样 p> jQuery('a[href*="#"]:not([href="#"], a:not([data-toggle])') jQuery('a [href * =“#”]:not([href =“#”],a:not([data-toggle])') code> pre>to avoid conflict避免冲突 p>
jQuery(function(){ jQuery('a[href*="#"]:not([href="#"]').click(function() { jQuery('a [href * =“#”]:not([href =“#”]')。click(function(){ if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 如果(location.pathname.replace(/ ^ \ //,'')== this.pathname.replace(/ ^ \ //,'')&& location.hostname == this.hostname){ var target = jQuery(this.hash); var target = jQuery(this.hash); target = target.length ?目标= target.length? target : jQuery('[name=' + this.hash.slice(1) +']'); target:jQuery('[name ='+ this.hash.slice(1)+']'); if (target.length) { 如果(target.length){ jQuery('html,body').animate({ jQuery('html,body')。animate({ scrollTop: target.offset().top scrollTop:target.offset()。top }, 2000); },2000); return false; 返回false; } } } } }); }); });});
jQuery('a[href*="#"]:not([href="#"]').click(function() {
jQuery('a [href * =“#”]:not([href =“#”]')。click(function(){
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
如果(location.pathname.replace(/ ^ \ //,'')== this.pathname.replace(/ ^ \ //,'')&& location.hostname == this.hostname){
var target = jQuery(this.hash);
var target = jQuery(this.hash);
target = target.length ?
目标= target.length?
target : jQuery('[name=' + this.hash.slice(1) +']');
target:jQuery('[name ='+ this.hash.slice(1)+']');
if (target.length) {
如果(target.length){
jQuery('html,body').animate({
jQuery('html,body')。animate({
scrollTop: target.offset().top
scrollTop:target.offset()。top
}, 2000);
},2000);
return false;
返回false;
});
});
You may need to change this line
您可能需要更改此行 p>
jQuery('a[href*="#"]:not([href="#"]') jQuery('a [href * =“#”]:not([href =“#”]') code> pre>To look like this看起来像这样 p> jQuery('a[href*="#"]:not([href="#"], a:not([data-toggle])') jQuery('a [href * =“#”]:not([href =“#”],a:not([data-toggle])') code> pre>to avoid conflict避免冲突 p>
jQuery('a [href * =“#”]:not([href =“#”]')
To look like this
看起来像这样 p>
jQuery('a[href*="#"]:not([href="#"], a:not([data-toggle])') jQuery('a [href * =“#”]:not([href =“#”],a:not([data-toggle])') code> pre>to avoid conflict避免冲突 p>
jQuery('a [href * =“#”]:not([href =“#”],a:not([data-toggle])')
to avoid conflict
避免冲突 p>
/wp-content/plugins
/ wp-content / plugins code>目录,或直接通过WordPress插件屏幕安装插件。 li>Activate the plugin through the ‘Plugins’ screen in WordPress – click on “Activate” link below plugin name通过WordPress中的“插件”屏幕激活插件–单击插件名称下方的“激活”链接 li>
原文出处:http://www.sanshu.cn/a/9664.html
群主管理都是支付大佬