Jump to content

Wordpress Sidebar?


bigaudifan

Recommended Posts

First post ever--bear with me!  :D 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?

Link to comment
https://forums.phpfreaks.com/topic/173290-wordpress-sidebar/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/173290-wordpress-sidebar/#findComment-913467
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.