Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter bccarlso

    (@bccarlso)

    Figured it out, somehow the image got assigned to the Media Library and not the Gallery for the specific post I was using.

    Thread Starter bccarlso

    (@bccarlso)

    To be more specific:

    <?php $my_query = new WP_Query('category_name=Daily Photo&showposts=1');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID; ?>
    <p>a</p>
    <?php $images =& get_children( 'post_type=attachment&post_mime_type=image&post_parent=' . $post->ID );
    if ($images) {
    $keys = array_keys($images);
    $num = $keys[0];
    $firstImageSrc = wp_get_attachment_thumb_url($num);
    echo "<li><img src=\"{$firstImageSrc}\" width=\"288\" height=\"216\"  alt=\"\" title=\"\" /></li>";} ?>
    <?php endwhile; ?>

    will output <p>a</p>, but not the
    <li><img /></li>
    code I need in the snippet. Whereas if I use rewind_posts();, everything works, and I get the
    <li><img /></li>
    code, but I don’t want to use the same loop that I had been using previously. I’m using this to display a daily photo in the sidebar, that pulls from the “Daily Photo” category. I will exclude Daily Photos from the main loop, and only want to use them to draw images from in that snippet.

    Thread Starter bccarlso

    (@bccarlso)

    You’re right in understanding what I was trying to say. Each post currently has one image that gets displayed no matter which category you view the post from, so that’s what the Thumb is for, and the Thumbnail Class has to do with styling the image I believe. I’m hoping to figure out the logic to display the thumbnails just as you described, but couldn’t get your previous code to work.

    Thread Starter bccarlso

    (@bccarlso)

    Thanks for the help, bsutcliffe. The logic behind that makes perfect sense to me, but the implementation hasn’t been working, at least with me toying around with it. I don’t understand WP PHP architecture as much as I’d like to. Here’s the code I’m working with, and I’ve tried placing your code into various parts of this, also fixing a double quote issue after “example.com” I think.

    <?php while (have_posts()) : the_post(); // check for thumbnail
    $thumb = get_post_meta($post->ID, 'Thumbnail', $single = true);
    // check for thumbnail class
    $thumb_class = get_post_meta($post->ID, 'Thumbnail Class', $single = true);
    ?>					
    
    	<div <?php post_class() ?> class="block" id="post-<?php the_ID(); ?> articles">
    
    		<?php // if there's a thumbnail
    			if($thumb !== '') { ?>
    			<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
    				<img src="<?php echo $thumb; ?>" class="listing-image" alt="<?php if($thumb_alt !== '') { echo $thumb_alt; } else { echo the_title(); } ?>" />
    			</a>
    		<?php } // end if statement
    		// if there's not a thumbnail
    		else { echo ''; } ?>
    
    		<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    
    		<div class="entry">
    			<?php the_content('Read the rest of this entry &raquo;'); ?>
    		</div>
    
    	</div>
    
    <?php endwhile; ?>

    If you can suggest where I put that code in, to essentially replace the image that’s there, I’d be super grateful. Thanks.

    Thread Starter bccarlso

    (@bccarlso)

    I believe it ended up being the PHP safe mode, which I removed from the .htaccess file in the /uploads/ directory, and things worked again. Not sure exactly the consequences of that command, but oh well! =)

    Thread Starter bccarlso

    (@bccarlso)

    The root .htaccess file has this, as well as the WPSuperCache plugin .htaccess stuff (though I have disabled all plugins to troubleshoot as well):

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    Then in the wp-content/uploads folder is this:

    php_value safe_mode "1"

    I’m not quite sure what safe_mode is, but maybe that has something to do with it. Thanks for the help so far guys.

    Thread Starter bccarlso

    (@bccarlso)

    Everything in the wp-content/uploads folder is 777 for now (had tested that earlier), and I can’t open the .htaccess file for some reason… I’m new to this Mac that I’m working on, and Coda won’t allow me to open it.

    Thread Starter bccarlso

    (@bccarlso)

    Here’s an example, on this page https://www.tacomayfc.org/get-involved/donate/, there is a join-pnp-now.gif near the bottom of the page. It doesn’t show up here, and doesn’t show up when you go to https://www.tacomayfc.org/wp-content/uploads/2009/03/join-pnp-now.gif, but when I navigate to that directory with a FTP client, it’s there, and isn’t a corrupt image.

    Any ideas?

    Thread Starter bccarlso

    (@bccarlso)

    Store uploads in this folder: wp-content/uploads
    Full URL path to files: blank
    Organize my uploads into month- and year-based folders is checked
    Track Links’ Update Times is unchecked
    Use legacy my-hacks.php file support is unchecked

Viewing 9 replies - 1 through 9 (of 9 total)