Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Gallery Page WordPress


I created a one column gallery page but I'm having trouble with codes. My theme is Twenty Eleven.

In the content-gallery.php, instead using the default thumbnail, I placed this code for a bigger thumbnail at 640 x 427.

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
<?php the_post_thumbnail('post-thumb');?></a>

On the right side, I want the content post ( text only) to be placed and there is a photo in set with only 4 thumbnails. I placed this code but all of the thumbnails in that post/album are there. This is the code,

<?php echo do_shortcode('[gallery size="small-thumb" columns="2" link="attachment"]'); ?>

This is the screenshot I want to happen.

I hope someone can help me to solve it. Thank you.

Answers (3)


Dbranes answers:

[[LINK href=""]]Here[[/LINK]] is clever a way to limit the number of images in a gallery

You could use this to limit the number of images to 4.

Dbranes comments:

Here is a detailed description about the new gallery on :

[[LINK href=""]][[/LINK]]

ps: Matt has also released his 2 older themes:

"if you’re one of the thousands of people who’ve asked me how I do my galleries here on this site, now you can look at the actual code in the Matala theme."

Hope this helps.

wpqanda comments:

Wow, looks likes this one will work. I'll let you know later tonight. Thanks! ;)


Arnav Joy answers:

so your problem is that small thumbnails are not visible?

Arnav Joy comments:

can you show me the code of content-gallery.php

Arnav Joy comments:

have you registered these

size="small-thumb" and "post-thumb"

using add_image_size() function?

wpqanda comments:

They are visible but it shows everything from the album or from the post itself.

The default content is also in excerpt that means some of the html are not allowed. I will limit the text content but I would like to appear the link in hyper. View the attached for screenshot. That is exactly what I want.

Arnav Joy comments:

can you show the url?

wpqanda comments:

My gallery page test is a mess right now. You can base the Twenty Eleven theme using child theme. Yes, everything is set in the function.php.


Asad Iqbal answers:

Can you please paste the code of the page you give the screenshot?

Look at function reference of to get content:

And get content by post ID:

wpqanda comments:

I photoshop the screenshot but I got the whole idea from here this site [LINK href=""]