bigaudifan Posted September 6, 2009 Share Posted September 6, 2009 First post ever--bear with me! I've got a blog running on mySQL with Wordpress (an amazingly simple tool). Here's my question: In the sidebar, it has a bunch of php that can call old posts based on their date created, etc... But what I want to do is only echo the posts I've written where the title starts with one particular letter. (I'm creating a questions and answers feature, and all my Q&A posts start with Q). For example: "Q: Why is the sky blue?" Here's the code I currently have: <li><h2>Recent Posts</h2> <ul> <?php wp_get_archives('type=postbypost&limit=10'); ?> </ul> </li> But all this does is call back my recent posts, regardless of the type... I'd like to put an "if else" statement that only calls back the posts I've made that are questions, and therefore, posts where the first letter in the title is Q. I don't think it would be that hard, I just haven't seen anything like this on any Wordpress or PHP forums. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/173290-wordpress-sidebar/ Share on other sites More sharing options...
sKunKbad Posted September 6, 2009 Share Posted September 6, 2009 You won't be able to do this with any of the built in template tags. You will need to either find an existing plugin, or create a plugin for this. One thing that would be easy would be to look for the plugin that allows you to write php in a sidebar widget, and then connect to your database and retreive specific posts as you prefer. You say Wordpress is "Amazingly simple", but it really isn't when you need something that it doesn't do, and that there is no plugin for. Quote Link to comment https://forums.phpfreaks.com/topic/173290-wordpress-sidebar/#findComment-913467 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.