Advertising
Paste Description for Query based on custom fields
Forum thread:
http://wordpress.org/support/topic/121011
- Query based on custom fields
- Thursday, June 7th, 2007 at 10:43:39am MDT
- <?php
- get_header();
- ?>
- <?php
- $querystr = "SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = 'paragraf' AND wposts.post_status = 'publish' AND wposts.post_type = 'post' ORDER BY wpostmeta.meta_key ASC";
- $pageposts = $wpdb->get_results($querystr, OBJECT);
- ?>
- <?php if ($pageposts): ?>
- <?php foreach ($pageposts as $post): ?>
- <?php setup_postdata($post); ?>
- <h1 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h1>
- <?php the_content(__('(more...)')); ?>
- <div class="post_info">
- Dodane: <?php the_date(); ?> |
- Folder: <?php the_category(',') ?> |
- Komentarze: <?php comments_popup_link(__('(0)'), __('(1)'), __('(%)')); ?> |
- <?php edit_post_link(__('Edit This')); ?>
- </div>
- <?php comments_template(); // Get wp-comments.php template ?>
- <?php endforeach; ?>
- <?php else : ?>
- <?php _e('Sorry, no posts matched your criteria.'); ?>
- <?php endif; ?>
- <?php posts_nav_link(' ', __('« Previous Page'), __('Next Page »')); ?>
- <?php get_footer(); ?>
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.