<?php /** * Template Name: Notifications Page * * @subpackage CarToq Theme */ get_header(); global $current_user; $notifications_count = cjtheme_notifications_count($current_user->ID); ?> <div id="content" class="site-content"> <div class="container-fluid"> <div class="row"> <div class="hidden-xs hidden-sm hidden-md col-lg-2"> <div id="left-sidebar"> <?php dynamic_sidebar('sidebar-left'); ?> </div><!-- /#left-sidebar --> </div> <div class="col-lg-7"> <main id="main" rolw="main" class="site-main"> <section id="primary" class="content-area"> <article id="post-<?php the_ID(); ?> " <?php post_class();
function cjtheme_toggle_notification_read() { global $wpdb, $current_user; $table_notifications = $wpdb->prefix . 'cjtheme_notifications'; $id = $_POST['id']; $check_existing = $wpdb->get_row("SELECT * FROM {$table_notifications} WHERE id = '{$id}'"); if ($check_existing->unread == 0) { $data = array('unread' => 1); } else { $data = array('unread' => 0); } cjtheme_update($table_notifications, $data, 'id', $id); $check_existing = $wpdb->get_row("SELECT * FROM {$table_notifications} WHERE id = '{$id}'"); echo cjtheme_notifications_count($current_user->ID); die; }