Install
Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/altprjcts/pms-locked-posts/releases/download/v1.1.0/pms-locked-posts.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
This repository holds the source codes of the plugin. To be able to install the plugin in WP, you would need to build it first.
You can also download the installable plugin from each release.
How to build the plugin
Make sure Node.js is installed on your system.
- In the plugin root directory, run:
npm install - Then run the following command, it generates a folder with name of the plugin. You can zip it and install it in WP.
npm run release
You can also check package.json file for more commands.
Theme modifications
Some of the modifications are inside the theme.
- banner_contentrestriction.php
This is provided by the client, I modified it to add the custom fields' options.
- template_geral.php
This is provided by the client, I modified it to add lock feature for pages' block.
<!-- Lock feature. -->
<?php
$preview_blocks = [];
$is_page_locked = false;
if ( function_exists( 'pmslp_get_page_preview_blocks' ) ) {
$preview_blocks = pmslp_get_page_preview_blocks();
}
if ( function_exists( 'pmslp_get_page_preview_blocks' ) ) {
$is_page_locked = pmslp_is_page_locked();
if (
is_user_logged_in()
&& current_user_can( 'manage_options' )
) {
$is_page_locked = false;
}
}
?>
// Checks if page is locked to show preview blocks and content restriction banner.
if ( $is_page_locked ) {
$block = get_row_index() . '-' . get_row_layout();
if ( ! in_array( $block, $preview_blocks, true ) ) {
if ( function_exists( 'pmslp_load_content_restriction_banner' ) ) {
pmslp_load_content_restriction_banner();
}
break;
}
}Releases
2 releases. Each count is every asset in that release; expand a row for the breakdown.