Internet Windows Android

Set post image in WordPress. How to Fix Common Image Errors in WordPress

To the site, and today. The presence of an image on a website page is a necessary attribute. The picture explains the content; visitors perceive the information better. It dilutes the so-called “sheet” of the text, the reader’s eyes temporarily rest.

Setting Up Media Files in WordPress

Inserting an image into WordPress will not cause any difficulties. But I’ll start with other, no less important information. Many sites give instructions on how to insert a picture into wordpress text, but for some reason no one talks about the settings. After installation you need to run . In chapter Settings ⇒ Media files By default you will see this picture.

Please note that each field has dimensions in pixels. I strongly recommend setting all values ​​to Zero! And that's why. When adding an image to a site, wordpress also creates three! copies of this image. The total is 4! (taking into account download size) copies.

On the hosting in the folder wp-content/uploads you will find 4 files.

Now imagine that you will insert a lot of images into WordPress. You will quickly take up your hosting disk space (with unnecessary! files), and you will have to upgrade to a more expensive tariff plan. By the way, the one I use has pretty good conditions and rates.

So again, set all values ​​to zero! It is also necessary and advisable to insert only . But this is a topic for another article.

Let's move on directly to how to insert a WordPress image.

How to insert an image into WordPress

We believe that the computer has already prepared images for installation on site pages or in posts. In a text editor, place the cursor in the desired place in the entry and press Add media file.

  1. Upload a file from your computer.
  2. Load the file from the wordpress library.
  3. Paste from the site.

Add an image from your computer

Click Upload files ⇒ Select files. In the window that opens, select a file from your computer. It's simple.

Add an image from the wordpress library

In the WordPress console on the tab Media files press Add new.

And download the necessary files from your computer.

Insert an image into WordPress from the site

In order to insert an image from the site into WordPress, you need to click Paste from site and indicate the URL of the image. If you don't know where to get the URL, I'll tell you. On the site, hover your mouse over the image and right-click. In the drop-down window, select Copy image address.

Setting up a WordPress image

No matter how you upload the image to WordPress, you need to make settings.

Heading- name of the picture. You can specify a keyword.

Signature— when you fill out this field, this entry will be visible under the picture on the site.

alt attribute— this field is required. Search robots read exactly this attribute. If there is no webmaster in the panel, there will be a warning about an error on the site. Also, if the visitor does not see the image for some reason, they will see this post. It is advisable to write here the key phrase for which you are promoting the article.

Description- this field is also for search engines. You don't have to fill it out.

Alignment- everything is clear here. Specify where the image will be located on the page.

  • Custom URL - specify the website address where the visitor will be redirected when clicked.
  • Media file - when clicked, the image will open without the website.
  • Attachment page - when clicked, the image will open on the page with the site design.
  • No - no action will occur when clicked. The picture is not active.

That seems to be all. Such a simple question, but the article turned out to be quite lengthy. I think now you will be able to perform this action with ease.

Good luck! Decorate your WordPress site with useful and beautiful images.

Amazing feature in WordPress!

I'll start from scratch. So first you need to understand the difference between thumbnails and regular post images. A thumbnail is something like a preview of a post; it may not even be used in the post itself.

Suppose you have some kind of category, and on the page of this category, before some posts (and maybe before each) there is some kind of picture, which is essentially a preview of the post, i.e. miniature. If we go to the page of one of the posts, we may or may not find this image in its content.

In general, okay, in a nutshell, a thumbnail is a preview image for posts that:

  • may or may not be used in post content,
  • can be displayed along with a link to the post on the pages of categories, tags, archives, etc.,
  • can be automatically adjusted to a certain size (I mean image resolution),

In fact, you can even use it as a website background, i.e. each entry has its own background.

Step 1: Enable Thumbnail Support for Your WordPress Theme

In order to use thumbnails on your site, you must first enable them, because by default this functionality is turned off.

All we need to do to activate the thumbnails is paste the following line of code into your functions.php file (there can be many files with this name - we need the one that is located directly in the folder with your current theme).

If you don't want to use thumbnails in all of them at once, you can connect them, for example, only for posts:

or only for posts and only for pages:

add_theme_support( "post-thumbnails" , array ( "post" , "page" ) ) ;

Is it possible to assign a thumbnail to a WordPress taxonomy?

By standard means - no. You can use any of the plugins that add for (including categories and tags), or write the image URL in the description of your specific taxonomy element.

Step 2. How to set a thumbnail for a post?

In general, there are two ways to install thumbnails through the admin panel. They are not particularly different from each other - you can use the one that seems more convenient to you.

Method 1. Metabox “Post Thumbnail”

He's like this:

">

">

This example displays post titles (function) and post thumbnails with links (function) to the post itself.

The same example for the function:

">

">

Getting the thumbnail URL using wp_get_attachment_image_src() and get_post_thumbnail_id()

If you need help with your website or maybe even development from scratch - .

Those who have at least once inserted more than 5 images into a post have encountered the following problem: you cannot add images at once; this is not possible in the standard WordPress functions. Every time you have to open the image insertion window in the editor, go to the gallery, select the desired picture and only then insert it onto the site. A total of 4 unnecessary clicks on each image is an unforgivable waste of time. Imagine how I suffered in a post about the island of Koh Samui in Thailand, which contains more than 20 photos. True, I didn’t do everything through the editor, but copied the code and changed only the url of the photos, which also cannot be called convenient.

Since I plan to continue posting photos from my travels, I decided to deal with this inconvenience and look for a plugin. After a long search, a solution was found - the Faster image insert plugin. I downloaded version 2.2.0. It integrates fully with WordPress media and allows you to add photos in just one click. The plugin is displayed below the content field.

In this case, you can load all images at once through the engine’s standard flash loader. After this, you need to wait a little until the checkboxes appear, then select the desired files and click “Insert selected images”.

Then all you have to do is add a little text to describe the images and your post is ready!

By the way, have you noticed this arrow in Google results?

There are a lot of plugins for working with images for WordPres. But in this article, we will look at the internal WordPress tool for inserting images into a post. With its help, you can insert both individual photos and entire galleries. Moreover, both images and galleries can be customized as desired.

General Image, Photo and Gallery Settings in WordPress Articles

On the site you can set the size of the displayed images. To do this, log in to your WP site. In the console menu you need the Options→Media files item.

The default image settings page for inserting into articles will open. Here we see three options for image sizes: thumbnail size, medium size, large size.


I’ll explain why three photo sizes are needed. When inserting an image into an article, in the editor in the “Add Media File” form, Wordpress offers a choice of three image sizes. It is the parameters that you set in these settings that will be offered for insertion into articles.

Article thumbnail

In addition, when publishing an article, you will be asked to create a thumbnail for the article. This thumbnail will be attached to the article and reflected in various widgets and will be the business card of the article.

To properly display an article thumbnail on Facebook, the thumbnail size must be at least 200x200.

The size of the thumbnail is set in the template during its layout. To have large thumbnail images proportionally cropped to fit the thumbnail size, check the special checkbox in Options>>>Media.

Set the Large Size parameter to the maximum value of 1024x1024. But if you want images on the entire site to be limited to certain sizes, set these sizes in this settings item.

Uploading files

The next menu item deserves attention; it is downloading files.

All site photos are uploaded to the so-called “Media Library” of your site. Images are loaded immediately in three sizes specified in the settings above.

If in the settings of media files in the item “Place the files I downloaded in folders by month and year”, check the box

Then the images will be loaded into the following directory:

Note:

  1. If you upload a photo when writing an article, the photo is linked to this article.
  2. If for some reason you edit a photo when editing an article, then all photo edits remain in the library; they are not automatically deleted.
  3. If you upload a photo directly to the Media library, the photo is considered unlinked.

Linked and unlinked photos

I’ll explain what it means and the difference between linked and unlinked photos. All photos associated with this article can be shown in the article as a simple WordPress gallery, by default. To create a simple gallery, you don’t need to install additional plugins; you just need to place a short code for the gallery in the visual editor anywhere in the article. WordPress galleries by default can be customized, short codes for different types of galleries are below.

I’ll go into more detail on how to insert individual images and photo galleries into articles.

How to insert an image into a WP article

The WordPress editor allows you to fully insert images, photos and galleries into WordPress articles. This is done quite simply. I will illustrate this with an example in screenshots.

  • Open Console→Records→Add new.
  • To insert a photo into the article, click “Add media file”.

  • We select a photo either from a computer, or from the Internet via URL, or from a library of previously downloaded photos or a website.

Before adding a photo to the article (on the right), select the photo size to install in the article, write alt tags, photo title, and, if desired, photo description.

  • In the “Link” column, set it to “Media file” in the screenshot. If plugins that open photos in modal windows are not installed, the photo will open in a separate window.

  • If you set not “Media file”, but “Attachment page”, then the photo will open first as a site page with a photo (attachment file), and only then in a separate window, like a photo.
  • You can correct the display of the photo when editing the photo. Read below “Insert a photo” into an article or page.

edit photo

Editing and finalizing photos in the article

In the editor, you can further customize the display of photos. To do this, click on the photo in the editor and select the edit icon.

In the article photo settings you can change:

  • Location (3) (Left, Center, Right, None)
  • Resize (4) (proportional);
  • Select the link that will open when you click on the photo (5) (None, Media file, Attachment page, Custom URL);

edit photo

If you select “Attachment page”, the photo will open in a separate window, under its URL attachment. If you set “Media file”, then the photo will open as a photo on a separate page or in pop-up windows if you use plugins for displaying photos in pop-up windows (such as Lightbox). “Custom URL” will take the user who clicks on the photo to the specified URL.

  • Additional settings: you can add a border style, horizontal and vertical padding (on the latest versions of WordPress, “Styles” does not work).


Border Style Example: border: 5px solid red;

How to Insert a Gallery in a WordPress Article

To insert a gallery into an article, you need to:

  • Select “Insert gallery”;
  • Select “Upload photo”;
  • Select the photos you need for the gallery on your computer;
  • Set up gallery display: number of columns and order of photo display;
  • Click "Insert Gallery".

The size of the thumbnails in the gallery will correspond to the set thumbnail sizes in the tab (Options→Media).

Adding galleries using shortcodes

Galleries can be created using WordPress shortcodes in a text editor (HTML) on the Edit page. To do this, switch to a text editor (the “Text” button at the top right of the editor) and paste the desired code from those shown below.

Enclose all gallery codes in WordPress articles in square brackets, [code here]

//Simple Gallery of photos attached to an article gallery// //Gallery with 5 columns// gallery columns="5" //Gallery linked to a media file,// //when clicked, the image itself opens, not its page// gallery link="file" order="DESC" columns="5" //Add (exclude)/remove (include) photos by their ID (87,11 /23,39,45). gallery exclude="87,11" include="23,39,45" //Gallery from other posts by photo ID// gallery id="333" //Gallery indicating photo size, small, // //medium and large sizes, defined in the setting. Media files in the console // gallery size="medium" or gallery size="large"

Add a gallery with photos attached to the article

All photos that you download from the editor when writing an article are attached to this article, and the system creates an attachment. You can also link photos from your media library to your article.

All photos attached to the article can be displayed anywhere in the article by inserting a simple short code for the gallery in WordPress articles: gallery in square brackets (). After that, all photos attached to this article will appear in the article as a gallery.

  • Let me explain. To create a simple gallery on your website, You don’t have to insert photos into articles in the editor.
  • Create an article, insert the short code from the list above in the desired place in the text.
  • You save the article; you don’t have to publish it.
  • Next, we go to the Media Library, upload the required number of photos for the gallery and attach them all to our post.
  • You can also add a gallery to any article from the Media Manager or add galleries to WordPress articles without entering the article editor.