So I been creating a site that uses WordPress for the CRM, but the site is located outside of WordPress. I have a page for frequently asked questions(FAQ), that pulls in all posts with FAQ as its category and uses the title of the post as the question and the content of the post as answer. Sounds complicated but not so bad, also the client wanted the FAQ to be sorted, so I created a custom field for priority, so the client can have as many FAQ as he wants but what he selects as the order is available on the site.
First Step:
Add a custom field to the posts for popularity, the field has to have a number else it will not be show on the page, I gave all FAQ posts a value of 20 the client can go in afterwards and change the ranking
Secondly
<dl>
<?php
if (is_page()) {
$cat=get_cat_ID($post->post_title); //use page title to get a category ID
$posts = get_posts ("cat=$cat&showposts=20&meta_key=popularity&order=meta_value");
if ($posts) {
foreach ($posts as $post):
setup_postdata($post); ?>
<dt><?php the_title(); ?></dt>
<dd><?php the_content(); ?></dd>
<?php endforeach;
}
}
?>
<?php endwhile; ?>
</dl>
The red is the magic, cat refers to the category of the post, meta_key is the custom field name and this I have placed on ascending list. All the entries in the site are quite easy I am no code ninja and with a bit of tweaking all of this is possible.
-34.285950
19.144492