WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Week as a Post with 3 Posts [Post within a Post] (33 posts)

  1. mcnamc2
    Member
    Posted 1 year ago #

    I am working on a running website, which has one week and three workouts.

    Can I create a post for "Week 1" and include three posts associated with that Week 1?

    Post: Week 1
    No content. Other than maybe, "Stay warm out there!"

    Post 2: Day 1
    Associate with Week 1
    Has content

    Post 3: Day 2
    Associate with Week 1
    Has Content

    Post 4: Day 3
    Associate with Week 1

    I see a handful of plugins for posts within posts, but is a bit overwhelming. I want to keep it simple! Or if a Taxonomy approach is best, do let me know and point me to how to set it up.

    Thanks,
    Catharine

  2. keesiemeijer
    moderator
    Posted 1 year ago #

    Do you want this for every week of the year? Where or how do you want to show these posts?

    Have you looked at related posts plugins: http://wordpress.org/extend/plugins/search.php?q=related

  3. mcnamc2
    Member
    Posted 1 year ago #

    Yes, would like it for every week of the year.

    In thinking more about it, I am more interested in having the WEEK be an accordion link, in which the three posts would be displayed beneath.

    Is that possible? I envision this being on a Page with all posts tagged with "workouts".

    Is this do-able?

    Thanks!
    Catharine

  4. keesiemeijer
    moderator
    Posted 1 year ago #

    It's more complex than I originally thought. Are 'Day 1', 'Day 2' and 'Day 3' the post titles?
    Maybe using custom fields to associate the post with the week number is an idea.

    You can also show links to weekly archives with wp_get_archives, but then all the posts have to be published within that week.

    What theme are you using?

  5. mcnamc2
    Member
    Posted 1 year ago #

    Yes, Day 1, Day 2, and Day 3 would be post titles.

    I a up for a custom field, but would need some guidance on how to do it.

    I am using the Responsive Theme -- it's awesome.
    http://themeid.com/responsive-theme/

    Let me know what further information I can provide.

    Thank you!
    Catharine

  6. keesiemeijer
    moderator
    Posted 1 year ago #

    Here are some more questions:
    Do the weeks correlate with the weeks of the year or are the weeks a starting point for a workout project (e.g. week 63 of my workout project)?

    If it's the latter, you can use a custom post type "workout" for your weekly workout days. This will allow for urls like this:
    yoursite.com/workout/week-63/day-1
    yoursite.com/workout/week-63/day-2
    yoursite.com/workout/week-64/day-1
    etc...

    Or if the weeks do correlate (also with a custom post type "workout"):
    yoursite.com/workout/2012-week-1/day-1
    yoursite.com/workout/2012-week-1/day-2
    etc...

  7. mcnamc2
    Member
    Posted 1 year ago #

    Hi keesiemeijer! Thank you for your questions, you ask good ones!

    The weeks do not correlate to the weeks of a year. They are starting point for a project (which would be a "series")

    I will look into the custom post type. So what is potentially going to arise is:

    1. Series A, 10 weeks:
    Week 1
    Day 1
    Day 2

    Where each *day* is its own post.

    I need some kind of mechanism for organizing by a week, and then by a series so that a user can:
    -- Click on a week and see the three days of workouts.
    -- View workouts in a specific series.

    this is my website: (still tinkering with it, but almost done. Need to figure out some CSS!)
    http://www.cfote.com

    You will see that I have three days of posts on the homepage at the bottom. I am wondering if this plug-in would be useful for organizing the weeks into a series: http://wordpress.org/extend/plugins/posts-to-posts/

    Thanks!
    Catharine

  8. keesiemeijer
    moderator
    Posted 1 year ago #

    Ah yes, I always forget about that plugin (good plugin author too). I still think custom post types (in combination with the plugin?) is the way to go.

    cfote.com/workout/ // show all series
    cfote.com/workout/a // shows all weeks of series a
    cfote.com/workout/a/week-1 // shows all days of week 1
    cfote.com/workout/a/week-1/day-1 // shows single post day 1

    I will check out the plugin.

  9. keesiemeijer
    moderator
    Posted 1 year ago #

    I see you have a child theme. Did you download it from somewhere or did you create it yourself? Does it have single.php (in the child theme)?

    Activate the plugin posts-to-posts.

    And use this as your child themes functions.php (or add this (without the starting "<?php" tag) if you already have functions.php in your child theme): http://pastebin.com/abS4mpnU

    This creates a hierarchical (like Pages) custom post type "workout". Publish a Series "workout page" (title can be anything). Publish a workout page named (title) "week 1" and and assign it to the parent Series workout page. After that you can publish pages named "day 1", "day 2", etc.., and assign it to the parent "week 1" workout page.

    Serie A (title can be anything)
    - week 1
    -- day 1
    -- day 2
    -- day 3

    When publishing these pages connect the week pages to the Series "workout page" and the day pages to the "week" workout pages with the plugin (connected to).

    I hope this makes sense.

    Can you paste and submit the full code of single.php of your (child) theme into a pastebin.com and post the link to it here? see the Forum Rules for posting code and using the pastebin.

    btw. To view the custom post type "workout" pages you probably have to re-save your permalink structure in wp-admin > Settings > Permalinks. You won't see anything new on these pages because I have to edit your single.php to have the related pages show up.

  10. mcnamc2
    Member
    Posted 1 year ago #

    Yes I am following!

    First issue is to answer your question, I downloaded the "responsive-blogger" child theme from the Responsive Theme.

    In the folder I only have home.php. So I do not have functions.php file, nor a single.php file? What should go in there? But it IS in the Parent theme - "Responsive" - -- Should I edit in that folder? or copy / paste to the child theme folder?

    Thanks! These steps seem very clear!! I look forward to following them and trying it out. Post 2 Post plugin has been activated as well!

    Catharine

  11. keesiemeijer
    moderator
    Posted 1 year ago #

    Should I edit in that folder? or copy / paste to the child theme folder

    If you don't have a functions.php in your responsive-blogger child theme you'll have to create a file called functions.php (with a text editor (not MS Word)) and put the code from the pastebin in to it, and upload it to your child theme.

    The functions.php file is a special file in a child theme: http://codex.wordpress.org/Child_Themes#Using_functions.php

    I will edit the single.php file of the parent theme and post it here (copy that one to your child theme if it's finished).

  12. mcnamc2
    Member
    Posted 1 year ago #

    Excellent!

    I created a functions.php, pasted in the code you provided me, and dropped it into my child theme folder.

    I have copied and pasted the single.php file from the parent theme and put it on the pastebin: http://pastebin.com/xwScirBG

    Thank you!
    Catharine

  13. keesiemeijer
    moderator
    Posted 1 year ago #

    I see you have a warning on top of your homepage: Cannot send session cache limiter - headers already sent

    Is that because of my functions.php code?

    Here is a single.php: http://pastebin.com/qimBQsZj
    Save it as single-workout.php and copy it to your child theme. This template is only used for single posts of the workout post type.

    This template is just to give you an idea of how it could work. Use the posts-to-posts widget to navigate trough your serie/week/day posts.

    I don't think I have more time today to work on this.

  14. mcnamc2
    Member
    Posted 1 year ago #

    It might be because of your functions.php. I'll troubleshoot!

    Thank you so much again. I look forward to playing with this!!

    Catharine

  15. keesiemeijer
    moderator
    Posted 1 year ago #

    see: http://codex.wordpress.org/FAQ_Troubleshooting#How_do_I_solve_the_Headers_already_sent_warning_problem.3F

    Try removing spaces, new lines, or other stuff before the opening <?php tag in your child theme's functions.php

    What text editor did you use?
    http://codex.wordpress.org/Glossary#Text_editor

  16. mcnamc2
    Member
    Posted 1 year ago #

    oooh, is it possible that was because I had functions.php in BOTH parent theme folder AND the child theme folder?

    I removed it from the child theme and it's fine now, but I haven't tested out the series yet.

  17. keesiemeijer
    moderator
    Posted 1 year ago #

    oooh, is it possible that was because I had functions.php in BOTH parent theme folder AND the child theme folder?

    No, that is allowed. Don't copy the functions.php file from your parent theme over, create the file with a good text editor and copy the pastebin code into it.

    Here are some text editors that don't mess with the formatting:
    free for Windows: Notepad++
    free for Mac: TextWrangler

  18. mcnamc2
    Member
    Posted 1 year ago #

    Interesting, that worked. I had been using Sublime Velocity all along.

    Thank you -- I am going to play with the series posting set up right now and see how that works! :)

    So grateful for your help, I really really appreciate your guidance as I learn WordPress. I am loving its flexibility!

    Catharine

  19. mcnamc2
    Member
    Posted 1 year ago #

    Hi Keeslemeijer:

    I've been going through your steps, and I'm worried that I'm creating a LOT of pages.

    What I've done, if I understood your instructions correctly is:

    1. add the single-workout.php and updated template.php files to my child themes.
    2. Created a new page, "Series (test)"
    3. Created a new page, "Endurance (test)"
    4. Created a new page, "Endurance (test) Week 1"
    5. Created a new workout post,/strong>, "Day 1"

    I am missing some connections between Steps 4 & 5:
    I created a WORKOUT post, but I cannot find the Parent that I mean to assign it to.
    When do I use the workout posts that you created for me?

    here's my site: http://www.cfote.com if you want to see how they are set up thus far.
    I am happy to share with you admin account if you want to take a look.

    Here's the "Series Week 1 page:
    http://www.cfote.com/series-test/week-1-test/day-1-workout-page-test/

    I noticed the breadcrumb needs one more layer. Is this something I do in the template.php file?

    (There will be multiple series)

    I am concerned with the approach outlined above that I'm creating a lot of PAGES that will make for a very very long navigation menu? Or have I misinterpreted?

    Thanks!
    Catharine

  20. keesiemeijer
    moderator
    Posted 1 year ago #

    I've been going through your steps, and I'm worried that I'm creating a LOT of pages.

    Well yes, every series is a page, every week is a page and every day is a page. This is to get pretty urls (workout/serie/week-1/day-1) and later we can query the weeks of a series or days of a particular week from a series etc..

    I am concerned with the approach outlined above that I'm creating a lot of PAGES that will make for a very very long navigation menu? Or have I misinterpreted?

    That depends what you put in the menu, only series or series and their weeks, or series with weeks and days. Right now all pages get automatically added to the "Header Menu". Look under wp-admin > Appearance > Menus to create your own menus.
    http://codex.wordpress.org/WordPress_Menu_User_Guide

    Try creating the menu you want, and for the "series" menu item add a "Custom Links" menu item with the url "http://www.cfote.com/workout/" and label "series" to the "Header Menu.

    You don't have to create a page called series

    1. Create a new (top level)(series) workout page, "Endurance"
    2. Create a new workout page, "Week 1" with parent "Endurance"
    3. Create a new workout post, "Day 1" with parent "Week 1"

    Endurance
    - week 1
    -- day 1

    Add the endurance page to the "series" menu item in your menu.

    I noticed the breadcrumb needs one more layer. Is this something I do in the template.php file?

    I will look into it.

  21. mcnamc2
    Member
    Posted 1 year ago #

    Hi! I think I found the issue:

    When I go to the new workout post, the only parents available are the other workout posts that I created.

    I deleted the Series page. (so that should resolve the breadcrumb issue)

    I created a Page: Endurance
    I created another Page: Week One. Was successful in setting Endurance as the parent.
    I created a Workout Post, Day 1.
    Parents available were NOT pages. But other workout posts that I created as test content.

    Know why that might be? Is there something I need to inspect in the code, the single-workout.php?

    Working on the menu steps right now.

    Catharine

  22. mcnamc2
    Member
    Posted 1 year ago #

    (FWIW, I do not have "Workout Pages" if that's a page type that you created. Just Workouts an >Add Posts are available options)

  23. keesiemeijer
    moderator
    Posted 1 year ago #

    Did you create the pages with the "workout" custom post type: http://i45.tinypic.com/4jqt1h.jpg

  24. mcnamc2
    Member
    Posted 1 year ago #

    Got the menus working! Thanks.

  25. mcnamc2
    Member
    Posted 1 year ago #

    AH! I got confused by the use of "Pages" and "posts" and created my pages OUTSIDE of the Workout Custom Post Type.

    Starting that again and trying my "Pages" from there. Hang tight. :)

  26. mcnamc2
    Member
    Posted 1 year ago #

    That worked. Thanks!

    Have successfully used Query Wrangler to run queries off of selected categories for the different series to post on the Homepage widgets. It's really coming together, nearly complete. I am excited!

    I'm trying to figure out from the homepage, how to allow for a site visitor to select the "category" of the workout they'd like to run from a drop-down list, and then the widgets will refresh to show the query. If you know of any forum posters who are savvy in this area, please do pass along!

    http://wordpress.org/support/topic/homepage-query-based-on-users-category-selection?replies=1

  27. keesiemeijer
    moderator
    Posted 1 year ago #

    I never used that plugin before. Where can I see one of the widgets.

    Now you have these links:

    http://www.cfote.com/workout/
    http://www.cfote.com/workout/endurance/
    http://www.cfote.com/workout/endurance/week-1/
    http://www.cfote.com/workout/endurance/week-1/day-1/

    What would you like to show on these pages?

    As of now /workout/ shows all pages. To show only "series" pages (endurence etc..) add this to your child theme's functions.php:

    function my_post_queries( $query ) {
      // not an admin page and is the main query
      if (!is_admin() && $query->is_main_query()){
        if(is_post_type_archive( 'workout' )){
          $query->set('post_parent', 0);
        }
      }
    }
    add_action( 'pre_get_posts', 'my_post_queries' );

    Did you connect the pages with the plugin?

  28. mcnamc2
    Member
    Posted 1 year ago #

    This is the plugin:
    http://wordpress.org/extend/plugins/query-wrangler/

    I got the plugin to pull in pages based on filters: category [category name] and Page Name (Day 1)

    I used the QW Widget and put it on the homepage. Pretty slick. Now I need to do it x3, one for each day. And have the widget refresh based on the user's selected category.

    I will duplicate the code you provided above to specify what displays on those pages:
    /workout -- All Series
    /endurance/ All Weeks
    /endurance/week-1/ All Days
    /endurance/week-1/day-1/ The workout itself.

    The intent is for the user to not need to go to these pages, but as an archival record of past workouts that can be searchable.

    My goal is for the widgets that post that week's workouts from the homepage based on the user's selected workout "track."

    Pretty cool right?!
    Catharine

  29. keesiemeijer
    moderator
    Posted 1 year ago #

    Not sure I understand, I only see the "Archive" widget on the front page? How do the users select a workout "track"?

    I will check out the plugin.

  30. mcnamc2
    Member
    Posted 1 year ago #

    Sorry about that -- that is strange you only see "Archive" . wonder why?!

    Do you not see this widget on the homepage? (which I do not have background on yet, whoops)

    http://cl.ly/image/1l1w3P220e3N

    Linked here my planned UX for the homepage:
    http://cl.ly/image/0B3e1L1A1A2F

    Hopefully that'll help you understand. I got the widgets to work appropriately.

    Now I need to figure out a way to allow users to select their "category" and have the widgets update the query. ...by javascript?

    Catharine

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags