sam_a
Forum Replies Created
-
Forum: Plugins
In reply to: Pull latest attachment from post?You can use it inside the hyperlink in the “Other Articles” loop:
… <a href="<?php the_permalink() ?>"><?php the_post_image(); ?> <?php the_title(); ?></a> …Put the
post_image()function definition in your template or in your theme’s functions.php file.Forum: Plugins
In reply to: Pull latest attachment from post?I list ten other articles at the end of a post, where I would like to show an icon image next to the title
Try something like this (there are a lot of “post image” functions):
<?php the_post_image(); ?>function the_post_image($size = 'thumbnail') { $id = get_the_ID(); if ( empty($id) ) { trigger_error( __FUNCTION__ . "(): Couldn't get current post ID", E_USER_WARNING); return false; } $images = get_children(array( 'numberposts' => 1, 'post_parent' => $id, 'post_type' => 'attachment', 'post_mime_type' => 'image', )); if ( empty($images) ) { // Post has no attached images return false; } $image = array_pop($images); $output = wp_get_attachment_image($image->ID, $size); if ( empty($output) ) { trigger_error( __FUNCTION__ . "(): Couldn't print image for attachment #{$image->ID}", E_USER_WARNING); return false; } echo $output; }Forum: Plugins
In reply to: Pull latest attachment from post?I list ten other articles at the end of a post, where I would like to show an icon image next to the title.
What code are you using to list the 10 articles?
Forum: Plugins
In reply to: Pull latest attachment from post?The question I have is how can I get it to pull random thumbnails from any post?
Something like
$images = get_children('post_type=attachment&post_mime_type=image&post_parent=0'); $image = $images[array_rand($images)]; $parent =& get_post($image->post_parent); echo '<a href="' . get_permalink($image->post_parent) . '">' . wp_get_attachment_image( $image->ID, 'thumbnail' ) . apply_filters( 'the_title', $parent->post_title ) . '</a>';Forum: Plugins
In reply to: Pull latest attachment from post?Something like
<a href="<?php echo wp_get_attachment_url($image->ID); ?>" rel="lightbox"><?php echo wp_get_attachment_image( $image->ID, 'medium' ); ?></a>Forum: Plugins
In reply to: Pull latest attachment from post?<?php if ( $images = get_children(array( 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image', ))) : ?> <ul> <?php foreach( $images as $image ) : ?> <li><?php echo wp_get_attachment_link($image->ID, 'medium'); ?></li> <?php endforeach; ?> </ul> <?php else: // No images ?> <!-- This post has no attached images --> <?php endif; ?>Forum: Fixing WordPress
In reply to: Problem w/ 2.5.1 and Safari 3.1.1 (post_new.php)As Dan said, the default AUTOSAVE_INTERVAL is moved from
wp-admin/includes/admin.phptowp-settings.phpin 2.5.1, so before you try Gabrielz’s fix, double check that you’ve actually uploaded the 2.5.1 wp-settings file: Line 341 should readdefine( 'AUTOSAVE_INTERVAL', 60 );If you want to change it, you can set it in your
wp-config.phpfile, where it will be safe from upgrades, e.g.define( 'AUTOSAVE_INTERVAL', 120 );Forum: Fixing WordPress
In reply to: Problem 2.5.1 post_new.php and post.phpYou can try this to disable autosave (though I don’t know if that will fix this problem):
http://samm.dreamhosters.com/wordpress/plugins/disable-autosave.php
Forum: Fixing WordPress
In reply to: Problem 2.5.1 post_new.php and post.phpYou can try deleting the
wp-adminandwp-includesfolders and repeat the 2.5.1 upgrade. Clear your browser cache, delete cookies, relaunch and hope. 🙂Forum: Fixing WordPress
In reply to: Repeated Error_log entries in 2.5.1If you have a copy of your WordPress directory on your computer, and you have a text editor that can search multiple files, you could search them all at once for
SELECT cat_id, cat_nameand so find which file is making the bad query.You can (temporarily) add
define('WP_DEBUG', true)to your wp-config file — that will print the database warning on the page, hopefully near the source of the problem. See http://codex.wordpress.org/Editing_wp-config.php#DebugTry switching to the default theme, too.
Forum: Fixing WordPress
In reply to: Problem w/ 2.5.1 and Safari 3.1.1 (post_new.php)Make sure you replaced the entire
wp-adminandwp-includesdirectories during the upgrade, and you ranwp-admin/upgrade.php?You might try posting from a “fresh” web browser (one you’ve never logged into WP with) and see if the problem persists.
Until the problem’s fixed, you can turn off JavaScript and still do basic post writing & editing.
Forum: Fixing WordPress
In reply to: Problem w/ 2.5.1 and Safari 3.1.1 (post_new.php)Clear the cache, delete cookies, quit, relaunch?
I had this problem in both Camino & Safari — Camino worked after clearing the cache but Safari worked only after I cleared the cookies too.
Forum: Fixing WordPress
In reply to: Repeated Error_log entries in 2.5.1My mistake, it doesn’t tell you the file & line number.
Search for the string
SELECT cat_id, cat_namein your WP directory, or try disabling plugins.http://codex.wordpress.org/Plugins/Plugin_Compatibility/2.3
http://codex.wordpress.org/Plugins/Plugin_Compatibility/2.5Forum: Fixing WordPress
In reply to: Repeated Error_log entries in 2.5.1The error message looks odd, is that the whole thing? It’s supposed to tell you the file and line number with the bad query.
Probably it’s an old plugin — the
cat_id,cat_name, etc. fields were removed in WP 2.3.Forum: Fixing WordPress
In reply to: Problem 2.5.1 post_new.php and post.phpI had this problem too — the browser is sending POSTs to
wp-admin/admin-ajax.phpover and over.It stopped after I cleared the browser cache and (in Safari) removed all my WordPress cookies, then relaunched.