[wordpress插件] Custom Posts Accordion自定义帖子手风琴

wordpress 插件 文章 2020-04-09 00:50 439 0 全屏看文

AI助手支持GPT4.0

评分
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。

How to use

使用方法

    1. To use this plugin you need custom post registerred.

    2. 要使用此插件,您需要注册自定义帖子。

      You may check Post Types to see how to do it.

    3. 您可以检查帖子类型以了解操作方法。

    Example from WP Codex – for testing, copy and paste code below to theme functions.php

    WP Codex的示例–用于测试,复制下面的代码并将其粘贴到主题函数中。php

      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'=>是,      

    )    

    )    

    );  

    );  

    }

    }

      1. Add shortcode to page or post where you want to use accordion
      2. 在要使用手风琴的页面或帖子中添加简码

      If you used code above to create custom posts type you would use following shortcode:

      如果您使用上面的代码创建自定义帖子类型,则将使用以下短代码:

      [gw_accordion custom_post="Accordion"]

        [gw_accordion custom_post =“ Accordion”]

      Optionally, you may add CSS class

      (可选)您可以添加CSS类

      [gw_accordion custom_post="Accordion" class="my_css_class"]

        [gw_accordion custom_post =“ Accordion” class =“ my_css_class”]

      You can also add code to your theme

      您还可以将代码添加到主题中

        <?php echo do_shortcode('[[gw_accordion custom_post =“ Accordion”');?>

      or with CSS class

      或使用CSS类

        <?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)

      [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”]

      Demo

      演示

        1. Check Demo
        2. 检查演示

        Known Issues

        已知问题

        If your theme use smooth scroll script like this one

        如果您的主题使用像这样的平滑滚动脚本

                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;          

        }        

        }        

        }      

        }      

        });    

        });    

        });

        });

        You may need to change this line

        您可能需要更改此行

         jQuery('a[href*="#"]:not([href="#"]')

          jQuery('a [href * =“#”]:not([href =“#”]')

        To look like this

        看起来像这样

         jQuery('a[href*="#"]:not([href="#"], a:not([data-toggle])')

          jQuery('a [href * =“#”]:not([href =“#”],a:not([data-toggle])')

        to avoid conflict

        避免冲突

安装步骤

    1. Extract downloaded .zip file and upload the extracted folder to the /wp-content/plugins directory, or install the plugin through the WordPress plugins screen directly.
    2. 提取下载的.zip文件并将提取的文件夹上传到 / wp-content / plugins 目录,或直接通过WordPress插件屏幕安装插件。

    3. Activate the plugin through the ‘Plugins’ screen in WordPress – click on “Activate” link below plugin name
    4. 通过WordPress中的“插件”屏幕激活插件–单击插件名称下方的“激活”链接

下载地址
https://downloads.wordpress.org/plugin/custom-post-accordion.zip
-EOF-

AI助手支持GPT4.0