WordPress.org

Ready to get started?Download WordPress

Forums

Page that lists Sub-Pages with thumbnail (5 posts)

  1. byandreasdotcom
    Member
    Posted 5 years ago #

    I would like to create this kind of Page that lists Sub-Pages this way
    http://stephanieizard.com/?q=cook
    Can anybody help me with this?

  2. tomontoast
    Member
    Posted 5 years ago #

    You can use the_meta() to display images using the following code:

    <?php $image = get_post_meta($post->ID, 'image', $single = true);
    $image_alt = get_post_meta($post->ID, 'image alt', $single = true);
    if (!empty($image)){?>
    <img src="<?php echo $image; ?>" alt="<?php if(empty($image_alt)) { echo $image_alt; } else { echo the_title(); } ?>" />
    <?php } ?>

    Put the url of the image in the meta field called image and the alternative text in image_alt.

    You could try using a plugin such as Advanced Post Image

  3. byandreasdotcom
    Member
    Posted 5 years ago #

    What I would like to learn how to do...
    are these 2 things
    1. Create a Page that lists subpages like the screenshot shows.
    The latest added subpage would show up on top, with a full size image and a short text.
    the rest of the subpages would be shown with a thumbnail and a short text

    2. I would like to be able to place 4 random subpages in the bottom of the page.

    Is this possible in wordpress?

    Screenshot: http://tinyurl.com/d5gw2y

  4. tomontoast
    Member
    Posted 5 years ago #

    I'm guessing you're trying to convert Stephanie's site from drupal to wordpress?

    1. You need to use a standard archive page using the_meta() to generate images next to each item.

    2. You need to create a new query like so $randomPost = $wpdb->get_var("SELECT guid FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY rand() LIMIT 4"); and do exactly the same thing for the 4 random posts you have picked from the database.

    Unfortunately I don't have time to go into the finer details however you can hire me to help you create a WordPress theme.

  5. byandreasdotcom
    Member
    Posted 5 years ago #

    Email me if you have a sec: mail (at) byandreas.com

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.