• I started using the wp gallery short code in my php page template which was awesome and I could make a slideshow right on the front static page and it could be my portfolio.

    then I realized i can’t change the link to show a different image, namely a bigger image.
    my only option is link=file which is not useful at all.
    even if I change the anchor to point elsewhere in the post nothing happens.

    I upload all my images and I don’t use the wp sizes because I don’t want it making duplicated files of everything and ill decide what needs to be cropped and where.

    I want to somehow be able to point a gallery image to a totally different file so when ligthbox is used it shows a bigger image.
    is this possible?

    if not how can I create a custom loop using wp_query to get all images in a certain post

Viewing 14 replies - 1 through 14 (of 14 total)
  • Have you tried looking for a suitable gallery plugin?

    Thread Starter Eric

    (@shamai)

    they looks o big and bloated i was hoping to stick with basic wordpress gallery
    and it seems most ofthem only let you point to small medium or large preview.
    i don’t want that

    You could use a custom query – WP_Query() if you still want the main query to remain intact & unchanged. Otherwise see query_posts() if you want to adapt the main query. The available parameters are the same for both.

    Thread Starter Eric

    (@shamai)

    but how would i grab at the pictures in the post?
    i can’t get it to work with wp_get_attachements

    Try something like:

    <?php
    $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID );
    $attachments = get_posts($args);
    if ($attachments) :
    foreach ( $attachments as $attachment ) {
    	if( wp_attachment_is_image( $attachment->ID ) ) {
    		echo wp_get_attachment_image( $attachment->ID, 'thumbnail');
    	}
    }
    endif;?>

    Thread Starter Eric

    (@shamai)

    I have a page called portfolio and I only want the images in that page
    this is what I did. what is wrong?

    $args=array(
      'post_type' => 'page',
      'posts_per_page' => 1,
      'name'=>'portfolio'
    );
     $portfolio= new wp_query($args);
    			while ($portfolio -> have_posts()): $portfolio->the_post();
                        $wp_query-> in_the_loop = true;?>
                     <?php
    			foreach ( $portfolio as $attachment )
    			{
    			echo wp_get_attachment_image( $attachment->ID, false );
    			}
    		endwhile; ?>
    			<?php wp_reset_query(); ?>

    Use $portfolio= new WP_Query($args);.

    Thread Starter Eric

    (@shamai)

    i did?
    its there in the code above

    No – you have/had $portfolio= new wp_query($args); (ie all lowercase).

    Also – are you inside the main Loop with this secondary query?

    Thread Starter Eric

    (@shamai)

    no this is called before the main loop.
    i know its working because if I add a tag like the_permalink();
    it shows up. but apparently there are no attachments?
    i added an image with an anchor going a different image does this not count as an attachment?

    this is called before the main loop

    It has to be within the main Loop. Or you’re going to have to specify the post ID so that you can pass it to WP_Query as the post_parent parameter.

    Thread Starter Eric

    (@shamai)

    wp_query inside the main loop?

    this is a separate loop I want above where the posts are all displayed.
    I specified a name=portfolio

    I’ve made separate loops before… Im not sure I understand

    wp_query inside the main loop?

    Oh yes – that’s perfectly OK.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘showing a gallery of images’ is closed to new replies.