WordPress.org

Ready to get started?Download WordPress

Forums

Spun
Titles inside images-- or thumbnail only from Featured Image? (3 posts)

  1. synodos
    Member
    Posted 1 year ago #

    I'm using Caroline's beautiful theme for a wedding RSVP website, and what I really need is for the site to be easily navigable while also having images in the posts. Right now, if I add an image to any post, even if I don't assign it as a Featured Image, the post immediately loses its identification (ie, it title) on the homepage. But having a wedding website without pictures is a downer.

    I've tried following Andrew's advice here for editing the content-home.php and style.css in order to make titles appear on the image circles, but (A) the titles appear below the images rather than on them, and (B) there's no gradient fade when hovering.

    What I really ACTUALLY want, though, if anyone is willing to help me figure out the code, is to undo the "if [a post thumbnail] does not exist, try to get the first attached image" rule. That is, I would like the option of assigning a Featured Image to a post, in which case the title on the homepage would be replaced with the thumbnail, but also the option of NOT assigning a Featured Image and thus maintaining the title on the homepage (and yet having images in the post). If I could just change that one if-then clause (if there is no thumbnail, then get the first attachment), it would be absolutely perfect. But I've tried changing everything imaginable in the content-home.php code, and I just keep breaking it.

    I'm not worried about setting up a child-theme because I only need this one website, under this one version, to do its thing for one month-- and then it can pass into Internet dust-- so it's not a problem if my edits are overwritten by a later update. I'm using the latest version of Spun (1.07). The website is http://mer.penemue.org/. I have extremely modest HTML skills and no CSS skills whatsoever.

    Thank you so much for any help!!

    --Erin

  2. alejandrazm
    Member
    Posted 1 year ago #

    Hello.
    I have the same problem.

    If I upload a nem image to a post ( in gallery format) it change the featured image on the home page.

    I really love this theme ..and I want to used it to showcase my pictures ..but... how can I avoid to change the featured image when I uploud a new photo to a gallery post format?
    If I can´t fix it I will have to use another theme.. but I don´t want to do that..

    Sorry for my english...

  3. rkaufman13
    Member
    Posted 1 year ago #

    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. :)

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic