Attachments

How to Create Image Slider without Plugin (almost)

In this tutorial I am going to show you how you can easily create your own WordPress image carousels or sliders without overloading your website with tons of plugins.

A quick disclaimer though – in case you’re using Block Editor (Gutenberg), then probably a better idea would be to create a block for that purpose or to install Simple Carousel Block created by me.

But in this tutorial we are going to use just custom fields (or options) and an external carousel JavaScript library.

How to Create a Shared Media Library in Multisite Network

Every once in a while I am receiving questions about my Simple Multisite Crossposting plugin whether it works with shared media library plugins or not (yes – it works). And when I decided to test it I figured it out that there are multiple shared media library plugins out there and every one of them works a little bit differently.

The key idea of most of these plugins is to store all the media on one “main” blog and not necessarily it should be the blog with ID = 1. Then some of them use switch_to_blog() function every time you’re working with attachments on subsites, the other ones even create attachments in database linked to original files on all subsites (I assume it could lead to issues by the way).

Most of all I like a switch_to_blog() approach because it seems unharmful, you can even stop using network media library any time, just deactivate the plugin and continue to use your websites as usual.

How to Use Image Uploader in WordPress Admin Area

In this tutorial I am going to dive deep in WordPress media uploader functionality. By the way it is possible to implement not for only images but for any supported file types.

This is how it looks in WordPress admin area:

Image uploader field in WordPress option pages
Below in this tutorial I will also describe how to create a settings page like this.

Featured Images in an Admin Column and in Quick Edit

In this tutorial I am going to show you how to do two things at the same time:

  1. Add an admin column for WordPress featured images of any post type.
  2. Add a quick edit option for featured images.

Multiple Image Upload Metabox

I had so many requests about multiple image uploads in comments in this tutorial, so I decided to create a separate tutorial specifically about that.

Our goal is to create something like this:

Multiple image upload metabox
So we can not only select multiple images but even sort or delete them after selection.

Guys, there are actually two ways of creating a meta box like that, the first way is an easy-breezy way, but you have to install my Simple Fields plugin first, the second way – is to do everything manually from scratch. But please do not worry, no matter what method you choose, I am going to cover both of them in this tutorial.

Upload Files to Media Library Programmatically

When you upload files to your website using media uploader in admin area, WordPress usually handles everything for you. So all the uploaded files automatically appear in WordPress media library and after that can be easily managed, inserted to posts etc.

But when you create some custom functionality, or maybe forms on your website front-end, you should handle it by yourself. And in this tutorial I will show you how.

add images to WordPress media library programatically
It is easier to organize your uploaded images using WordPress Media Library. Photos by me.

In this tutorial we are going to take a look on two scenarios:

  1. When upload images from url (not only images of course),
  2. When upload files using a form.

How to Create File Uploader on Checkout Page

In this tutorial I will show you step by step how to add a file uploader field to WooCommerce checkout page without any plugins.