oliverbennett
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: the_content into variable?My Google-Fu must be weak. On a second search I found the answer:
ob_start(); the_content(); $content = ob_get_clean();http://digwp.com/2009/07/putting-the_content-into-a-php-variable/
Forum: Fixing WordPress
In reply to: Sorting posts by multiple metadata informationUgh, a mixture of poking at this and staring blankly for hours has resulted in very little.
Also, thinking about it, I need to sort this by year, then month, then date adding a further query and yet more complications.
If anyone has any input on the best way to approach this or where I could start off I’d be very much obliged as right now I’m stumped.
Oliver
Forum: Fixing WordPress
In reply to: Sorting posts by multiple metadata informationHey t31os,
Thanks for the suggestion. Sorry, I should have said, I was half-aware of this, but I’m unsure how to extract informatiom from two seperate fields/values in the same query.
As I understand it the field value is being taken from postmeta.meta_key for use in postmeta.meta_value, so in order to do something like:
ORDER BY ABS('$wpdb->postmeta.meta_value') DESC, day DESCI’m trying to understand how to access the ‘month’ AND ‘day’. Hope that makes sense.
Nice kitten, by the way 😀
Forum: Plugins
In reply to: Gallery adviceHi trixienolix,
Thanks so much for the advice, http://ww.wp.xz.cn/extend/plugins/galleria-wp/ seems almost perfect after some fiddling – just need to make the captions look good 🙂
Oliver
Forum: Fixing WordPress
In reply to: Page reordering based on metadataThanks, esmi.
Just in case anyone else is interested I ended with this:
<?php
$querystr = “
SELECT wposts.*
FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
WHERE wposts.ID = wpostmeta.post_id
AND wpostmeta.meta_key = ‘type’
AND wposts.post_type = ‘page’
ORDER BY wpostmeta.meta_value DESC
“;
$pageposts = $wpdb->get_results($querystr, OBJECT);
?>And then:
<?php if ($pageposts): ?>
<?php foreach ($pageposts as $post): ?>
<?php setup_postdata($post); ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?>
<?php echo get_post_meta($post->ID, “type”, $single = true);?>
<?php endforeach; ?>
<?php else : ?>
<h2 class=”center”>Not Found</h2>
<p class=”center”>Sorry, but you are looking for something that isn’t here.</p>
<?php include (TEMPLATEPATH . “/searchform.php”); ?>
<?php endif; ?>