Hi I was wondering if it is possible to create a custom post type called "Gallery" where i only upload photos and ad captions and when i post it, it post as a gallery. Also when it shows on the homepage it shows as "View Photos" instead of read more, and goes straight to the gallery page.

Also i want to be able to add taxonomies such as "Tv Show" so it will be like this


The post below didn't help me, i tried that plugin and it didn't work for me it didn't go to a gallery it went to a single post page with nothing on it.

Creating Photo Gallery System with Custom Post Type


1 Answer 1


Can I show different text for linking to gallery posts ?

YES, Here's how to do it, put this where you want to output text as - readmore/view photos, depending on theme or way you're generating these text we can use filter to change it as per custom post type.

echo '<a href="'.the_permalink().'">';
if ( 'gallery' == get_post_type() ) {
    echo 'View Photos';
} else {
    echo 'Read More';
echo '</a>';

Custom template for Custome post type

You can configure your blog to use different template for custom post type by creating a template with slug single-gallery.php where gallery is custom post type slug.

Update- To show images as gallery on single post (from this answer)

Add the following code to your themes single.php to show the attached images(full) beneath the post content, And the condition will check for custom post type - gallery.


if ( 'gallery' == get_post_type() ) { //condition to show gallery on post type - gallery

    if ( $attachments = get_children( array(
        'post_type' => 'attachment',
        'post_mime_type'=>'image',   //return all image attachment only
        'numberposts' => -1,   //get all the attachments
        'post_parent' => $post->ID

    foreach ($attachments as $attachment) {
        // you can customize the oputput
        echo wp_get_attachment_link( $attachment->ID, 'full' , false, false, '' );
        echo '<span class="img_cap">'.$attachment->post_excerpt.'</span>';



Read the codex page for more information - wp_get_attachment_link#Parameters


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.