Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Zabezpieczenie treści *
- *
- * Jest to funkcja pomocnicza, której możesz użyć
- * aby zabezpieczyć elementy na stronie inne niż treść wpisu
- * np.: slider, miniaturka, itd.
- *
- * wstaw ją na końcu pliku funkcyjnego functions.php
- */
- function is_content_locker_by_wpsolucje(){
- $locker = new WPSolucje\ContentLocker\Locker( get_the_ID() );
- if ( $locker->is_locked( true ) ) {
- return true;
- } else {
- return false;
- }
- }
- //Jeżeli chcesz użyć tej funkcji w kodzie, dany element należy objąć warunkiem np.:
- if ( is_content_locker_by_wpsolucje() ) {
- // Treść zabezpieczona
- } else {
- // Treść odbezpieczona
- }
- // Lub bez warunku zwrotnego:
- if ( !is_content_locker_by_wpsolucje() ) {
- // Treść odbezpieczona
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement