WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Page Template: Irregular Width Subpage Gallery (5 posts)

  1. ethanbeyer
    Member
    Posted 2 years ago #

    Hello all,
    Having a small issue that is outside of my realm of expertise, and I'm hoping that someone can help me figure out how to markup what I'm trying to do.

    First off, if you check out this site, I'm trying to make a gallery page that operates in almost the exact same fashion.

    My website will have a parent page called "My Work" and all its subpages will be hidden from the main navigation. Once you go to "My Work", I want there to be thumbnails of all the galleries from the various subpages displayed. I sort of know how to do this (here is my code as it stands now):

    <div class="subpages">
    		<span style="display:none;"><?php the_ID(); ?></span>
    		<?php $parent = $post->ID; ?>
    		<?php
    		query_posts('posts_per_page=15&post_type=page&post_parent='.$parent);
    		 while (have_posts()) : the_post();
    		?>
    
    		<?php $image_thumb = get_post_meta($post->ID, 'image-thumb', true); ?>
    		<div class="thumbnail-1"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a></div>
    
    		<?php endwhile; ?>
    	</div>

    So really, I have two problems.

    1. I want the thumbnails to have differing widths. So I figure that there need to be four thumbnail divs to account for the two different widths, alternating row-by-row, but I don't know how to make the loop basically make four individual stops before starting over.

    2. The background-image property of each div style will have to be set (inline) via PHP to point to the URL of the image that the subpage has set as its featured image. I don't even know if this is possible.

    I really would appreciate it if any of you guys could lend me a hand!

    Best,
    Ethan

  2. ethanbeyer
    Member
    Posted 2 years ago #

    Alright, I've made some progress. Here's my code now:

    http://pastebin.com/WaXRC33V

    ...and how it looks in-browser: http://dev.ethanbeyer.com/work

    The problem I'm running into is that it's obviously pumping the same post through the four stops, and then starts over...but I want each of the boxes to link to a different post.

    Any help out there?

  3. ethanbeyer
    Member
    Posted 2 years ago #

    Further progress, but the issue of one subpage being displayed 4 times before moving on to the next subpage remain.

    Most recent batch of code:
    http://pastebin.com/qXZAzjCZ

    Hope somebody out there has some ideas!

  4. buraksepici
    Member
    Posted 2 years ago #

    Hi,

    I'm trying to achieve the same thing as you so I would appreciate it if you could tell me if you made any progress...

    Thanks,
    Burak

  5. ethanbeyer
    Member
    Posted 2 years ago #

    Burak,

    I did make some progress, and all the thanks goes to Alchymyth!

    Here's the code for the page itself: http://pastebin.com/XQPM3giS

    And here's some code you'll need to make sure makes it into your functions.php file: http://pastebin.com/6huzHA1H

    And then finally, you'll need to make sure you have some CSS for it:
    http://pastebin.com/3HjZHp8g

    Let me know how it works for you. Also, paste a link!

Topic Closed

This topic has been closed to new replies.

About this Topic