[wordpress插件] Admin Post Navigation管理员发布导航

wordpress 插件 文章 2020-02-04 04:40 633 0 全屏看文

AI助手支持GPT4.0

评分

92

92

描述

This plugin adds “← Previous” and “Next →” links to the “Edit Post” admin page if a previous and next post are present, respectively.

如果存在上一个帖子和下一个帖子,则此插件将“←上一个”和“下一个→”链接添加到“编辑帖子”管理页面。

The link titles (visible when hovering over the links) reveal the title of the previousext post.

链接标题(将鼠标悬停在链接上时可见)显示上一个/下一个帖子的标题。

The links link to the “Edit Post” admin page for the previousext posts so that you may edit them.

链接链接到上一个/下一个帖子的“编辑帖子”管理页面,以便您可以对其进行编辑。

By default, a previousext post is determined by the next lower/higher valid post based on the date the post was created and which is also a post the user can edit.

默认情况下,上一个/下一个帖子由下一个较低/较高的有效帖子确定,具体取决于该帖子的创建日期,并且也是用户可以编辑的帖子。

Other post criteria such as post type (draft, pending, etc), publish date, post author, category, etc, are not taken into consideration when determining the previous or next post.

确定上一个或下一个帖子时,不会考虑其他帖子条件,例如帖子类型(草稿,待审等),发布日期,帖子作者,类别等。

Users can customize how post navigation ordering is handled via the “Screen Options” panel available at the top of every page when editing a post.

在编辑帖子时,用户可以通过每个页面顶部的“屏幕选项”面板自定义如何处理帖子导航顺序。

A dropdown presents options to order navigation by: ‘ID’, ‘menu_order’, ‘post_date’, ‘post_modified’, ‘post_name’, and ‘post_title’.

下拉菜单显示了用于按以下顺序进行导航的选项:“ ID”,“ menu_order”,“ post_date”,“ post_modified”,“ post_name”和“ post_title”。

Post navigation can further be customized via filters (see Filters section).

可以通过过滤器进一步自定义帖子导航(请参阅过滤器部分)。

NOTE: Be sure to save the post currently being edited (if you’ve made any changes) before navigating away to the previousext post!

注意:在导航到上一个/下一个帖子之前,请确保保存当前正在编辑的帖子(如果进行了任何更改)!

Links: Plugin Homepage |

链接:插件主页 |

Plugin Directory Page |

插件目录页面 |

GitHub |

GitHub |

Author Homepage

作者主页

Filters

过滤器

The plugin is further customizable via six filters.

可通过六个过滤器进一步自定义插件。

Such code should ideally be put into a mu-plugin or site-specific plugin (which is beyond the scope of this readme to explain).

理想情况下,应将此类代码放入mu插件或特定于站点的插件中(这不在本自述文件的解释范围内)。

c2c_admin_post_navigation_orderby (filter)

c2c_admin_post_navigation_orderby(过滤器)

The ‘c2c_admin_post_navigation_orderby’ filter allows you to change the post field used in the ORDER BY clause for the SQL to find the previousext post.

通过“ c2c_admin_post_navigation_orderby”过滤器,您可以更改SQL的ORDER BY子句中使用的发布字段,以查找上一个/下一个发布。

By default this is ‘post_date’ for non-hierarchical post types (such as posts) and ‘post_title’ for hierarchical post types (such as pages).

默认情况下,对于非分层帖子类型(例如帖子),这是“ post_date”;对于分层帖子类型(例如页面),这是“ post_title”。

If you wish to change this, hook this filter.

如果您想更改此设置,请钩住此过滤器。

Note: users can customize the post navigation order field for themselves on a per-post type basis via “Screen Options” (see FAQ and screenshot for more info).

注意:用户可以通过“屏幕选项”为每个帖子类型自定义帖子导航顺序字段(有关更多信息,请参阅FAQ和屏幕截图)。

Arguments:

参数:

    • $field (string) The current ORDER BY field
    • $ field(字符串)当前的ORDER BY字段

    • $post_type (string) The post type being navigated
    • $ post_type(字符串)正在导航的帖子类型

    • $user_id (int) The user’s ID
    • $ user_id(int)用户的ID

    Example:

    示例:

    /** 

      / ** 

    * Modify how Admin Post Navigation orders posts for navigation by changing the 

    *通过更改以下内容来修改“管理员发布导航”命令发布导航的方式 

    * ordering of pages by 'menu_order'. 

    *通过“ menu_order”对页面进行排序。 

    * @param string $field The field used to order posts for navigation. 

    * @param string $ field用于订购帖子以进行导航的字段。 

    * @param string $post_type The post type being navigated. 

    * @param string $ post_type正在导航的帖子类型。 

    * @param int $user_id.

    * @param int $ user_id。

    The user's ID. 

    用户的ID。 

    * @return string 

    * @返回字符串 

    */

    * /

    function custom_order_apn( $field, $post_type, $user_id ) {    

    函数custom_order_apn($ field,$ post_type,$ user_id){    

    // Only change the order for the 'page' post type.    

    //仅更改“页面”帖子类型的顺序。    

    if ( 'page' === $post_type ) {        

    if('page'=== $ post_type){        

    $field = 'menu_order';    

    $ field ='menu_order';    

    }    

    }    

    return $field;

    返回$ field;

    }

    }

    add_filter( 'c2c_admin_post_navigation_orderby', 'custom_order_apn', 10, 3 );

    add_filter('c2c_admin_post_navigation_orderby','custom_order_apn',10,3);

    c2c_admin_post_navigation_post_statuses (filter)

    c2c_admin_post_navigation_post_statuses(过滤器)

    The ‘c2c_admin_post_navigation_post_statuses’ filter allows you to modify the list of post_statuses used as part of the search for the prevext post.

    通过“ c2c_admin_post_navigation_post_statuses”过滤器,您可以修改用作搜索上一个/下一个帖子的一部分的post_statuses列表。

    By default this array includes ‘draft’, ‘future’, ‘pending’, ‘private’, and ‘publish’.

    默认情况下,此数组包括“草稿”,“未来”,“待处理”,“私有”和“发布”。

    If you wish to change this, hook this filter.

    如果您想更改此设置,请钩住此过滤器。

    This is not typical usage for most users.

    对于大多数用户而言,这不是典型用法。

    Arguments:

    参数:

      • $post_statuses (array) The array of valid post_statuses
      • $ post_statuses(数组)有效的post_statuses数组

      • $post_type (string) The post type
      • $ post_type(字符串)帖子类型

      Example:

      示例:

      /** 

        / ** 

      * Modify Admin Post Navigation to allow and disallow certain post statuses from being navigated. 

      *修改“管理员帖子导航”以允许和禁止某些帖子状态被导航。 

      * @param array $post_statuses Post statuses permitted for admin navigation. 

      * @param array $ post_statuses允许管理员导航的帖子状态。 

      * @param string $post_type The post type. 

      * @param string $ post_type帖子类型。 

      * @return array 

      * @返回数组 

      */

      * /

      function change_apn_post_status( $post_statuses, $post_type ) {    

      函数change_apn_post_status($ post_statuses,$ post_type){    

      // Add a post status.    

      //添加帖子状态。    

      // Note: by default these are already in the $post_statuses array: 'draft', 'future', 'pending', 'private', 'publish'    

      //注意:默认情况下,这些已经在$ post_statuses数组中:'draft','future','pending','private','publish'    

      $post_statuses[] = 'trash';    

      $ post_statuses [] ='垃圾箱';    

      // Remove post status(es).    

      //删除帖子状态。    

      $post_statuses_to_remove = array( 'draft' );

      $ post_statuses_to_remove = array('draft');

      // Customize here.    

      //在此处自定义。    

      if ( 'page' === $post_type ) {        

      if('page'=== $ post_type){        

      $post_statuses_to_remove[] = 'pending';    

      $ post_statuses_to_remove [] ='待定';    

      }    

      }    

      foreach ( $post_statuses_to_remove as $remove ) {        

      foreach($ post_statuses_to_remove as $ remove){        

      if ( false !== $index = array_search( $remove, $post_statuses ) ) {            

      if(false!== $ index = array_search($ remove,$ post_statuses)){            

      unset( $post_statuses[ $index ] );        

      unset($ post_statuses [$ index]);        

      }    

      }    

      }    

      }    

      return array_values( $post_statuses );

      返回array_values($ post_statuses);

      }

      }

      add_filter( 'c2c_admin_post_navigation_post_statuses', 'change_apn_post_status', 10, 2 );

      add_filter('c2c_admin_post_navigation_post_statuses','change_apn_post_status',10,2);

      c2c_admin_post_navigation_post_types (filter)

      c2c_admin_post_navigation_post_types(过滤器)

      The ‘c2c_admin_post_navigation_post_types’ filter allows you to modify the list of post_types used as part of the search for the prevext post.

      通过“ c2c_admin_post_navigation_post_types”过滤器,您可以修改用作搜索上一个/下一个帖子的一部分的post_types列表。

      By default this array includes all available post types.

      默认情况下,此数组包括所有可用的帖子类型。

      If you wish to change this, hook this filter.

      如果您要更改此设置,请挂钩此过滤器。

      Arguments:

      参数:

        • $post_types (array) The array of valid post_types
        • $ post_types(数组)有效的post_types数组

        Examples:

        示例:

        /** 

          / ** 

        * Modify Admin Post Navigation to only allow navigating strictly for posts. 

        *修改“管理员帖子导航”以仅允许严格导航帖子。 

        * @param array $post_types Post types that should have admin post navigation. 

        * @param array $ post_types应该具有管理员帖子导航的帖子类型。 

        * @return array 

        * @返回数组 

        */

        * /

        function change_apn_post_types( $post_types ) {    

        函数change_apn_post_types($ post_types){    

        return array( 'post' );

        return array('post');

        }

        }

        add_filter( 'c2c_admin_post_navigation_post_types', 'change_apn_post_types' );

        add_filter('c2c_admin_post_navigation_post_types','change_apn_post_types');

        /** 

        / ** 

        * Modify Admin Post Navigation to disallow navigation for the 'recipe' post type. 

        *修改“管理员帖子导航”以禁止导航“食谱”帖子类型。 

        * @param array $post_types Post types that should have admin post navigation. 

        * @param array $ post_types应该具有管理员帖子导航的帖子类型。 

        * @return array 

        * @返回数组 

        */

        * /

        function remove_recipe_apn_post_types( $post_types ) {    

        函数remove_recipe_apn_post_types($ post_types){    

        if ( isset( $post_types['recipe'] ) ) {        

        如果(isset($ post_types ['recipe'])){        

        unset( $post_types['recipe'] );

        unset($ post_types ['recipe']);

        // Removing a post type    

        //删除帖子类型    

        }    

        }    

        return $post_types;

        返回$ post_types;

        }

        }

        add_filter( 'c2c_admin_post_navigation_post_types', 'remove_recipe_apn_post_types' );

        add_filter('c2c_admin_post_navigation_post_types','remove_recipe_apn_post_types');

        c2c_admin_post_navigation_prev_text (filter)

        c2c_admin_post_navigation_prev_text(过滤器)

        The ‘c2c_admin_post_navigation_prev_text’ filter allows you to change the link text used for the ‘Previous’ link.

        通过“ c2c_admin_post_navigation_prev_text”过滤器,您可以更改用于“上一个”链接的链接文本。

        By default this is ‘← Previous’.

        默认情况下,这是“←上一步”。

        Arguments:

        参数:

          • $text (string) The ‘previous’ link text.
          • $ text(字符串)“上一个”链接文本。

          Example:

          示例:

          /** 

            / ** 

          * Changes the text for the 'previous' link to 'Older' output by the Admin Post Navigation plugin. 

          *通过Admin Post Navigation插件将“先前”链接的文本更改为“较旧”输出。 

          * @param string $text The text used to indicate the 'next' post. 

          * @param string $ text用于指示“下一个”帖子的文本。 

          * @return string 

          * @返回字符串 

          */

          * /

          function my_c2c_admin_post_navigation_prev_text( $text ) {    

          函数my_c2c_admin_post_navigation_prev_text($ text){    

          return 'Older';

          返回“较旧”;

          }

          }

          add_filter( 'c2c_admin_post_navigation_prev_text', 'my_c2c_admin_post_navigation_prev_text' );

          add_filter('c2c_admin_post_navigation_prev_text','my_c2c_admin_post_navigation_prev_text');

          c2c_admin_post_navigation_next_text (filter)

          c2c_admin_post_navigation_next_text(过滤器)

          The ‘c2c_admin_post_navigation_next_text’ filter allows you to change the link text used for the ‘Next’ link.

          通过“ c2c_admin_post_navigation_next_text”过滤器,您可以更改用于“下一个”链接的链接文本。

          By default this is ‘Next →’.

          默认情况下,这是“下一步→”。

          Arguments:

          参数:

            • $text (string) The ‘next’ link text.
            • $ text(字符串)“下一个”链接文本。

            Example:

            示例:

            /** 

              / ** 

            * Changes the text for the 'next' link to 'Newer' output by the Admin Post Navigation plugin. 

            *通过Admin Post Navigation插件将“下一个”链接的文本更改为“较新”输出。 

            * @param string $text The text used to indicate the 'next' post. 

            * @param string $ text用于指示“下一个”帖子的文本。 

            * @return string 

            * @返回字符串 

            */

            * /

            function my_c2c_admin_post_navigation_next_text( $text ) {    

            函数my_c2c_admin_post_navigation_next_text($ text){    

            return 'Newer';

            返回“较新”;

            }

            }

            add_filter( 'c2c_admin_post_navigation_next_text', 'my_c2c_admin_post_navigation_next_text' );

            add_filter('c2c_admin_post_navigation_next_text','my_c2c_admin_post_navigation_next_text');

            c2c_admin_post_navigation_display (filter)

            c2c_admin_post_navigation_display(过滤器)

            The ‘c2c_admin_post_navigation_display’ filter allows you to customize the output links for the post navigation.

            通过“ c2c_admin_post_navigation_display”过滤器,您可以自定义帖子导航的输出链接。

            Arguments:

            参数:

              • $text (string) The current output for the prevext navigation link
              • $ text(字符串)上一个/下一个导航链接的当前输出

              Example:

              示例:

              /** 

                / ** 

              * Change the markup displayed by the Admin Post Navigation plugin. 

              *更改Admin Post Navigation插件显示的标记。 

              * @param string $text The text being output by the plugin. 

              * @param string $ text插件输出的文本。 

              * @return string 

              * @返回字符串 

              */

              * /

              function override_apn_display( $text ) {    

              函数override_apn_display($ text){    

              // Simplistic example.

              //简单的示例。

              You could preferably make the text bold using CSS.    

              您最好使用CSS将文本设为粗体。    

              return '' .

              返回''。

              $text .

              $ text。

              '';

              '';

              }

              }

              add_filter( 'c2c_admin_post_navigation_display', 'override_apn_display' );

              add_filter('c2c_admin_post_navigation_display','override_apn_display');

安装步骤

    1. Unzip admin-post-navigation.zip inside the /wp-content/plugins/ directory for your site (or install via the built-in WordPress plugin installer)

      在您站点的 / wp-content / plugins / 目录内

    2. 解压 admin-post-navigation.zip (或通过内置的WordPress插件安装程序安装)

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

    5. Optional: When editing a post type that supports admin navigation (which are all post types by default), use the “Screen Options” menu to customize how navigation is handled.
    6. 可选:在编辑支持管理员导航的帖子类型时(默认为所有帖子类型),请使用“屏幕选项”菜单来自定义导航的处理方式。

    7. Optional: See documentation for available programmatic customizations
    8. 可选:请参阅文档以获取可用的程序自定义

下载地址

https://downloads.wordpress.org/plugin/admin-post-navigation.2.1.zip

https://downloads.wordpress.org/plugin/admin-post-navigation.2.1.zip

-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
[wordpress插件] Activity Notifications for BuddyPress and HipChatBuddyPress和HipChat的活动通知
[wordpress插件] DeMomentSomTres Review EscapadaRuralDeMomentSomTres评论Escapada农村
[wordpress插件] BuddyPress Default Cover PhotoBuddyPress默认封面照片
[wordpress插件] Country Flags国旗
[wordpress插件] downloadmanager下载管理器
随便看看
教育科技公司申请微信支付被拒绝? 3745
微信公众号免300认证教程 4942
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 4060
小程序广告组件通过审核,但是小程序内没有显示广告? 4140
企业微信通讯录账号被管理员误/恶意删除,怎么办? 8001
问题? 7234
如何快速搭建抽奖助手小程序(无需代码知识) 5023
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 5977
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 5500
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 5196