Support » Fixing WordPress » Week as a Post with 3 Posts [Post within a Post]

  • Resolved mcnamc2


    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.


Viewing 15 replies - 1 through 15 (of 32 total)
  • Moderator keesiemeijer


    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:

    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?


    Moderator keesiemeijer


    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?

    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.

    Let me know what further information I can provide.

    Thank you!

    Moderator keesiemeijer


    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:

    Or if the weeks do correlate (also with a custom post type “workout”):

    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!)

    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:


    Moderator keesiemeijer


    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. // show all series // shows all weeks of series a // shows all days of week 1 // shows single post day 1

    I will check out the plugin.

    Moderator keesiemeijer


    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):

    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 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.

    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!


    Moderator keesiemeijer


    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:

    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).


    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:

    Thank you!

    Moderator keesiemeijer


    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:
    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.

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

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


    Moderator keesiemeijer



    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?

    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.

Viewing 15 replies - 1 through 15 (of 32 total)
  • The topic ‘Week as a Post with 3 Posts [Post within a Post]’ is closed to new replies.