Support » Plugin: Room 34 presents On This Day » Embed On This Day like related posts in post template above or below comments

  • The widget currently dynamically displays historical posts for the current (system) date. This is cool.

    I would like to be able to (also, additionally) show posts for the same date as a specific post in the post page. More or less like a “related posts” list.

    Could I already add an existing function from this plugin to my template? Or would you consider developing such a feature?

    • This topic was modified 8 months, 2 weeks ago by Robert.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author room34

    (@room34)

    This turned out to be a very easy feature to add.

    The widget options now include a new checkbox called “Use post date”. If this is checked, when the user is viewing an individual post, the post’s date will be used for the widget instead of today’s date. Main blog page and archive pages will still use today’s date.

    This is in version 2.2.0 which should be available shortly.

    Plugin Author room34

    (@room34)

    Hmmm… I just reread your original post, and it looks like you’d want the widget to show BOTH the posts from today’s date AND the ones from the post’s date, is that correct?

    *EDIT*

    I decided to add a way for the widget to track whether an exact list of posts has already been displayed on the page, and not display it again. This allows you to set up two widgets in your sidebar — one for “today’s” posts, and one for “use post date” posts. On individual posts, both lists will show. On the main blog/archive pages, only “today’s” posts will show.

    This is in version 2.2.1, which should be available now.

    • This reply was modified 8 months, 2 weeks ago by room34.

    I actually did not mean to use the widget. My theme has an area at the bottom. What I want is to add a section to the single.php template.

    Plugin Author room34

    (@room34)

    Ah, got it. Well… writing a way to make this work in a template instead of as a widget would be a bit more work than I can devote to this at the moment, but what you could do is create a new sidebar in your single.php template. For sake of demonstration I’ll call it “single_after_sidebar”.

    In functions.php you’d register the sidebar:

    register_sidebar(array(
      'name' => 'Single After Sidebar',
      'id' => 'single_after_sidebar',
    ));

    That function’s input array takes additional parameters; these are just the bare bones we need right now.

    Then in single.php where you want it to appear you’d render the sidebar:

    if (is_active_sidebar('single_after_sidebar')) {
      dynamic_sidebar('single_after_sidebar');
    }

    Now you can go to Appearance > Widgets and create an On This Day widget in the Single After Sidebar and it should appear on the page. You may need to add some of the extra options to register_sidebar() and/or add some additional HTML and CSS to get things looking just the way you want.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Embed On This Day like related posts in post template above or below comments’ is closed to new replies.