HollyCunningham
Forum Replies Created
-
Which .php file do we add this to?
Forum: Fixing WordPress
In reply to: Lightbox Error- Giving me page when I want image only.I don’t have a
echo get_the_post_thumbnail($post->ID, 'full');
line, but I do haveecho get_the_post_thumbnail($post->ID, 'featured');
, which I do need or else the image does not show up on the homepage.That last tip would be the best option, but my thumbnail refuses to be cropped. I go to the proper window, edit image, set for “thumbnail”, select the area, and press the crop button, it thinks for a bit, then nothing. No edit made. Any thoughts? Might it be an issue with the functions file?
FYI, this is the thumbnail section of my functions.php.
// This theme uses post thumbnails add_theme_support( 'post-thumbnails' ); add_image_size( 'featured', 304, 150, true); add_image_size( 'spotlight', 250, 250, true); add_image_size( 'associate', 215, 215, true); add_image_size( 'songwriter', 225, 225, true); add_image_size( 'exec', 450, 350, true); add_image_size( 'large', 600, 9999, false);
I know this is a separate issue from the original (*sigh*), so I’ll go explore the forum and see what I can come up with.
Forum: Fixing WordPress
In reply to: Lightbox Error- Giving me page when I want image only.This is a great step in the right direction!
You can see it used at https://testing.omegadeltapsi.com
I’ve even integrated the lightbox back into it. ??
<?php if ( has_post_thumbnail()) { $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large'); echo '<a href="' . $large_image_url[0] . '" class="thumbnail-link colorbox" rel="lightbox" title="' . the_title_attribute('echo=0') . '" >'; echo get_the_post_thumbnail($post->ID, 'featured'); echo '</a>'; } ?>
In this example, ‘featured’ replaced ‘thumbnail’, and ‘large’ was defined as you suggested. The problem here now lies in the fact that for the first and third photo in the example, I’ve actually used a different featured image than the image used in the post content. This is done to control the cropping so important words are visible on the featured image, words that auto-cropping would’ve cut out. So what I’d like to show on the lightbox is the full image posted in the content of the post. I believe it would have something to do with defining
$large_image_url
, maybe thewp_get_attachment_image_src
or theget_post_thumbnail_id
. Not sure what the best alternative would be, however.Thoughts?