- This topic is empty.
-
AuthorPosts
-
June 1, 2011 at 12:11 pm #32949realphParticipant
Hey there,
I’m trying to get WordPress to display an unordered list of pages in one of my templates. I’m trying to achieve something like this.
Page Title
Page Description
Link to page
Any help will be appreciated. Thanks in advance.
June 1, 2011 at 12:24 pm #74687TheDocMemberSince I don’t think the_excerpt is going to give you exactly what you want, I would create a custom field called ‘description’. What the code below does is check to see if that field has been filled in, if it has it will display it.
The query at the top of the page makes sure that it is only looping through pages. If you want it to loop through specific sections you’ll need to dig a little deeper into the query.
$description= get_post_meta($post->ID, 'description', true);
if ($url) {
echo "$description
";
}
?>
">Link to page
June 1, 2011 at 12:45 pm #74683realphParticipant@TheDoc, that’s perfect, it’s worked a treat.
global $wp_query;
$postid = $wp_query->post->ID;
echo get_post_meta($postid, 'description', true);
?>
">Link to page
Any idea on how I’d call sub-pages, for example, if I only wanted to show pages that are children of a parent page called “Culture”?
June 1, 2011 at 12:53 pm #74673TheDocMemberNo problemo. Just change the ’11’ in the example below to the Culture’s page id:
June 1, 2011 at 1:02 pm #74674realphParticipantPerfect dude!!! You’re the man! One last thing, I’m trying to use box resizing to automatically resize my post thumbnails, but it doesn’t seem to be working. I’m putting this in my functions.php file.
set_post_thumbnail_size( 225, 159 );
June 1, 2011 at 1:07 pm #74672TheDocMemberI always like being a little more specific with my post thumbnails:
// post thumbnail support
if ( function_exists( 'add_image_size' ) ) add_theme_support( 'post-thumbnails' );
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'culture-page-listing', 225, 159, true ); // Culture Child Page Listing
add_image_size( 'other-size', 130, 130, true ); // Other use
}Then in your template:
The ‘true’ means it will hard crop the image to make sure it fits your dimensions exactly. I prefer it as it ensures all of the images will be similar.
You might need to regenerate your thumbnails. There is a plugin to do this (so you don’t have to re-upload all of your images).
June 1, 2011 at 1:12 pm #74647realphParticipantThanks for the tip, that’s a much better way! Thanks again!!!
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.