Add filter for allowed nav item post status#30
Conversation
|
@sbrody is there already a function.php that exists in the theme? |
RobjS
left a comment
There was a problem hiding this comment.
This works well for me 👍
I guess one thing we might need to consider is that the sidenav on the parent page gets triggered by the existence of children even if those children are only in draft and the filter is not applied, so they aren't appearing in the sidenav. Meaning you end up with a sidenav that just lists the parent page. But that was pre-existing issue, so not one for dealing with here.
apologies, read that test as literal, should have realised its wrapped up in a framework >< |
We tend to move functions.php into templates/ |
Description of changes
This PR replaces the hard-coded addition of 'draft' to the status of posts allowed to appear in the long read nav, with a filter.
So, in a child theme or plugin the draft status can be added.
To test: Create a new style long read post. Add a draft article as a child of that post. It should not appear in the navigation.
Now, add this code to functions.php
add_filter('long_read_plugin_post_status', function($postStatus) { array_push($postStatus, 'draft'); return $postStatus; });The draft article should now appear in the navigation, even for logged out users.
This is the second item of this card: https://trello.com/c/vjzEsXkS/337-enable-public-previews-for-content-including-long-reads
Checklist