thorbj
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Forum: Themes and Templates
In reply to: [Bootstrap Ultimate] TranslationGreat, the files are sent.
Forum: Hacks
In reply to: Change order of posts and exclude some postsOk, thanks! I think I got it now 🙂
I ended up with this code:<?php if(have_posts()) : ?> <?php $loop = new WP_Query( array( 'posts_per_page' => 10, 'cat' => 15, 'meta_key' => 'Dato', 'orderby' => 'STR_TO_DATE(meta_value, \'%d/%m/%Y\')', 'order' => 'ASC') ); while ( $loop->have_posts() ) : $loop->the_post();Also I added the following, to exclude expired posts:
$expirationtime = get_post_custom_values('expiration'); if (is_array($expirationtime)) { $expirestring = implode($expirationtime); } $secondsbetween = strtotime($expirestring)-time(); if ( $secondsbetween > 0 ) {I had to add another custom field called
expiration, populated withmm/dd/yyyy 00:00:00, for this to work.Again, thanks alot 🙂
Forum: Hacks
In reply to: Change order of posts and exclude some postsThanks again 🙂
But I still can’t figure this out. Now, when I replace<?php if (have_posts()) : while (have_posts()) : the_post(); ?>with your code, it only returns a blank page. It looks as it can’t find any posts to display.
What am I doing wrong here?Forum: Hacks
In reply to: Change order of posts and exclude some postsThanks for the response.
How do I use this in my query?
When I replace<?php query_posts('category_name=events'); ?>on line 29 with<?php query_posts('meta_key=Dato&orderby=meta_value'); ?>, i break the code.Thanks in advance.
Viewing 4 replies - 1 through 4 (of 4 total)