How Do I Create an Image Category in WordPress?
In order to create an image category in WordPress, you will first need to create a new folder inside of your WordPress site. Inside of this new folder, you will need to create a new file called “catalog.
php”.
Within the catalog.php file, you will need to include the following code:
Within the wp_image_category table, you will need to create a new column called “name”. Within this column, you will need to include the following code:
Next, you will need to create a new file called “shortcodes.php” and include the following code within it:
require( ‘wp-blog-header.php’ );
require( ‘image-category.php’ );
add_action( ‘init’, ‘image_category_init’ );
function image_category_init() {
wp_register_script( ‘images/category.js’, ‘https://ajax.googleapis.com/ajax/libs/jquery/1.
11.1/jquery.min.js’, ‘images’ );.
wp_enqueue_script( ‘images/category.js’ );
}
Within the shortcodes.php file, you will need to include the following code:
[image_category id=’1′]
Within the image_category_init() function, you will need to include the following code:
require( ‘shortcodes.php’ );
Now, you will need to create a new file called “images/category.js” and include the following code within it:
/*
* Copyright (c) 2012 – 2016, Wit Studio, Inc. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
*/
var categoryImages = [];
categoryImages.push({
‘name’: ‘WP Default Image’,
‘category’: ‘wp-default-image’
});
‘name’: ‘Image #1’,
‘category’: ‘image-1’
‘name’: ‘Image #2’,
‘category’: ‘image-2’
‘name’: ‘Image #3’,
‘category’: ‘image-3’
‘name’: ‘Image #4’,
‘category’: ‘image.