Notes
Notes - notes.io |
// Exit if accessed directly
use function ClueStreamFilterremove;
if (!defined('ABSPATH'))
exit;
// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED - Do not modify or remove comment markers above or below:
if (!function_exists('chld_thm_cfg_locale_css')):
function chld_thm_cfg_locale_css($uri)
{
if (empty($uri) && is_rtl() && file_exists(get_template_directory() . '/rtl.css'))
$uri = get_template_directory_uri() . '/rtl.css';
return $uri;
}
endif;
add_filter('locale_stylesheet_uri', 'chld_thm_cfg_locale_css');
if (!function_exists('child_theme_configurator_css')):
function child_theme_configurator_css()
{
wp_enqueue_style('chld_thm_cfg_child', trailingslashit(get_stylesheet_directory_uri()) . 'style.css', array('hello-elementor', 'hello-elementor-theme-style', 'hello-elementor-header-footer'));
}
endif;
add_action('wp_enqueue_scripts', 'child_theme_configurator_css', 10);
// END ENQUEUE PARENT ACTION
add_filter('show_admin_bar', function () {
return current_user_can('administrator');
});
add_action('wp', 'maybe_hide_elementor_button');
function maybe_hide_elementor_button()
{
global $wpdb;
$user_id = get_current_user_id();
$table_name = $wpdb->prefix . 'ai_questions'; // Adjust if your table prefix is custom
// Check page and database condition
$hide_button = is_page(997965);
$exists = $wpdb->get_var(
$wpdb->prepare("SELECT COUNT(*) FROM {$table_name} WHERE userid = %d", $user_id)
);
$ex = ($exists > 0) ? 1 : 0;
if ($hide_button) {
add_action('wp_footer', function () use ($ex) {
if ($ex == 1) {
?>
<script>
document.addEventListener("DOMContentLoaded", function() {
var btn = document.getElementById("frmai_kz_hide");
if (btn) {
btn.style.display = "none";
}
});
</script>
<?php
}
});
}
}
// Restrict specific page(s) to logged-in users only
add_action('template_redirect', function () {
// List of restricted page IDs
$restricted_pages = [997965]; // Replace with your page IDs
if (is_page($restricted_pages) && !is_user_logged_in()) {
// Redirect non-logged-in users to login page
wp_redirect('/login/');
exit;
}
});
/*
add_filter('the_content', 'kaizen_restrict_exercise_content');
function kaizen_restrict_exercise_content($content) {
if ( is_page('exercise') ) {
if ( is_user_logged_in() ) {
$user = wp_get_current_user();
if ( in_array('kaizen_fitness_member', (array) $user->roles) ) {
return $content; // Show normal content
} else {
return '<p>You do not have permission to view this page.</p>';
}
} else {
$login_url = get_permalink( '998027' );
return '
<div class="min-h-screen flex items-center justify-center bg-gray-100">
<div class="text-center bg-white p-8 rounded-lg shadow-md">
<p class="text-lg text-gray-800">
Please <a href="' . $login_url . '" class="text-blue-600 hover:underline font-semibold">log in</a> to view this page.
</p>
</div>
</div>';
}
}
return $content;
}*/
add_filter('the_content', 'kaizen_restrict_exercise_content');
function kaizen_restrict_exercise_content($content)
{
global $post;
// Array of restricted page slugs
$restricted_pages = ['exercise', 'all-courses'];
// Get post type and slug
$post_type = get_post_type($post);
$post_slug = $post->post_name;
$is_restricted = false;
// Restrict if the page is a descendant of a restricted page
foreach ($restricted_pages as $slug) {
$page = get_page_by_path($slug);
if ($page) {
if ($post->ID == $page->ID || (!empty($post->ancestors) && in_array($page->ID, $post->ancestors))) {
$is_restricted = true;
break;
}
}
}
// Restrict LearnDash course single pages (like /courses/hacking-etico/)
if (is_singular('sfwd-courses')) {
$is_restricted = true;
}
if ($is_restricted) {
if (is_user_logged_in()) {
$user = wp_get_current_user();
$roles = (array) $user->roles;
if (in_array('administrator', $roles) || in_array('kaizen_fitness_member', $roles)) {
return $content;
} else {
return '
<style>
.sfwd-courses .entry-title {
display: none;
}
.ld-layout__sidebar,
.ld-primary-content .ld-course-status,
.ld-primary-content h1,
.ld-course-navigation,
.ld-breadcrumbs,
.ld-tabs {
display: none !important;
}
.ld-primary-content {
max-width: 100% !important;
padding: 40px;
text-align: center;
}
</style>
<div class="min-h-screen flex items-center justify-center bg-gray-100">
<div class="text-center bg-white p-8 rounded-lg shadow-md">
<p class="text-center text-red-600 font-semibold py-10">You do not have permission to view this page.</p>
</div>
</div>';
}
} else {
$login_url = get_permalink(998027); // Replace with correct login page ID
return '
<style>
.sfwd-courses .entry-title {
display: none;
}
.ld-layout__sidebar,
.ld-primary-content .ld-course-status,
.ld-primary-content h1,
.ld-course-navigation,
.ld-breadcrumbs,
.ld-tabs {
display: none !important;
}
.ld-primary-content {
max-width: 100% !important;
padding: 40px;
text-align: center;
}
</style>
<div class="min-h-screen flex items-center justify-center bg-gray-100">
<div class="text-center bg-white p-8 rounded-lg shadow-md">
<p class="text-lg text-gray-800">
Please <a href="' . esc_url($login_url) . '" class="text-blue-600 hover:underline font-semibold">log in</a> to view this page.
</p>
</div>
</div>';
}
}
return $content;
}
function custom_learndash_course_list_shortcode()
{
$courses = get_posts(array(
'post_type' => 'sfwd-courses',
'post_status' => 'publish',
'numberposts' => -1
));
if (empty($courses)) {
return '<p>No courses found.</p>';
}
$output = '<div class="course-list">';
foreach ($courses as $course) {
$course_id = $course->ID;
$title = esc_html(get_the_title($course_id));
$permalink = esc_url(get_permalink($course_id));
$output .= '<div class="course-item" style="margin-bottom: 20px;">';
$output .= "<h3>$title</h3>";
$output .= "<a href="$permalink" class="join-button" style="padding: 6px 12px; background-color: #0073aa; color: #fff; text-decoration: none; border-radius: 4px;">Join Course</a>";
$output .= '</div>';
}
$output .= '</div>';
return $output;
}
add_shortcode('custom_course_list', 'custom_learndash_course_list_shortcode');
add_action('init', function () {
if (is_user_logged_in() && isset($_GET['join_course'])) {
$course_id = intval($_GET['join_course']);
$user_id = get_current_user_id();
// Check if it's a real course
if (get_post_type($course_id) === 'sfwd-courses') {
// Enroll the user into the course
ld_update_course_access($user_id, $course_id);
// Redirect to course page after joining
wp_redirect(get_permalink($course_id));
exit;
}
}
});
/*
add_filter('the_content', 'block_learndash_pages_for_guests_html');
function block_learndash_pages_for_guests_html($content) {
if (
(is_singular('sfwd-courses') || is_post_type_archive('sfwd-courses')) &&
!is_user_logged_in()
) {
// Custom full-page message + hide LearnDash layout via inline CSS
return '
<style>
.ld-layout__sidebar,
.ld-primary-content .ld-course-status,
.ld-primary-content h1,
.ld-course-navigation,
.ld-breadcrumbs,
.ld-tabs {
display: none !important;
}
.ld-primary-content {
max-width: 100% !important;
padding: 40px;
text-align: center;
}
</style>
<div class="ld-blocked-message">
<h2 style="font-size: 28px; color: #cc0000;">Access Restricted</h2>
<p style="margin: 20px 0;">You need to log in to access this course.</p>
<a href="' . wp_login_url(get_permalink()) . '" style="padding: 10px 20px; background-color: #0073aa; color: white; border-radius: 5px; text-decoration: none;">
Log In
</a>
</div>
';
}
return $content;
}
*/
add_shortcode('logout_link', function () {
if (!is_user_logged_in()) {
return '';
}
return sprintf(
'<a href="%s" class="text-white hover:text-red-500 no-underline transition-colors duration-200">Cerrar sesión</a>',
esc_url(wp_logout_url(home_url('/')))
);
});
// not working
add_filter('the_title', 'add_custom_html_before_course_title', 10, 2);
function add_custom_html_before_course_title($title, $post_id)
{
$dashboard_url = get_permalink('997810');
if (get_post_type($post_id) === 'sfwd-courses' && is_singular('sfwd-courses')) {
// Only apply to the main title (avoid menus/widgets etc.)
if (in_the_loop() && is_main_query()) {
$custom_html = '<div class="text-black text-sm">
<div class="max-w-12xl mx-auto pb-8">
<div class="flex justify-between items-center h-20">
<!-- Logo -->
<div class="flex-shrink-0">
<a href="' . home_url() . '/my-account/">
<img src="' . home_url() . '/wp-content/uploads/2025/02/Kaizen-777_2-White-01-2048x2048-1-1024x1024.png" alt="Logo" class="h-10">
</a>
</div>
<!-- Desktop Menu -->
<div class="hidden md:flex items-center space-x-6">
<a href="' . $dashboard_url . '" class="text-black hover:text-gray-700">hola</a>
<span class="text-black">|</span>
<a href="' . $dashboard_url . '?section=subscription" class="text-black hover:text-gray-700">Ajustes</a>
<span class="text-black">|</span>
<a href="' . $dashboard_url . '?section=settings" class="text-black hover:text-gray-700">Configuración</a>
<span class="text-black">|</span>
<a href="' . wp_logout_url(home_url()) . '" class="text-black hover:text-red-500 no-underline transition-colors duration-200">Cerrar sesión</a>
<span class="text-black">|</span>
<a href="' . home_url() . '/my-account/" class="bg-black text-white px-3 py-1 rounded hover:bg-gray-800">Mi cuenta</a>
</div>
</div>
</div>
</div>
';
return $custom_html . $title;
}
}
return $title;
}
// Header en secciones de curso (inserta navbarDefault() en Focus Mode)
add_action('wp_footer', function () {
if (is_singular('sfwd-lessons')) {
// Genera el HTML del navbar en PHP (asegúrate que navbarDefault() existe)
$navbar_html = function_exists('navbarDefault') ? navbarDefault() : '';
if (empty($navbar_html)) {
return;
}
?>
<script>
document.addEventListener('DOMContentLoaded', function() {
// navbarHtml viene escapado/encodificado por PHP con wp_json_encode
const navbarHtml = <?php echo wp_json_encode(do_shortcode('[stripeacstai_box_nav_bar theme="light" logo="False"]')); ?>;
if (!navbarHtml) return;
const banner = document.createElement('div');
banner.classList.add('kaizen-banner');
banner.innerHTML = navbarHtml;
const content = document.getElementById('ld-focus-content');
content.prepend(banner);
});
</script>
<?php
}
});
add_filter('the_content', 'add_html_before_exercise_content');
function add_html_before_exercise_content($content)
{
global $post;
// Check if we're on a page and in the main query
if (is_page() && is_main_query()) {
// Get all ancestors
$ancestors = get_post_ancestors($post);
$ancestor_slugs = array();
foreach ($ancestors as $ancestor_id) {
$ancestor = get_post($ancestor_id);
if ($ancestor) {
$ancestor_slugs[] = $ancestor->post_name;
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team
