Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNOW-7: Various CSS tweaks and experimenting some sidebar changes.
- Loading branch information
1 parent
23bc6ba
commit cec99a3
Showing
10 changed files
with
237 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
/** | ||
* For a category, display the category's landing page. | ||
* | ||
* To make a category landing page: | ||
* 1. Make a post. | ||
* 2. Give it a name you would recognize like "About Us Landing Page". | ||
* This title is ignored and is useful only to identify it easily in the | ||
* Wordpress admin. | ||
* 3. Add the following into the post's Custom Fields: | ||
* name: is_landing_page | ||
* value: true | ||
* 4. Assign the post to the category it's supposed to be a landing page for. | ||
* | ||
* @package a11y | ||
*/ | ||
$category_name = ''; | ||
$category_landing_id = ''; | ||
$category_landing_content = ''; | ||
$category_current = get_the_category(); | ||
|
||
if ( ! empty( $category_current ) ) { | ||
$category_name = $category_current[0]->name; | ||
$args = array( | ||
'post_type' => 'post', | ||
'category_name' => $category_current[0]->slug, | ||
'meta_query' => array ( | ||
array ( | ||
'key' => 'is_landing_page', | ||
'value' => 'true', | ||
'compare' => '=', | ||
), | ||
), | ||
); | ||
$the_query = new WP_Query($args); | ||
|
||
while ( $the_query->have_posts() ) { | ||
/* If there is a landing page for the category. */ | ||
$the_query->the_post(); | ||
$category_landing_content = get_the_content(); | ||
$category_landing_id = get_the_ID(); | ||
} | ||
/* Restore original Post Data */ | ||
wp_reset_postdata(); | ||
} | ||
|
||
get_header(); | ||
get_sidebar('post'); | ||
?> | ||
<main id="content" class="a11y-site-main columns"> | ||
<h1><?php echo $category_name ?></h1> | ||
<section> | ||
<article> | ||
<div class="a11y-entry-content"> | ||
<?php echo apply_filters('the_content', $category_landing_content); //do_shortcode ($category_landing_content); ?> | ||
</div> | ||
</article> | ||
<?php if (empty ($category_landing_id)) { | ||
/* No landing page to show, then list posts in the category. */ | ||
/* Start the Loop */ | ||
if (have_posts()) : | ||
while ( have_posts() ) : the_post(); | ||
get_template_part( 'template-parts/content', get_post_format() ); | ||
endwhile; | ||
|
||
the_posts_navigation(); | ||
|
||
/* Restore original Post Data */ | ||
wp_reset_postdata(); | ||
else : | ||
echo wpautop ('No posts'); | ||
endif; | ||
} | ||
?> | ||
</section> | ||
</main> | ||
<?php | ||
get_footer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
/** | ||
* The sidebar containing the main widget area | ||
* | ||
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials | ||
* | ||
* @package a11y | ||
*/ | ||
|
||
global $category_landing_id; | ||
?> | ||
|
||
<aside class="a11y-site-aside small-14 medium-4 columns" role="complementary"> | ||
<?php | ||
|
||
create_sidebar('page'); | ||
?> | ||
</aside> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
/** | ||
* The sidebar containing the main widget area | ||
* | ||
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials | ||
* | ||
* @package a11y | ||
*/ | ||
|
||
global $category_landing_id; | ||
?> | ||
|
||
<aside class="a11y-site-aside small-14 medium-4 columns" role="complementary"> | ||
<?php | ||
echo 'Hello'; | ||
create_sidebar('post'); | ||
?> | ||
</aside> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
/** | ||
* The template for displaying all single posts | ||
* | ||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post | ||
* | ||
* @package a11y | ||
*/ | ||
|
||
get_header(); | ||
get_sidebar('post'); | ||
?> | ||
<main id="content" class="a11y-site-main columns"> | ||
|
||
<?php | ||
while ( have_posts() ) : the_post(); | ||
|
||
get_template_part( 'template-parts/content', get_post_format() ); | ||
|
||
// If comments are open or we have at least one comment, load up the comment template. | ||
if ( comments_open() || get_comments_number() ) : | ||
comments_template(); | ||
endif; | ||
|
||
endwhile; // End of the loop. | ||
?> | ||
</main> | ||
<?php | ||
get_footer(); |
Oops, something went wrong.