adding future public date (ie auto-publish post on ____)
Permalink Browser Info Environment
I added the ability to set a future date on a post and have it hide* until then, then auto-appear.
Copy
packages/problog/blocks/problog_list/controller.php
to
blocks/problog_list/controller.php
Around line 75 (after the 'orderBy' switch conditional closes) add this code:
Now the post won't appear in any ProBlog list until the "public" date you set in the ProBlog Dashboard add/edit settings.
To be able to see the future-dated page I also copied
packages/problog/blocks/content/blog_post/view.php
to
blocks/content/blog_post/view.php
and commented out the date check around line 22:
Don't forget to comment out the closing brace at the end of that file just above the
I couldn't think of why there should be a date-check in the content block, so it seemed innocuous to remove it. Please correct me if I'm wrong!
*The Catch
Posts still appear in auto-nav and page-list blocks, and also in your sitemap.xml. The page/post is still part of the CMS, but the problog_list block ignores it. Maybe someone else can improve upon this?
Copy
packages/problog/blocks/problog_list/controller.php
to
blocks/problog_list/controller.php
Around line 75 (after the 'orderBy' switch conditional closes) add this code:
// filter out future posts $pl->filterByPublicDate(date('Y-m-d H:i:s'), '<=');
Now the post won't appear in any ProBlog list until the "public" date you set in the ProBlog Dashboard add/edit settings.
To be able to see the future-dated page I also copied
packages/problog/blocks/content/blog_post/view.php
to
blocks/content/blog_post/view.php
and commented out the date check around line 22:
Don't forget to comment out the closing brace at the end of that file just above the
<br style="clear:both">
I couldn't think of why there should be a date-check in the content block, so it seemed innocuous to remove it. Please correct me if I'm wrong!
*The Catch
Posts still appear in auto-nav and page-list blocks, and also in your sitemap.xml. The page/post is still part of the CMS, but the problog_list block ignores it. Maybe someone else can improve upon this?
Type: | Discussion |
---|---|
Status: | New |
The issue I ran into is if you use if/else in the view you're messing with the pagination that is set in the controller.
I modded the search feature to use the Problog_list block and am running into that issue. For instance, the controller might return a list of 7 items to show, but depending on the filtering criteria I end up with paginated results that 0 - 7 items on each page :-(
Ideally the block would set the filter criteria (ie category or tag) and pass that to the controller so pagination could be function as expected.
Not expecting you to implement this, I'm just talking through it.
I modded the search feature to use the Problog_list block and am running into that issue. For instance, the controller might return a list of 7 items to show, but depending on the filtering criteria I end up with paginated results that 0 - 7 items on each page :-(
Ideally the block would set the filter criteria (ie category or tag) and pass that to the controller so pagination could be function as expected.
Not expecting you to implement this, I'm just talking through it.
I like this better though, so if you don't mind, I will add this to the blog_list controller.
for your help, I will be sending you a free license of Quick-links addon.
C