WordPress.org

Ready to get started?Download WordPress

Forums

thumbnail titles do not update with post image titles (2 posts)

  1. vlane
    Member
    Posted 4 years ago #

    Hi, first time poster...

    I have a recent links in my sidebar, but instead of text, the links are custom-size thumbnails of the image in each post.

    The links work fine, but I am having a problem with the mouse-over text that appears with the thumbnails.

    I retrieve the text/thumbnails with the following:

    $side_posts = get_posts('numberposts=12');
            foreach($side_posts as $post)
    	{
    		$args = array(
    			'post_type' => 'attachment',
    			'numberposts' => 1,
    			'post_status' => null,
    			'post_parent' => $post->ID
    			);
    		$attachment = get_posts($args);
    		if ($attachments)
    		{
    			$image = wp_get_attachment_image_src($attachments[0]->ID, $size='custom0', $icon=false);
    			if ($image != false)
    			{
    				...
    
    				echo "<a href='",
    				$post_url,
    				"' title='",
    				$post_title,
    				"'><img width=\"",
    				$image[1],
    				"\" height=\"",
    				$image[2],
    				"\" src=\"",
    				$image[0],
    				"\"class=\"attachment-custom0\" alt=\"\" title=\"",
    		                <strong>$attachments[0]->post_title</strong>,
    				"\" /></a>\n";
    			}
    		}

    the problem is that this will only retrieve the title that was originally input with the uploaded image. If I modify the title via the dashboard, this does not modify the text for the thumbnail.

    For example:

    If i upload an image and title it "omfortable...", and then later modify it, via the dashboard, to read, "comfortable...", when i mouse-over the post image, it reads "comfortable", but when i mouse-over the sidebar-thumbnail, it still reads, "omfortable".

    Any thoughts on this? Does it have to do with how wp modifies posts via revisions? I'm pretty stuck on this.

    Thanks.

  2. vlane
    Member
    Posted 4 years ago #

    ok, so to change the original title, you have to use the uploader gallery/media library function.

    changing the title by clicking on an image already inserted into a post doesn't work.

    i still have no idea where the alt title is stored in the wp database though.

Topic Closed

This topic has been closed to new replies.

About this Topic