• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 521
  • Last Modified:

Wordpress Image Gallery plugin Needed

Hi all,

I am looking into inserting some images into a wordpress page where to images would be the Categories and when clicked it would link to a gallery of sub images

For example on the page you get the category: "Florida Images" and when I click on the image it will show all the floria images.

Does anyone know of any Wordpress plugin that works this way?

1 Solution
I don't know how may posts you have that already exist, but this sounds like a perfect use for Custom Post Types and Taxonomies. Basically you could set up custom post types for your categories and the images would be the post thumbnails that were in the Custom Post Type category. You could use the taxonomies as sub-cat's or tags etc...

Here is a link to some good info about custom post types:
Custom Post Type UI Plugin

Justin Tadlock on Custom Post Types:

Here is a quick start I've put together using several resources and combing them into one that adds a custom post type, taxonomy and takes care of the re-writes:

Step one:
I make a new page template and name it portfolio-options.php and add my options for the custom post type:
add_action('init', 'create_portfolio');
  function create_portfolio() {
    $portfolio_args = array(
        'label' => __('Portfolio'),
        'singular_label' => __('Portfolio'),
        'public' => true,
        'show_ui' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'rewrite' => true,
        'supports' => array('title', 'editor', 'thumbnail')
    register_post_type('portfolio', $portfolio_args);

add_action("admin_init", "add_portfolio");
add_action('save_post', 'update_website_url');

  function add_portfolio(){
    add_meta_box("portfolio_details", "Portfolio Options", "portfolio_options", "portfolio", "normal", "low");

function portfolio_options(){
  global $post;
         $custom = get_post_custom($post->ID);
         $website_url = $custom["website_url"][0];
    <div id="portfolio-options">
      <label>Website URL:</label><input name="website_url" value="<?php echo $website_url; ?>"/>
    </div><!--end portfolio-options-->
  function update_website_url(){
    global $post;
    update_post_meta($post->ID, "website_url", $_POST["website_url"]);

add_filter("manage_edit-portfolio_columns", "portfolio_edit_columns");
add_action("manage_posts_custom_column", "portfolio_columns_display");

  function portfolio_edit_columns($portfolio_columns){
    $portfolio_columns = array(
        "cb" => "<input type=\"checkbox\" />",
        "title" => "Project Title",
        "description" => "Description",
    return $portfolio_columns;

function portfolio_columns_display($portfolio_columns){
  switch ($portfolio_columns) {
        case "description":

Open in new window

Step 2:
Create a page templage named portfolio.php with this code:
Template Name: Portfolio
get_header(); ?>
<div class="maincontent"><!--Main content begin-->
<div class="mainshellleft">
  <?php $loop = new WP_Query(array(
  'post_type' => 'portfolio', 
  'posts_per_page' => 10 )
      while ( 
        $loop->have_posts() ) : 
        $custom = get_post_custom($post->ID);
  <div class="singlepost">
    <div class="posttitle"><h2><?php the_title(); ?></h2></div>
      <div class="postinfoblog">
        <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
      <div class="singleblogimg">
        <div class="mosai-block-blog">  
    <a href="<?php the_permalink(); ?>" title="<?php the_title();?>"><?php the_post_thumbnail(); ?></a>
    <div class="posttextblog readmore">
      <div class="posttextblog"><?php the_excerpt(); ?></div>
  </div><!-- SINGLEPOST -->
<?php endwhile; ?>  
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Open in new window

Both these files would go in the root of your themes folder.

Step 3:

Include the portfolio-optons.php in your themes functions.php file:
include_once( dirname( __FILE__ ) . '/portfolio-options.php' );

Open in new window

Step 4:
Add a custom post thumbnail size for your custom post type (in this case portfolio.php):
add_theme_support( 'post-thumbnails' );
add_image_size('portfolio_wide', 680, 280, true);

Open in new window

The first line is just the standard for allowing post-thumbnails in your theme. Make sure it doesn't already exist if you use the code above.

Step 5:
Create a page that is named whatever your category will be and assign the new page template to it.
You'll also need to go to the Settings>Permalinks and click update for the new URL's to work correctly.

That sounds like a lot, but when you figure it out it's worth it.

Let me know if you have any questions.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now