Skip to content

Commit 10b8acf

Browse files
setup parametric header/footer display via URL param, for simplified embedded view
1 parent ddf5b10 commit 10b8acf

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
lines changed

src/footer-course_embed.php

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<footer>
2+
3+
</footer>
4+
5+
<script src="<?php echo get_bloginfo( 'template_directory' ); ?>/vocabulary/js/vocabulary.js"></script>
6+
7+
<?php wp_footer(); ?>
8+
</body>
9+
</html>

src/functions.php

+8
Original file line numberDiff line numberDiff line change
@@ -276,3 +276,11 @@ function person_disable_redirect_canonical($redirect_url) {
276276
if (is_paged() && is_singular()) $redirect_url = false;
277277
return $redirect_url;
278278
}
279+
280+
// register custom embedded URL parameter for course-page template
281+
282+
add_action('init','add_embedded');
283+
function add_embedded() {
284+
global $wp;
285+
$wp->add_query_var('embedded');
286+
}

src/header-course_embed.php

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html lang="en-US">
3+
<head>
4+
5+
<title><?php wp_title('-',true,'right'); //this requires YOAST SEO plugin to be active to output ?></title>
6+
7+
<meta charset="UTF-8">
8+
<meta name="viewport" content="width=device-width, initial-scale=1">
9+
<link rel="icon" href="<?php echo get_bloginfo( 'template_directory' ); ?>/vocabulary/favicon/favicon.ico" sizes="any" />
10+
<link rel="icon" href="<?php echo get_bloginfo( 'template_directory' ); ?>/vocabulary/favicon/favicon.svg" type="image/svg+xml" />
11+
<link rel="manifest" href="<?php echo get_bloginfo( 'template_directory' ); ?>/vocabulary/favicon/manifest.webmanifest" />
12+
<link rel="apple-touch-icon" sizes="180x180" href="<?php echo get_bloginfo( 'template_directory' ); ?>/vocabulary/favicon/apple-touch-icon.png" />
13+
14+
<link rel="stylesheet" media="all" href="<?php echo get_bloginfo( 'template_directory' ); ?>/style.css" />
15+
16+
<?php wp_head(); ?>
17+
</head>
18+
19+
<body class="<?php echo $args['body-classes']; ?>">
20+
<a class="skip-to-content" href="#main-content-marker">Skip to content</a>
21+
22+
<header>
23+
24+
<h1>CC Thing</h1>
25+
26+
</header>
27+
28+
<span id="main-content-marker"></span>

src/single-course.php

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
global $wp;
4+
if (array_key_exists('embedded', $wp->query_vars) && isset($wp->query_vars['embedded'])){
5+
if ($wp->query_vars['embedded'] == 'true') {
6+
$embedded = true;
7+
} else {
8+
$embedded = false;
9+
}
10+
}
11+
12+
if ($embedded == true) {
13+
$embedded_template = 'course_embed';
14+
} else {
15+
$embedded_template = '';
16+
}
17+
18+
?>
19+
20+
<?php get_header($embedded_template, array( 'body-classes' => 'course-page') ); ?>
21+
22+
<main>
23+
24+
<?php while ( have_posts() ) : the_post(); ?>
25+
26+
<header>
27+
28+
<h1><?php the_title(); ?></h1>
29+
30+
<!-- <p>lead in paragraph</p> -->
31+
32+
33+
<!-- <img src="#" /> -->
34+
35+
</header>
36+
37+
<div class="content">
38+
39+
40+
<?php the_content(); ?>
41+
42+
43+
</div>
44+
45+
46+
<?php endwhile; // end of the loop. ?>
47+
</main>
48+
49+
<?php get_footer($embedded_template); ?>

0 commit comments

Comments
 (0)