function get_parent_titles($parent_id) { $titles[] = get_menu_title($parent_id); if (is_parent($parent_id) != false) { $parent_titles = get_parent_titles(is_parent($parent_id)); $titles = array_merge($titles, $parent_titles); } //is_parent( $parent_id ) != false return $titles; }
function get_parent_ids($parent_id) { $ids[] = $parent_id; if (is_parent($parent_id) != false) { $parent_ids = get_parent_ids(is_parent($parent_id)); $ids = array_merge($ids, $parent_ids); } //is_parent( $parent_id ) != false return $ids; }
function get_parent_ids($parent_id) { $ids[] = intval($parent_id); if (is_parent($parent_id) != false) { $parent_ids = get_parent_ids(is_parent($parent_id)); $ids = array_merge($ids, $parent_ids); } return $ids; }
if (user_type() != "admin") { cust_die("You may not view this page."); } connect_sql(); if (!isset($_POST['studentid']) or $_POST['studentid'] == "" or is_numeric($_POST['studentid']) == FALSE) { cust_die("You must submit the student's ID. This probably shouldn't come up; perhaps you should submit a bug report."); } $studentID = escape_string($_POST['studentid']); if (is_student($studentID) == FALSE) { cust_die("Invalid student ID."); } if (!isset($_POST['parent']) or $_POST['parent'] == "" or is_numeric($_POST['parent']) == FALSE) { cust_die("You must submit the parent's ID. This probably shouldn't come up; perhaps you should submit a bug report."); } $parentID = escape_string($_POST['parent']); if (is_parent($parentID) == FALSE) { cust_die("Invalid parent ID."); } // 'kay, get the students the parent has attached to his or her account $other_students = @query("SELECT `students` FROM `parents` WHERE `parent_ID`='{$parentID}' LIMIT 1") or die("Error checking the database."); while ($row = result($other_students)) { $students = $row->students; $students = explode(",", $students); // break it into an array and search (there are better ways to do it, but this'll work) $i = 0; foreach ($students as $student) { if ($student == $studentID) { unset($students[$i]); } else { $i++; }
<main id="main" class="site-main" role="main"> <?php while (have_posts()) { the_post(); ?> <?php if (is_parent() && !is_child()) { get_template_part('content', 'chapter'); } else { if (is_parent() && is_child()) { get_template_part('content', 'subchapter'); } else { if (!is_parent() && is_child()) { get_template_part('content', 'article'); } else { if (is_front_page()) { get_template_part('content', 'home'); } else { get_template_part('content', 'page'); } } } } ?> <?php // If comments are open or we have at least one comment, load up the comment template if (comments_open() || get_comments_number()) {