Skip to content

add password support to pages#118

Open
stefenphelps wants to merge 1 commit intotimber:1.xfrom
stefenphelps:patch-1
Open

add password support to pages#118
stefenphelps wants to merge 1 commit intotimber:1.xfrom
stefenphelps:patch-1

Conversation

@stefenphelps
Copy link
Contributor

No description provided.

Comment on lines +28 to +32
if (post_password_required($timber_post->ID)) {
Timber::render("single-password.twig", $context);
} else {
Timber::render( array( 'page-' . $timber_post->post_name . '.twig', 'page.twig' ), $context );
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (post_password_required($timber_post->ID)) {
Timber::render("single-password.twig", $context);
} else {
Timber::render( array( 'page-' . $timber_post->post_name . '.twig', 'page.twig' ), $context );
}
Timber::render(
post_password_required( $timber_post->ID )
? 'single-password.twig'
: array( 'page-' . $timber_post->post_name . '.twig', 'page.twig' ),
$context
);

How about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personally, I prefer the more verbose conditional vs. the ternary one... but maybe that's just me. 🤷‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the big sack in a small sack, you like the small sack in the big one :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants