开发者 |
nelio
davilera |
---|---|
更新时间 | 2016年11月23日 20:01 |
捐献地址: | 去捐款 |
PHP版本: | 3.3 及以上 |
WordPress版本: | 4.3 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
Important Notice This plugin has been re-implemented from scratch and merged into Nelio Content. If you're interested in using external featured images in your blog and receiving updates and support, please install Nelio Content. Upgrade If you're already a user of Nelio External Featured Images, simply replace it with Nelio Content; it implements a better external featured image engine and it's completely compatible with Nelio External Featured Image. Please keep in mind that Nelio External Featured Images is now discontinued and will receive no more updates; new features and support are available in Nelio Content only.Are you using an external service for storing your images? Then you'd probably like to use those images as featured images for your pages and posts. This plugin lets you do this easily! And even better! If you don't specify any featured image, the plugin will use the first image available in the post. Related Plugins by Nelio
Nelio Content is a plugin aimed at helping blog owners run their blog. It's goal is to assist your work with the blog and, therefore, it features an editorial calendar, support for sharing content on social media, and so on. Nelio External Featured Images was designed with the solely purpose of setting external featured images in your posts. Whilst this plugin served its purpose quite well, there were several scenarios in which it simply didn't work. We believe external featured images are very helpful to all users. Therefore, we decided to integrate this plugin's functionality into Nelio Content. However, we didn't simply "duplicate" the code from one plugin to the other; we reimplemented the functionality from scratch and made it compatible with more themes.
No, you don't need to install Nelio Content to keep using the plugin. However, Nelio External Featured Images is now discontinued, and we strongly recommend you to replace it with Nelio Content. We've implemented several improvements in Nelio Content and made it compatible with multiple themes, including Newspaper, Newsmag, and Enfold.
As already stated in the plugin's description, Nelio External Featured Image is now discontinued. However, all its functionality is available in Nelio Content, so you can use Nelio Content to get our support and updates.
Every time an image is uploaded in the media library, WordPress automatically creates alternative versions of that image, each with a different size (thumbnail, medium, large and full). Themes may then choose among these different versions when displaying the an image in a post. Thumbnails do also exist for featured images, and themes may registerd their own alternative image sizes. For example, WordPress' default theme TwentyFourteen defines a thumbnail size called "twentyfourteen-full-width" whose dimensions are 1038x576. This plugin uses the alternative-size information (which your theme uses for rendering a featured image) for scaling and cropping external featured images via CSS on your users' browsers. There are some situations, however, in which this "size" information is not provided. In these scenarios, our plugin relies on theme's CSS file. If the CSS rules define the width and height of the featured image, everything should be fine. Otherwise, you may have to tweak something.
Try adding the following CSS code in your theme:
img.nelioefi { min-width:100px; min-height:100px; }
and refresh your site. If you can see the external featured image, it means
that our plugin works properly, but some CSS tweaking was needed. Now, simply
edit the CSS styles of your theme so that the featured image looks good
everywhere (width
, height
, max-width
, max-height
).
WordPress offers more than one function for inserting featured images.
Unfortunately, only one of them has a filter we can use. If your theme is not
using the (get_)the_post_thumbnail
, then our plugin will not be able to
insert external featured images.
In these cases, the only solution is to tweak your theme and edit some PHP
code. Unfortunately, there's no generic solution for doing it. Just locate
where featured images are being inserted, and edit those lines so that it uses
the previous function (if possible). Please note that the plugin also offers
some helper functions that will ease the "tuning" of the theme (check the file
includes/nelio-efi-main.php to know them and review their documentation).
If you don't specify any featured image, the plugin will use the first image
included in your post. In order to find the image, it looks for img
tags that
looks like the following:
<img src="image-url-here" ... />
The img
tag and the src
attribute have to be "together". Otherwise, our
plugin won't be able to find the featured image.
That's quite easy. Simply add the following line in your theme's functions.php
file:
add_filter( 'nelioefi_use_first_image', '__return_false' );
nelioefi_recommend_nelio_content
and returning false
.img
(i.e. it works with both single and double quotes).the_content
for trying to obtain the
first featured image, when (apparently) no image was included in the post.
This may occur, for example, when a plugin for converting links to images is
used.nelioefi_use_first_image
.img
tag and its src
attribute were side by side. This is no longer
requried.nelioefi_use_first_image
); you can read more about it in the FAQ section.src
attribute of an img
tag
in RSS feeds (instead of an inline CSS background
property).