rkaufman13
Forum Replies Created
-
Forum: Themes and Templates
In reply to: [Spun] Add circle to single pageMaybe the confusion is mine because I deleted the errant code from content-single.php after I realized I was not getting it to work today (without help!). But I was basically using the same code from content-home.php as follows:
global $post; $postclass = ''; if ( '' != get_the_post_thumbnail() ) { $thumb = get_the_post_thumbnail( $post->ID, 'post-thumbnail', array( 'title' => esc_attr( get_the_title() ) ) ); } else { $args = array( 'post_type' => 'attachment', 'numberposts' => 1, 'post_status' => null, 'post_mime_type' => 'image', 'post_parent' => $post->ID, ); $first_attachment = get_children( $args ); if ( $first_attachment ) { foreach ( $first_attachment as $attachment ) { $thumb = wp_get_attachment_image( $attachment->ID, 'post-thumbnail', false, array( 'title' => esc_attr( get_the_title() ) ) ); } } else { $thumb = '<span class="no-thumbnail">' . get_the_title() . '</span>'; $postclass = 'no-thumbnail'; } }As far as I can tell, that attaches all the same CSS classes as on the homepage to the resulting HTML code. Yet the expected properties (size, opacity, etc) aren’t being applied. If it would help to see it in action I can re-add this not-fully-functional code to the site.
Forum: Themes and Templates
In reply to: [Spun] Add circle to single pageThat’s exactly correct and is not desired behavior. How do I get the featured images to display on that page and all the others?
Hi Erin,
I have not tested this but have been messing around with the same file for the last hour or so for my own issues, so I *think* you might be able to delete everything below:
else { $args = array( 'post_type' => 'attachment', 'numberposts' => 1, 'post_status' => null, 'post_mime_type' => 'image', 'post_parent' => $post->ID, ); $first_attachment = get_children( $args ); if ( $first_attachment ) { foreach ( $first_attachment as $attachment ) { $thumb = wp_get_attachment_image( $attachment->ID, 'post-thumbnail', false, array( 'title' => esc_attr( get_the_title() ) ) ); } }Based on my understanding of that page, that should do what you want–but of course, I haven’t been able to bend it to my will either so maybe I’m wrong here. 🙂
Forum: Themes and Templates
In reply to: [Spun] Add circle to single pageHi Andrew,
If I’m understanding you right…Click any of the links on the front page, they each go to a single post. I want the featured image from that post to display on the post. So for example the leftmost image in the second row (the lego guys): I want that exact same image, styled the same way, to display when you click on the lego guys.
Does that make sense?