Use N4BT-Thumbnails to add featured images to WordPress categories/tags

Article directory [hide]

  • Plug-in configuration items
  • Get image
  • Plug-in download

The N4BT-Thumbnails plug-in is a set of plug-ins that extend WordPress {taxonomy}category/tag images. It can provide customized image upload functions for your WordPress categories, and provides a rich calling interface.

Use N4BT-Thumbnails plugin requires PHP or read basic HTML, you may need to modify their own under the theme directory functions.phpcode file and image related placements in order to achieve the desired effect.

In the functions.phpAdd the following code at the bottom file, it can all {taxonomy}use image features functional classification \ tab.

/*
    Create classified featured images
*/
new N4BT_ThumbnailsTaxonomy(array(
    'name' =>'category_cover'
));

Plug-in configuration items

array(
    'name' =>'category_image',
    'labelname' =>'',
    'mediaform' => array(
        'title' =>''
        'botton'=>'' 
    ),
    'taxonomy' =>'',
    'multiple' => false,
    'number' => 1
)
Attributes description
name Required. The name of the image, in English string format, used to obtain image-related content
labelname Optional (default “featured image”). The label displayed when uploading the image
mediaform  
title Optional (default “OK”). The title displayed in the pop-up image upload window
botton Optional (default “OK”). The name of the insert button displayed in the pop-up picture upload window
taxonomy Optional (default “{taxonomy}”). Classification of featured images is required
multiple Optional (default “false”). Fill in true to indicate that multiple pictures need to be uploaded, if only one needs to be uploaded, it is recommended to set to false
number Optional (default “1”). The number of pictures uploaded is limited. If multiple is set to true, only one upload is supported, and the modification here is invalid

 

Get image

The N4BT-Thumbnails plug-in provides some interfaces to obtain related content

/*
    This interface can get the picture address of the image, and the returned content format is Array array.
    $item_id must be the category id
    $name must be the image name, corresponding to the name in the table above
*/
<?php get_n4bt_thumbnail_urls($key,$name); ?>

Output name for category_coverthe image

// functions.php
new N4BT_ThumbnailsTaxonomy(array(
    'name' =>'category_cover'
));

// Related pages
<?php
    $images = get_n4bt_thumbnail_urls( category ID ,'category_cover');
    echo $images[0]; // Whether it is one or more pictures, the returned array is
?>

Plug-in download

You can search for “N4BT-Thumbnails category\tag image extension plugin” on the “install plugin” page of the WordPress backend, or go to the WordPress.org plugin page to view details and download manually.

For documentation, please refer to the official:https://nnnn.blog/n4bt-thumbnails.html

In fact, the number of pictures limit has no effect, but it is recommended to set it. The specific limit will be added in the next version. If you have any suggestions, please go to the official message.

Leave a Reply

Your email address will not be published. Required fields are marked *