Skip to content

Commit 77fe855

Browse files
setup logic to control which context is applied depending on depth of course item viewed
1 parent 10b8acf commit 77fe855

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

src/footer-course_embed.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<footer>
1+
<!-- <footer>
22

3-
</footer>
3+
</footer> -->
44

55
<script src="<?php echo get_bloginfo( 'template_directory' ); ?>/vocabulary/js/vocabulary.js"></script>
66

src/header-course_embed.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
<body class="<?php echo $args['body-classes']; ?>">
2020
<a class="skip-to-content" href="#main-content-marker">Skip to content</a>
2121

22-
<header>
22+
<!-- <header>
2323

2424
<h1>CC Thing</h1>
2525

26-
</header>
26+
</header> -->
2727

2828
<span id="main-content-marker"></span>

src/single-course.php

+37-1
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,50 @@
1717

1818
?>
1919

20-
<?php get_header($embedded_template, array( 'body-classes' => 'course-page') ); ?>
20+
<?php
21+
22+
$args = array(
23+
'post_parent' => get_the_ID(), // Current post's ID
24+
);
25+
$children = get_children( $args );
26+
27+
if ( ! empty($children) ) {
28+
29+
$isParent = true;
30+
31+
} else {
32+
$isParent = false;
33+
}
34+
35+
if ($isParent && !has_post_parent() ) {
36+
$contextType = 'course-index';
37+
} elseif (has_post_parent()) {
38+
$contextType = 'course-page';
39+
}
40+
41+
?>
42+
43+
<?php get_header($embedded_template, array( 'body-classes' => $contextType) ); ?>
2144

2245
<main>
2346

2447
<?php while ( have_posts() ) : the_post(); ?>
2548

2649
<header>
2750

51+
<nav class="breadcrumbs">
52+
<ul>
53+
<?php if ($contextType == 'course-index') : ?>
54+
<li>Creative Commons</li>
55+
<?php endif; ?>
56+
<?php if($contextType == 'course-page') : ?>
57+
<li><a href="#">Creative Commons</a></li>
58+
<?php endif; ?>
59+
60+
<li><a href="#">top title of course</a></li>
61+
</ul>
62+
</nav>
63+
2864
<h1><?php the_title(); ?></h1>
2965

3066
<!-- <p>lead in paragraph</p> -->

0 commit comments

Comments
 (0)