• Resolved peruzzo

    (@peruzzo)


    So I am new to wordpress. I’m trying to set up a series of galleries using categorized posts and their thumbnails.

    I have a “gallery page” that displays a thumbnail image from a featured image of a certain artist. The category I’m using is ‘Artwork’. This thumbnail should link to a second gallery of that artists work. This second gallery uses the category ‘artist_name’ (example Pablo_Picasso)

    I’ve set up two custom template pages: page-main-gallery.php and page-artist.php

    my page-main-gallery code is this:

    <div class="row">
      <?php query_posts('category_name=artwork'); ?>
    
      	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
      	<div class="col-sm-4 thin-border">
    	    <h3><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a></h3>
    	    <p><em><?php the_time('l, F jS, Y'); ?></em></p>
    	</div>
    
      	<?php endwhile; else: ?>
      		<p><?php _e('Sorry, there are no posts.'); ?></p>
        <?php endif; ?>
    
    </div><!-- end row -->

    This works great in displaying a gallery of the images labeled ‘artwork’. BUT I’m trying to figure out how to link each thumbnail to a second page displaying the artwork of that displayed artist.

    I’ve made a second template page called page-artist-php which is basically the same markup, but instead of

    <?php query_posts('category_name=artwork'); ?>

    I use:

    <?php query_posts('category_name=artist_name'); ?>

    so how do I adjust the code in page-main-gallery.php that references the link:

    <h3><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a></h3>

Viewing 4 replies - 1 through 4 (of 4 total)
  • I think you are trying to create a subcategory under a category.

    So basically you would want to put the category “artist_name” under “artwork” so that when they click on the category link of artwork, they are show all the posts under “artist_name.”

    Basically you set up your categories as the artist and you put the artwork that artist has done as subcategories of those categories.

    So for your page template you would want to get a code that gives you a loop of all your categories instead of a loop of all the posts.

    I would personally just make my gallery page manually and link them to the category page where you use the page template you have created.

    Thread Starter peruzzo

    (@peruzzo)

    So for your page template you would want to get a code that gives you a loop of all your categories instead of a loop of all the posts.

    not sure what that would look like. Any ideas?

    Well i tried testing it but unfortunately it’s beyond my capabilities at the moment but I believe it has something to do with the get_categories paramter – https://codex.www.ads-software.com/Function_Reference/get_categories

    and finding a way to loop it so that the arrays you called can be display on the page. You would also need to have a featured image for each category for it to work how you want it and I’m not sure that is doable within wordpress framework. You can try looking for some plugins.

    I think you might have to do the gallery page manually and just link each thumbnail to the category’s but display the category using the page template you have created so it’s formatted how you want to.

    If someone figures this out I would be interested in seeing how they do it.

    Thread Starter peruzzo

    (@peruzzo)

    i ditched categories and went with a couple custom post types. thanks for the post/help though!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘linking thumbnail from one gallery to another using categories’ is closed to new replies.