WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Assigning posts to pages? (32 posts)

  1. Cailean
    Member
    Posted 8 years ago #

    I've poked around quite a bit and haven't seen this problem addressed...

    I am creating a blog system for an organization with several groups. Each group will post blog entries in one of two categories, 'Event' & 'Journal'.

    Each group gets a Page in the system and that page will display the 'Event' & 'Journal' categories for that group separately...

    I think the multi-loop is dealt with fairly easily... but how do I assign the posts to the appropriate groups/pages in a way that is easy for the user/author?

    I thought perhaps the custom-field function could be massaged to serve this purpose... The requirements there would be: a)the user picks 1 from an admin-determined list of groups to post to b) the group page only displays posts that are assigned to it

    I'm not afraid of writing custom code, but I need a shove in the right direction...

  2. Cailean
    Member
    Posted 8 years ago #

    After thinking things through a bit more, what I think I need to do is attach a page_id to each post and then modify the Page generation to include posts that match the page_id...
    so...
    1) add a column 'page_id' to the posts table
    2) add the necessary form elements and database queriesto post.php
    3) alter functions.php around line 520 to check posts for page_id...

    Am I making sense?

  3. tedfox
    Member
    Posted 8 years ago #

    I also don't know much. But I think one possible way would be to create custom page templates for each seperate group. Then when creating the pages, select the appropriate page template.

    And in each individual page, use the loops to retrieve entries from the 2 specific categories (u'll need to know the category id)

  4. Kassad
    Member
    Posted 8 years ago #

    See this thread (at the end).
    It may help you.

    Category for Page

  5. Cailean
    Member
    Posted 8 years ago #

    Unfortunately, using categories to filter for each group won't work... I'll have up to 20 groups all using the same set of categories... I need a way to group the posts at a level above categories -- I think I'm on the right track with the code mods I mentioned above...

  6. Kassad
    Member
    Posted 8 years ago #

    Well, I will be interested in the result.

  7. Cailean
    Member
    Posted 8 years ago #

    k, so I've managed to hack the back-end so that the author can assign a post to a Page... the page_id appears in the db as expected when a post is created and/or edited. Cool.

    I'm having trouble convincing a Page to display more than one post...

  8. Cailean
    Member
    Posted 8 years ago #

    I've got it now... I had to make a custom query_posts() parameter to filter by page_id. Everythings good now!

    I suppose I should figure out how to make this a plugin...

  9. Kassad
    Member
    Posted 8 years ago #

    Go ahead, then :)
    I am in the same boat, so I am really curious about your solution.

  10. Srle
    Member
    Posted 8 years ago #

    I am interested in this one too, I was just about to post this as a question, when I saw your thread!

    Can we get in touch somehow, 'cause I will be needing this little hack asap?

  11. Cailean
    Member
    Posted 8 years ago #

    I'm in the process now of converting my 'hack' into a proper plug-in... how soon is ASAP?

  12. Srle
    Member
    Posted 8 years ago #

    Day or two?

    Anyhow, I will await for your plug-in, it will be really useful one!

  13. DoverGeek
    Member
    Posted 8 years ago #

    I'm on board for the plugin as well, it is exactly what I have been trying to do. Great work Cailean!

  14. kenwinstoncaine
    Member
    Posted 8 years ago #

    Very cool. I've been trying to reinvent your wheel, Cailean. Looking forward to the plug-in.

  15. Srle
    Member
    Posted 8 years ago #

    Any news?

  16. Cailean
    Member
    Posted 8 years ago #

    Sorry, folks, holiday weekend here in Canada means lots of family and little coding...

    The plug-in is coming and I do have some questions for you all... I will be diving back into the plug-in tonight.

  17. Cailean
    Member
    Posted 8 years ago #

    K, quick question...
    I'm using the post_parent field for assigning the posts to pages (essentially a post becomes a child of a page...)

    Anyway, how would the custom query for the posts go? The first query (loop) on the page would be the page's post content... (it can stay as is)

    The second loop would pull all the posts where the value of post_parent is the current page's ID... I guess there isn't a simple query_posts() method?

  18. apek
    Member
    Posted 8 years ago #

    where is he plugin?

  19. Cailean
    Member
    Posted 8 years ago #

    it's coming... I haven't had a chance to test it with the 2.0 beta, yet and I don't see much point in releasing a plugin that will break with 2.0. It does work, though, which is cool!

  20. kenwinstoncaine
    Member
    Posted 8 years ago #

    Hi Cailean:

    I'm building my site with 1.5.2 and would very, very much like to experiment with this capability. It's central to the design I've envisioned for a very large site covering 40 some topic areas with multiple (and ever growing) articles in each topic area.

    Would you consider letting me play with the current version as a beta? I'd really appreciate it.

    And if it breaks under 2.0, so be it. I won't go to 2.0 until we've figured out a way to make this, or something similar, work in 2.0.

    If I offer a small monetary contribution/donation for your creative efforts, would that help?

    I'm at a point where I really need this functionality and am hoping you'll concede to let me play with it.

    Thanks for considering.
    kwc

  21. kenwinstoncaine
    Member
    Posted 8 years ago #

    P.S. Cailean, if you want to contact me directly, please write to kwc@wellnessU.org

  22. Cailean
    Member
    Posted 8 years ago #

    One zip file en-route to New Mexico...

    For the rest of you, if Ken gets it working, I'll assume it's good enough for the masses and release it. :)

  23. kenwinstoncaine
    Member
    Posted 8 years ago #

    Very cool, Cailean. I'll be reporting back by tomorrow evening (if not earlier). Expect to be playing with this tonight.

    Thank you.
    kwc

  24. kenwinstoncaine
    Member
    Posted 8 years ago #

    Very grateful to Colin for sending me the plug-in. Have spent about 8 hours with it last night and tonight fiddling. Don't yet have it working on the site I'm building.

    Will report as I progress. Colin let me know that it may not work with mod_rewrite Permalinks--which I'm using. He didn't write it for them. That MAY be the problem I'm having. Or the problem may simply be that I'm not up to speed enough yet on Pages and posts and getting the two to work together. I'm probably a few more hours away from knowing which and then moving towards resolving it (or not).

    I'm suspecting that my own steep learning curve re: Pages is a factor. I've yet to get a Page to actually show up, with my template, and with a post on it. I'm no longer getting 404 errors, but I'm still not seeing a page show up.

    Will probably be able to get back to this tomorrow night.

    Best,
    kwc

  25. kenwinstoncaine
    Member
    Posted 8 years ago #

    I'm tied up in a magazine deadline right now and probably won't be clear of that 'til this coming Tuesday evening and haven't gotten back to this since Sunday night.

    I will be back onto it just as soon as I get this mag out.

    Problem that tied me up in WordPress has to do with using Pages in my theme. For some reason, it's assigning them under a category. (Which the Codex says shouldn't be happening.) And it doesn't seem to be using my theme on Pages or letting me choose the theme.

    I've got to do more studying of how to make Pages work and then see if I can do it with my current theme, or if I need to start from scratch with a new blog.

    That's where I was stuck Sunday night. I plan to get unstuck by Wednesday or Thursday next week. And hopefully have this plug-in working.

    Best,
    kwc

  26. kenwinstoncaine
    Member
    Posted 8 years ago #

    If anyone is still following this: I'm back onto it. Sorry for the long timeout. I pretty much wiped out my computer with a dumb download and spent about three weeks restoring it.

    I have a query into the support forum to see if someone can figure out why my Page template is not showing up on pages I create. Once that is figured out, I'll know whether this plug-in is working well or not. So far, I'm suspecting that it WILL work with permalinks in WordPress 1.5.2 because I am seeing it showing up when I go the Write page. (OR....the reason my theme template is not coming up is because it DOESN'T work with permalinks? I doubt the two are related. But I'm pretty naive about this stuff.)

    In any case, a long overdue follow-up.

    Best,
    kwc

  27. kenwinstoncaine
    Member
    Posted 8 years ago #

    Finally!

    Solved the "Page" problem I was having. Some bad code in my page.php file.

    With that resolved, the Post2Page plug-in seems to work WITH permalinks for ONE POST per page. I have not been able to use it to post multiple posts to a single page.

    That may not have been a function that Colin intended to build into this. Colin? Possible?

    Would be especially useful to be able to post multiple posts to a single page AND to have the option to be able to have later posts appear BENEATH earlier posts, rather than atop them in typical blog style.

    That way, one could build a strong informational page, with the intro material on top, and then add supplemental material with each post.

    Any idea how to do that, Colin?

    Grateful for everyone's patience. Looks like the plug-in works fine with v 1.5.2 of WordPress with Permalinks enabled.

    Thanks,
    kwc

  28. Cailean
    Member
    Posted 8 years ago #

    As I've already mentioned to Ken, one post per page is default WP behaviour. I suspect that the permalinks are, in fact, breaking the plugin.

    I'm currently trying to refactor the plugin for WP2.0, during which time I should be able to add support for permalinks.

  29. kenwinstoncaine
    Member
    Posted 8 years ago #

    Hi Colin:

    Pretty sure you're right that I don't have it working, but rather am just publishing to category--or using WP default behavior. Played with it some more after getting your reply. And seem to have broken it more. And need to play a lot more, but have some appointments I must tend to. Will get back to this tonight and go over each of your suggestions/questions.

    In the meantime:

    I'm suspecting first that I still have a problem in my page.php file. I am going to post the original code to the forum and see if anyone can see a problem that would keep a new Page from pulling in my template theme. (That was the problem that hung me up for weeks and since I'm a very very beginner when it comes to coding, it takes me a long time to recognize and troubleshoot these things.)

    Related--to get the page.php file to finally start pulling in my theme, I deleted some code. Now, when I look at that code, I think I deleted the part that told the Page to pull up more than one post. So I think the problem I'm currently having is still *me* and my page.php file.

    Let me seek some help on that. (And I'll post an update to the thread.)

    I'll get back to you after I've done some more work/investigating.

    Thanks,
    kwc

    P.S. Glad to hear you are working on it for V 2.0. I'm not going to 2.0 until I have my site actually working and building out in 1.5.2. (The learning curve thing.)

    __________________________________________________________
    k e n w i n s t o n c a i n e
    Box 95, Cerrillos, NM 87010 505.780.1894

  30. kenwinstoncaine
    Member
    Posted 8 years ago #

    I've posted my most broken and my less broken page.php files here:
    http://wordpress.org/support/topic/56348?replies=1

    Hopefully a theme building wizard will glance at them and immediately spot the problem and have me rolling again.

    I'll report back.

    Best,
    kwc

Topic Closed

This topic has been closed to new replies.

About this Topic