Including Files Incrementally in Categories - WordPress

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Avum
Forum Newbie
Posts: 2
Joined: Wed Feb 06, 2008 9:24 am

Including Files Incrementally in Categories - WordPress

Post by Avum »

(This is for a WordPress blog. Forgive me, I know almost nothing about PHP.)

I would like to include a different/new file for every post I make. In addition, the file that's included will be determined by the category that the post is in.

For example, I'd like to put a "Folder A" on my server with the files I want to include for "Category A": CatA-1.htm, CatA-2.htm, CatA-3.htm, etc. When I make the first post to that category, I would like it to automatically include CatA-1.htm. When I make the second post to that category, I'd like it to automatically include CatA-2.htm, etc. And then I would do the same thing for Category B and Category C, etc.

I do have different templates for different categories, and so I can simply insert the php code that I need for Category A into the Category A template file. However, I don't know what the php code should be.

How could I get the next file in the appropriate folder for the next post in that specific category? Doing it by Post ID wouldn't seem to work because you never know what the ID of the next post in a certain category will be. I haven't been able to find out if WordPress identifies posts in a category by some unique identifier that also relates to that category.

Any suggestions would be greatly appreciated.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Including Files Incrementally in Categories - WordPress

Post by Christopher »

Search for something like "php banner rotation script" and you will find some code you can use.
(#10850)
Avum
Forum Newbie
Posts: 2
Joined: Wed Feb 06, 2008 9:24 am

Re: Including Files Incrementally in Categories - WordPress

Post by Avum »

Thanks for the suggestion.
Post Reply