[wordpress插件] Better Adjacent Post Links更好的相邻帖子链接

wordpress 插件 文章 2020-03-04 00:30 448 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

If you are used to link the 'previous' and 'next' posts on a wordpress blog using their own title, you have probably noticed how more often than not too long titles can cause broken lines, hence unpredictable results in terms of

如果习惯于使用自己的标题链接wordpress博客上的“上一个”和“下一个”帖子,则您可能已经注意到标题出现折断的频率多于多少(而不是太长),因此,在

page layout.

页面布局。

The only workaround in wordpress so far was to replace the title of the posts with generic phrases like ‘next post’, ‘previous post’ and so on.

到目前为止,wordpress中唯一的解决方法是将帖子标题替换为“下一个帖子”,“上一个帖子”等通用短语。

With this plugin you can use the title of the post itself, and trim it as needed.

使用此插件,您可以使用帖子本身的标题,并根据需要进行修剪。

Features:

功能:

    • limits the length of the previous and next post titles to the number of characters you want
    • 将上一个和下一个帖子标题的长度限制为所需的字符数

    • where necessary, truncates the title to the last space, adding three dots
    • 必要时将标题截断到最后一个空格,并添加三个点

    • shows the entire title of the post in the tooltip (mysteriously wordpress never considers the tooltips of the links)
    • 在工具提示中显示帖子的整个标题(神秘的wordpress从未考虑链接的工具提示)

    • sets the string that conditionally will appear before the link title, only if the link title itself is present (previously in wordpress you either had to add a string outside of the 'next/previous post' tag, thus causing it to appear

    • 设置仅在链接标题本身存在的情况下有条件地出现在链接标题之前的字符串(以前在wordpress中,您必须在'next / previous post'标记之外添加字符串,从而导致它出现

      in the page even if the link was not present, or you had to add the string inside the link generated by wordpress, with ugly results: for example if the string was just a simple dividing character like '|')

    • 即使该链接不存在,或者您必须在wordpress生成的链接中添加字符串,结果却很难看:例如,如果该字符串只是一个简单的除法字符,例如'|')

安装步骤

Extract, upload to the plugins folder of your wordpress install, activate.

提取并上传到您的wordpress安装的plugins文件夹中,然后激活。

How to use:

使用方法:

This plugin adds two specific functions to your wordpress install: my_prev_post_link and my_next_post_link.

此插件为您的wordpress安装添加了两个特定功能: my_prev_post_link my_next_post_link

These two functions are very similar to, and support the same variables of the original wordpress tags they are meant to replace (please refer to the relative wordpress codex pages for their use), previous_post_link and next_post_link

这两个功能非常相似,并支持它们要替换的原始wordpress标签的相同变量(请参考相对的wordpress Codex页面以供使用), previous_post_link next_post_link

.


My replacement functions anyway come with two additional variables: $string_lenght and $pre_link.

无论如何,我的替换函数都带有两个附加变量: $ string_lenght $ pre_link

Not that you really needed to know how they were called.

并不是您真的需要知道它们的名字。

The first variable indicates the maximum length for the title (default is 22 characters).

第一个变量表示标题的最大长度(默认为22个字符)。

The second the string to be displayed before the link (only if the link itself is present).

在链接之前显示的第二个字符串(仅当链接本身存在时)。

So, you’ll just have to replace

因此,您只需要替换 <?php next_post_link();

?> in your template with , obviously indicating between the brackets the variables you want to specify.

在模板中使用 <?php my_next_post_link()?> 的?> ,显然在括号之间指示要指定的变量。

Again, refer to the wordpress codex for usage of variables: only keep in mind that my two additional variables, $string_lenght and $pre_link, are the second last and last variable of

再次,请参阅wordpress Codex以了解变量的用法:请切记,我的另外两个变量 $ string_lenght $ pre_link 是第二个和最后一个变量

the function.

功能。

下载地址
https://downloads.wordpress.org/plugin/better-nearby-posts-links.1.1.zip
-EOF-

AI助手支持GPT4.0