[wordpress插件] AM Events上午活动

wordpress 插件 文章 2020-02-17 02:00 582 0 全屏看文

AI助手支持GPT4.0

评分
94
描述

The purpose of this plugin is to add an event type similar to the normal post type.

此插件的目的是添加与普通帖子类型类似的事件类型。

By design this plugin doesn’t provide any ready-made layouts, and allows the events to be fully integrated and customized to the theme of your choosing.

根据设计,此插件不提供任何现成的布局,并且可以将事件完全集成并根据您选择的主题进行定制。

Current Features

当前功能

    • Admin pages to view/create/modify events.
    • 用于查看/创建/修改事件的管理页面。

    • Available data fields for events: start date, end date, venue, category
    • 事件的可用数据字段:开始日期,结束日期,地点,类别

    • Create weekly or biweekly recurring events
    • 创建每周或每两周一次的定期活动

    • Fully customizable widget for displaying upcoming events.
    • 完全可定制的小部件,用于显示即将发生的事件。

    The custom post type created by the plugin is named ‘am_event’ and has two taxonomies: ‘am_event_categories’ and ‘am_venues’.

    由插件创建的自定义帖子类型名为“ am_event”,并具有两个分类法:“ am_event_categories”和“ am_venues”。

    Dates are stored as post metadata.

    日期存储为帖子元数据。

    Displaying the events is done in the theme files using WP_Query and the template tags provided by the plugin.

    使用WP_Query和插件提供的模板标签在主题文件中完成事件的显示。

    This allows full control over the layout and what elements to show.

    这样可以完全控制布局以及要显示的元素。

    The widget for displaying upcoming events uses a simple template system for full control of the layout.

    用于显示即将发生的事件的小部件使用简单的模板系统来完全控制布局。

    If you think something critical is missing, feel free to send me a request.

    如果您认为缺少重要的信息,请随时向我发送请求。

    The plugin is available in the following languages (pot-file included for additional translations):

    该插件提供以下语言版本(包含壶文件以进行其他翻译):

      • English
      • 英语

      • French
      • 法语

      • Norwegian
      • 挪威语

      • Finnish
      • 芬兰语

      TUTORIAL

      教程

      For integrating AM Events to an existing theme, I suggest creating a child theme with custom page templates.

      为了将AM事件集成到现有主题,我建议使用自定义页面模板创建子主题

      You can find an example of a working Twenty Twelve child theme from https://github.com/

      您可以从 https://github.com/中找到有效的二十二岁儿童主题的示例。

      attemoi/am-events-child-theme containing three different page templates for event pages.

      attemoi / am-events-child-theme 包含事件页面的三种不同页面模板。

      Widget

      小部件

      Here are the shortcodes available in the upcoming events widget template.

      这是即将发生的事件小部件模板中可用的简码。

        • [event-title]
        • [事件标题]

        • [start-date]
        • [开始日期]

        • [end-date]
        • [结束日期]

        • [event-venue]
        • [活动场地]

        • [event-category]
        • [事件类别]

        • [content]
        • [内容]

        • [thumbnail]
        • [缩略图]

        • [excerpt]
        • [摘录]

        • [permalink]
        • [永久链接]

        • [meta]
        • [元]

        Conditional shortcodes:

        有条件的简码:

          • [if cond=”startdate-is-enddate”]
          • [如果cond =” startdate-is-enddate”]

          • [if cond=”startdate-not-enddate”]
          • [如果cond =” startdate-not-enddate”]

          • [if cond=”startday-is-endday”]
          • [如果cond =“开始日期是结束日期”]

          • [if cond=”startday-not-endday”]
          • [如果cond =” startday-not-endday”]

          • [if cond=”has-venue”]
          • [如果cond =”有场地”]

          • [if cond=”has-category”]
          • [如果cond =”具有类别”]

          The title can be linked to the event post with the ‘link’ attribute, e.g.

          可以使用“链接”属性将标题链接到事件信息,例如

          [event-title link=true]

          [event-title link = true]

          The category and venue can also be linked similarly to their respective archive pages using the ‘link’ attribute, e.g.

          类别和地点也可以使用“链接”属性(例如,

          [event-category link=true]

          [event-category link = true]

          The number of words displayed in the title, content or excerpt can be limited by the ‘limit’ attribute, e.g.

          标题,内容或摘录中显示的单词数可以通过“限制”属性来限制,例如

          [content limit=25] or [event-title limit=10].

          [内容限制= 25]或[活动标题限制= 10]。

          The dates can be formatted using the ‘format’ attribute, e.g.

          日期可以使用“格式”属性设置格式,例如

          [start-date format='dmY H:i'] (see PHP date

          [开始日期格式='dmY H:i'](请参见 PHP日期

          for formatting options).

          用于格式化选项)。

          If no format is given, the default WordPress date format is used.

          如果未提供任何格式,则使用默认的WordPress日期格式。

          You can use any shortcode as many times as needed in a single template.

          您可以在单个模板中根据需要多次使用任何简码。

          To separate date and time of start date for example you could write:

          例如,要分隔开始日期的日期和时间,您可以编写:

          [start-date format='d.m.Y']

            [开始日期格式='d.m.Y']

          divider

          除法器

          [start-date format='H:i']

          [开始日期格式='H:i']

          Example usage of conditional shortcode:

          条件简码用法示例:

          [start-date format='D d.m.Y H:s']

            [开始日期格式='D d.m.Y H:s']

          [if cond='startdate-not-enddate'] 

          [如果cond ='startdate-not-enddate'] 

          - [end-date format='D d.m.Y H:s']

          -[结束日期格式='D d.m.Y H:s']

          [/if]

          [/如果]

          Template tags

          模板标签

          Template tags were introduced in version 1.3.0 and are listed below.

          模板标记是在1.3.0版中引入的,并在下面列出。

          More documentation can be found in the source files.

          在源文件中可以找到更多文档。

          // Template tags for getting and displaying event dates

            //用于获取和显示事件日期的模板标签

          am_the_startdate($format = 'Y-m-d H:i:s', $before = '', $after = '', $echo = true)

          am_the_startdate($ format ='Y-m-d H:i:s',$ before ='',$ after ='',$ echo = true)

          am_get_the_startdate( $format = 'Y-m-d H:i:s', $post = 0 )

          am_get_the_startdate($ format ='Y-m-d H:i:s',$ post = 0)

          am_the_enddate($format = 'Y-m-d H:i:s', $before = '', $after = '', $echo = true)

          am_the_enddate($ format ='Y-m-d H:i:s',$ before ='',$ after ='',$ echo = true)

          am_get_the_enddate( $format = 'Y-m-d H:i:s', $post = 0 )

          am_get_the_enddate($ format ='Y-m-d H:i:s',$ post = 0)

          // Template tags for getting and displaying event venues

          //用于获取和显示活动场所的模板标签

          am_get_the_venue( $id = false )

          am_get_the_venue($ id = false)

          am_in_venue( $venue, $post = null )

          am_in_venue($ venue,$ post = null)

          am_get_the_venue_list( $separator = '', $parents='', $post_id = false )

          am_get_the_venue_list($ separator ='',$ parents ='',$ post_id = false)

          am_the_venue( $separator = '', $parents='', $post_id = false )

          am_the_venue($ separator ='',$ parents ='',$ post_id = false)

          // Template tags for getting and displaying event categories

          //用于获取和显示事件类别的模板标签

          am_get_the_event_category( $id = false )

          am_get_the_event_category($ id = false)

          am_get_the_event_category_list( $separator = '', $parents='', $post_id = false )

          am_get_the_event_category_list($ separator ='',$ parents ='',$ post_id = false)

          am_in_event_category( $eventCategory, $post = null )

          am_in_event_category($ eventCategory,$ post = null)

          am_the_event_category( $separator = '', $parents='', $post_id = false )

          am_the_event_category($ separator ='',$ parents ='',$ post_id = false)

          Example of displaying the first category of the current event post:

          显示当前事件帖子的第一类别的示例:

          $categoryArray = am_get_the_event_category();

            $ categoryArray = am_get_the_event_category();

          echo $categoryArray[0]->name;

          Creating a WP_Query

          echo $ categoryArray [0]-> name;

          创建WP_Query

          The custom post type is named ‘am_event’

          自定义帖子类型被命名为“ am_event”

          The taxonomies are named ‘am_venues’ and ‘am_event_categories’.

          分类法被命名为“ am_venues”和“ am_event_categories”。

          The event post has metadata named ‘am_startdate’ and ‘am_enddate’ that are formatted like ‘yyyy-mm-dd hh:mm’

          该事件帖子包含名为“ am_startdate”和“ am_enddate”的元数据,其格式类似于“ yyyy-mm-dd hh:mm”

          So suppose I wanted to display all events with a category of ‘other’ and venue ‘mcdonalds’.

          因此,假设我想显示所有类别为“其他”和地点为“麦当劳”的事件。

          I would then make a WP_Query like this:

          然后,我将像这样进行WP_Query:

          $args = array(        

            $ args = array(        

          'post_type' => 'am_event',        

          'post_type'=>'am_event',        

          'post_status' => 'publish',        

          'post_status'=>'发布',        

          'tax_query' => array(                

          'tax_query'=>数组(                

          'relation' => 'AND',                

          'relation'=>'AND',                

          array(                    

          数组(                    

          'taxonomy' => 'am_venues',                    

          'taxonomy'=>'am_venues',                    

          'field' => 'name',                    

          'field'=>'name',                    

          'terms' => 'mcdonalds',                

          'terms'=>'mcdonalds',                

          ),                

          ),                

          array(                    

          数组(                    

          'taxonomy' => 'am_event_categories',                    

          '分类法'=>'am_event_categories',                    

          'field' => 'name',                    

          'field'=>'name',                    

          'terms' => 'other'                

          '条款'=>'其他'                

          ),        

          ),        

          ),    

          ),    

          );

          );

          $the_query = new WP_Query($args);

          $ the_query =新的WP_Query($ args);

          if ($the_query->have_posts()) {    

          如果($ the_query-> have_posts()){    

          while ($the_query->have_posts()) {        

          而($ the_query-> have_posts()){        

          $the_query->the_post();        

          $ the_query-> the_post();        

          $postId = $post->ID;        

          $ postId = $ post-> ID;        

          // Use template tags to get start and end date        

          //使用模板标签获取开始和结束日期        

          $startDate = am_get_the_startdate('Y-m-d H:i:s');        

          $ startDate = am_get_the_startdate('Y-m-d H:i:s');        

          $endDate = am_get_the_enddate('Y-m-d H:i:s');        

          $ endDate = am_get_the_enddate('Y-m-d H:i:s');        

          // Use template tags to get venues and categories in an array        

          //使用模板标签获取数组中的场所和类别        

          $venues = am_get_the_venue( $postId );        

          $ venues = am_get_the_venue($ postId);        

          $eventCategories = am_get_the_category( $postId );        

          $ eventCategories = am_get_the_category($ postId);        

          // All the other functions used for posts like        

          //用于帖子的所有其他功能,例如        

          // the_title() and the_content() work just like with normal posts.        

          // the_title()和the_content()就像普通帖子一样工作。        

          // ... DISPLAY POST CONTENT HERE ... //    

          // ...在此处显示帖子内容... // //    

          }

          }

          }

          }

          If you want the events ordered by start date, add the following to $args:

          如果您希望事件按开始日期排序,请将以下内容添加到$ args中:

          'orderby' => 'meta_value',

           'orderby'=>'meta_value',

          'meta_key' => 'am_startdate',

          'meta_key'=>'am_startdate',

          'order' => 'ASC',

          '订单'=>'ASC',

          If you need to display only upcoming events, add the following meta_query argument to $args:

          如果仅需要显示即将发生的事件,请将以下meta_query参数添加到$ args:

          'meta_query' => array(        

           'meta_query'=>数组(        

          array(            

          数组(            

          'key' => 'am_enddate',            

          'key'=>'am_enddate',            

          'value' => date('Y-m-d H:i:s', time()),            

          '值'=>日期('Y-m-d H:i:s',time()),            

          'compare' => ">",        

          '比较'=>“>”,        

          ),

          ),

          ),

          ),

          The plugin folder also contains a file “examples.php”, which contains an example function for displaying upcoming events in a table.

          plugin文件夹还包含一个文件“ examples.php”,其中包含一个用于在表中显示即将发生的事件的示例函数。

安装步骤

This section describes how to install the plugin and get it working.

本节介绍如何安装插件并使其正常工作。

    1. Upload folder am-events to the /wp-content/plugins/ directory
    2. 将文件夹 am-events 上载到 / wp-content / plugins / 目录

    3. Activate the plugin through the ‘Plugins’ menu in WordPress
    4. 通过WordPress中的“插件”菜单激活插件

下载地址
https://downloads.wordpress.org/plugin/am-events.1.13.1.zip
-EOF-

AI助手支持GPT4.0