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

Gallery specific link, how to do this?? WordPress

  • SOLVED

I just purchased a theme titled "Core"

http://themeforest.net/item/core-minimalist-photography-portfolio/240185

off of Themeforest.com. It is a spectacular theme!

I have spent hours trying to figure this out so now I am left asking.

This theme comes with a "Gallery" section under the Admin panel where it allows you to add photos and make galleries in a certain way.

Example: http://everythingtonothing.com/Test/?gallery=george-triplett

Well I am in need of help calling certain galleries. I have edited the blog.php page template as a separate template(photography.php) to only pull certain posts with certain tags. For example, this link:

http://everythingtonothing.com/Test/porfolio/photography/portraits/

pulls all my posts with tags, "Portraits". It then strips the descriptions and leaves just the "Featured Image" to click on.

This is the problem... When you click that image it goes to the blog post. What I would like it to do is go to the gallery with the name of that post. I cannot figure out what the function is for the gallery so cannot figure out how to pull it with the click of the image.

Any help would be GREAT!!

THANK YOU!

Answers (2)

2011-12-06

Just Me answers:

Did you try using a link like you supplied http://everythingtonothing.com/Test/?gallery=george-triplett to use with the image?

Maybe you can share your template code.


everythingtonothing comments:

I can do that, but the problem is if you look at the Portraits page, each post is different so I need it to open a link per the title of each post.

I am not sure which template page to really show you... I can show you the galleries template.

This is the code that displays the gallery page like this: http://everythingtonothing.com/Test/?gallery=george-triplett

<?php
/**
* The main template file for display portfolio page.
*
* @package WordPress
*/

/**
* Get all photos
**/

$menu_sets_query = '';

$portfolio_items = -1;

$args = array(
'post_type' => 'attachment',
'numberposts' => $portfolio_items,
'post_status' => null,
'post_parent' => $post->ID,
'order' => 'ASC',
'orderby' => 'menu_order',
);
$all_photo_arr = get_posts( $args );

$pp_display_image_title = get_option('pp_display_image_title');

get_header(); ?>

<div class="page_caption">
<h1 class="cufon"><?php echo $post->post_title; ?></h1>
</div>

<div id="content_wrapper">

<?php
if(!empty($all_photo_arr))
{
?>

<!-- Begin content -->
<div id="page_content_wrapper">

<?php
$pp_gallery_width = 295;
$pp_gallery_height = 200;
?>

<div class="inner">

<div class="inner_wrapper">

<div class="one_third">

<div style="width:90%">
<?php
if(!empty($post->post_content))
{
$baseLinkArr = parse_url(curPageURL());

if(isset($baseLinkArr['query']) && !empty($baseLinkArr['query']))
{
$start = '&mode=f';
}
else
{
$start = '?mode=f';
}
?>
<p><?php echo nl2br(stripslashes(html_entity_decode(do_shortcode($post->post_content)))); ?></p>
<br/><br/>
<?php
}
?>

<?php
$pp_display_slideshow_button = get_option('pp_display_slideshow_button');

if(!empty($pp_display_slideshow_button))
{
?>
<a href="<?php echo curPageURL().$start; ?>" class="button"><?php _e( 'View Fullscreen', THEMEDOMAIN ); ?></a>
<?php
}
?>
</div>

</div>

<div class="two_third last">

<?php
foreach($all_photo_arr as $key => $photo)
{
$small_image_url = get_stylesheet_directory_uri().'/images/000_70.png';
$hyperlink_url = get_permalink($photo->ID);

if(!empty($photo->guid))
{
$image_url[0] = $photo->guid;

$small_image_url = get_stylesheet_directory_uri().'/timthumb.php?src='.$image_url[0].'&amp;h='.$pp_gallery_height.'&amp;w='.$pp_gallery_width.'&amp;zc=1';
}

$last_class = '';
if(($key+1)%2==0)
{
$last_class = 'last';
}
?>

<div class="one_half <?php echo $last_class; ?>" style="margin-bottom:2%">
<?php
if(!empty($small_image_url))
{
?>
<a rel="gallery" href="<?php echo $image_url[0]; ?>" <?php if(!empty($pp_display_image_title)) { ?> title="<?php echo $photo->post_title; ?>" <?php } ?>>
<img src="<?php echo $small_image_url; ?>" alt="" class="img_nofade frame"/>
</a>
<?php
}
?>

</div>

<?php
}
?>
<br class="clear"/><br/><br/>
</div>

</div>
</div>

</div>
<br class="clear"/>

</div>
<!-- End content -->

<?php
}
?>

</div>
</div>

<?php get_footer(); ?>


Hopefully that helps. It's trying to figure out what code to call. like for example: <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">


That is used to call the post link by what title that post is. So if the post title is: "George", it pulls the post titled, "George".. I just need it to pull the gallery with that title of the post and not the post itself.

Pretty much, it is just a blog page that loads the blog posts by what tags i choose and the featured image links to that blog posts same titled gallery instead of the post itself.

I hope I am making sense.


Just Me comments:

The only thing you have to change is the link that is attached to the featured image. What does that code look like right now. Guess your photography.php file would help.


everythingtonothing comments:

It's pretty much this chunk:

<br class="clear"/>
<div class="post_img">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/timthumb.php?src=<?php echo $image_thumb[0]; ?>&amp;h=<?php echo $pp_blog_image_height; ?>&amp;w=<?php echo $pp_blog_image_width; ?>&amp;zc=1" alt="" class="img_nofade frame" width="<?php echo $pp_blog_image_width; ?>" height="<?php echo $pp_blog_image_height; ?>"/>
</a>
</div>


and this is the part that is the link.

<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">

I just don't know what to put in there to call the gallery of the_title instead of the post of the_title.


Just Me comments:

you want <?php the_permalink(); ?>" title="<?php the_title(); ?>

to reflect http://everythingtonothing.com/Test/?gallery=george-triplett

You can use the permalink and transform it, like
substr(permalink here)."?gallery=".postname

or something like that.
Maybe you need an extra slash before the questionmark.


everythingtonothing comments:

Not sure if I'm following you... could you show it in the code?


Just Me comments:

Let's try something else. I am assuming your post title is the same as your gallery title.

what happens if you put


<a href="http://everythingtonothing.com/Test/?gallery="."<?php basename(get_permalink()) ?>" title="<?php the_title(); ?>">


everythingtonothing comments:

No dice :( it loads everythingtonothing.com...etc /www.everythingtonothing.com/?gallery..etc


Just Me comments:

Just for testing, what happens if you use


<a href="http://everythingtonothing.com/Test/?gallery=george-triplett" title="<?php the_title(); ?>">


everythingtonothing comments:

that worked, took me to that gallery, but every photo does now.


everythingtonothing comments:

I GOT IT!!!!!!!!!!!!!!!!!!!!

<a href="http://everythingtonothing.com/Test/?gallery=<?php the_title(); ?>">

I'll double check but I am pretty sure I got it!!!


Just Me comments:

I knew it would take every photo to the same place, next step would be to replace the last part :) You figured that one out so it seems.

2011-12-06

Francisco Javier Carazo Gil answers:

Hi everythingtonothing,

As I can see the theme are using Fancybox (http://fancybox.net/) to show gallery.

To display gallery you should have in the page all the images and relate it with "rel" attribute:

<a class="grouped_elements" rel="group1" href="image_big_1.jpg"><img src="image_small_1.jpg" alt=""/></a>
<a class="grouped_elements" rel="group1" href="image_big_2.jpg"><img src="image_small_2.jpg" alt=""/></a>

<a class="grouped_elements" rel="group2" href="image_big_3.jpg"><img src="image_small_3.jpg" alt=""/></a>
<a class="grouped_elements" rel="group2" href="image_big_4.jpg"><img src="image_small_4.jpg" alt=""/></a>


You can do a trick:
1. Load all images, only one with correct z-index
2. When you click the image yo:
2.1. Set the correct z-index
2.2. Show the gallery
2.3. Prevent going to the post
3. When you close the image you make default z-index values

Hope it helps!


everythingtonothing comments:

I understand it uses fancy box, but that is just when you open the pictures. I'm trying to link to a gallery page such as http://everythingtonothing.com/Test/?gallery=george-triplett so the view can then click on the images and load them using fancy box.