[wordpress插件] Attach Post Images附加帖子图像

wordpress 插件 文章 2020-02-22 20:20 469 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

Unlike the traditional way of attaching images (or attachments) to posts by inserting them in the post content, this plugin allows you to attach images to posts in a manner

与通过将图片(或附件)插入帖子内容中来将图片(或附件)附加到帖子的传统方式不同,此插件可让您以以下方式将图片附加到帖子中

that lets you control the way the images are later displayed in your theme.

可以控制以后在主题中显示图像的方式。

It adds a metabox to the edit screen that lets you select/upload images (similar to the “Featured Image” metabox).

它在编辑屏幕上添加了一个metabox,可让您选择/上传图像(类似于“ Featured Image” metabox)。

The images attached to a post can then later be gotten by the following means:

随后可以通过以下方式获取帖子中附加的图像:

    • If you are in a WordPress loop then you can use the tag twp_the_post_images($size).

    • 如果您处于WordPress循环中,则可以使用标记 twp_the_post_images($ size)

      $size (string|array) is an optional parameter (defaults to 'thumbnail') and can take values similar to the wp_get_attachment_image_src function.

    • wordpress.org/Function_Reference/wp_get_attachment_image_src“ title =” wp_get_attachment_image_src“ rel =” nofollow“> wp_get_attachment_image_src 函数。

    This will return an array of objects where each object contains information about an image.

    这将返回一个对象数组,其中每个对象都包含有关图像的信息。

      • You can directly call the plugin function twp_get_post_images($post_id, $size).
      • 您可以直接调用插件函数 twp_get_post_images($ post_id,$ size)

      $post_id (int): required – the ID of the post.

      $ post_id(int):必填–帖子的ID。

      $size (string|array): is an optional parameter (defaults to 'thumbnail') and can take values similar to the wp_get_attachment_image_src function.

      //codex.wordpress.org/Function_Reference/wp_get_attachment_image_src“ title =” wp_get_attachment_image_src“ rel =” nofollow“> wp_get_attachment_image_src 函数。

      This will return an array of objects where each object contains information about an image.

      这将返回一个对象数组,其中每个对象都包含有关图像的信息。

        • If you want to display the images directly as an unordered list, then you can use the shortcode [twp_post_images id=post_id size=some_size].

        • 如果要将图像直接显示为无序列表,则可以使用简码 [twp_post_images id = post_id size = some_size]

          The parameters of this shortcode are same as those of the above functions.

          此短代码的参数与上述函数的参数相同。

          You will need some CSS knowledge to style the returned unordered list properly.

        • 您将需要一些CSS知识才能正确设置返回的无序列表的样式。

        The functions twp_the_post_images() and twp_get_post_images() return an empty array if no images were found or an array of objects where each object has the following attributes:

        如果未找到图像,则函数 twp_the_post_images() twp_get_post_images()返回空数组,或者每个对象具有以下属性的对象数组:

        p>

        >

          • id: the attachment id
          • id :附件ID

          • width: The width of the image
          • width :图像的宽度

          • height: The height of the image
          • 高度:图片的高度

          • orientation: The orientation of the image (landscape|protrait)
          • orientation :图像的方向(风景|人物)

          • url: The url of the image
          • url :图片的网址

          • is_original: (boolean) false if $url is a resized image, true if it is the original.
          • is_original :(布尔值)如果$ url是调整大小的图像,则为false;如果它是原始图像,则为true。

          NOTE THAT YOU HAVE TO SAVE/UPDATE YOUR POST EACH TIME YOU MODIFY THE IMAGE SELECTION

          请注意,您每次修改图像选择后都必须保存/更新您的信息

安装步骤

Steps to install this plugin.

安装此插件的步骤。

    1. In the downloaded zip file, there is a folder with name ‘attach-post-images’
    2. 在下载的zip文件中,有一个名为“ attach-post-images”的文件夹

    3. Upload the ‘attach-post-images’ folder to the ‘/wp-content/plugins/’ directory
    4. 将“ attach-post-images”文件夹上传到“ / wp-content / plugins /”目录

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

    7. Read the usage instructions in the description.
    8. 阅读说明中的使用说明。

下载地址
https://downloads.wordpress.org/plugin/attach-post-images.1.0.1.zip
-EOF-

AI助手支持GPT4.0