Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter cricalix

    (@cricalix)

    Found it. Too much accumulated cruft in my WP installation – something hadn’t been overwritten (or was a duped copy in another file), so posts with more than 1 postmeta entry were showing up as many times as there were postmeta records for that post.

    Thread Starter cricalix

    (@cricalix)

    This looks, to me, to be a problem down in upload-functions.php, in the wp_upload_tab_browse() function. It appears to get double attachment entries for any given post.

    Tracing the SQL executed:
    SELECT SQL_CALC_FOUND_ROWS posts.* FROM posts LEFT JOIN postmeta ON posts.ID = postmeta.post_id WHERE 1=1 AND (post_type = ‘attachment’) ORDER BY post_date DESC LIMIT 30, 10

    returns double entries for each post, and thus generates a doubled count for the next query that gets executed (the found_rows() query).

    If I mod the loop in that function, so that it keeps track of the last ID it saw:

    if ( have_posts() ) : while ( have_posts() ) : the_post();
    if (get_the_ID() == $last_id) { continue; }
    .
    .
    $last_id = get_the_ID();
    endwhile;

    the output to the browser is what I expect. However, I can’t believe that WordPress is this borked, so it’s got to be something in my setup.

    Forum: Plugins
    In reply to: WordPress-People?

    You should be able to remove the plugin file from the plugins directory and WP should let you back in.

    Using the clues from this entry, I’ve got the random block showing on my site (Gallery 1.5 RC1 (installed in htdocs/gallery/, WP 1.5 (installed in htdocs/), parishuddha theme). It should be applicable to any theme.

    In wp-content/themes/parishuddha/sidebar.php, I added
    <li id="photo"><?php _e('Photo:'); ?>

    • <?include(ABSPATH . 'gallery/block-random.php'); ?>

    after the meta section and before the closing /UL for the menu. I also edited the style.css file to make the body width 790 (was 770) so that the graphic had enough room to fit.

    There was no need to make any changes to the block-random.php file or to use the ob_*() functions. ABSPATH probably only works for me because wordpress is in /, and gallery is in /gallery. If your wordpress install is in /wordpress, and gallery is in /gallery, then you will probably have to edit block-random.php and add $GALLERY_BASEDIR='/real/path/to/gallery'; (/var/www/localhost/htdocs/gallery for me) after the line that reads $GALLERY_NO_SESSIONS. Then copy block-random.php to your WP install directory, and edit your theme file appropriately. As stated, I modified my sidebar.php file, but you may want the random photo elsewhere.

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