Skip to content

Commit dafbc28

Browse files
committed
Merge branch 'master' of github.com:creativecommons/wp-theme-base
2 parents 9ee670a + 1537b65 commit dafbc28

11 files changed

Lines changed: 169 additions & 24 deletions

File tree

assets/css/styles.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

front/src/styles/base.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.page, .single {
22
.main-content {
3-
padding-top: $space-bigger;
3+
padding-top: 0;
44
padding-bottom: $space-bigger;
55
.entry-page-content {
66
padding-top: $space-large;

front/src/styles/modules.scss

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,56 @@
115115
}
116116
}
117117
}
118+
.page {
119+
.sidebar {
120+
padding-top: 1.5rem;
121+
}
122+
}
123+
.side-navigation {
124+
.list-pages {
125+
.page_item {
126+
a {
127+
display: block;
128+
padding: $space-normal;
129+
margin-bottom: $space-smaller;
130+
background-color: $color-lighter-gray;
131+
font-weight: 700;
132+
}
133+
&.current_page_item, &.current_page_ancestor {
134+
&.page_item_has_children {
135+
&>a {
136+
margin-bottom: 0;
137+
color: $color-black;
138+
}
139+
}
140+
.children {
141+
display: block;
142+
margin-bottom: $space-smaller;
143+
padding-bottom: $space-normal;
144+
padding-left: $space-larger;
145+
background-color: $color-lighter-gray;
146+
list-style-type: disc;
147+
.page_item {
148+
&>a {
149+
padding-top: $space-smaller;
150+
padding-bottom: $space-smaller;
151+
padding-left: $space-small;
152+
margin-bottom: 0;
153+
}
154+
&.current_page_item {
155+
&>a {
156+
color: $color-black;
157+
}
158+
}
159+
}
160+
}
161+
}
162+
}
163+
.children {
164+
display: none;
165+
}
166+
}
167+
}
118168
.entry-footer {
119169
.leveled {
120170
justify-content: space-between;

header.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,7 @@
2222
<nav class="navbar">
2323
<div class="navbar-brand">
2424
<a href="<?php bloginfo( 'url' ); ?>" class="has-text-black">
25-
<svg
26-
class="logo"
27-
xmlns="http://www.w3.org/2000/svg"
28-
preserveAspectRatio="xMidyMid meet"
29-
viewBox="0 0 304 73">
30-
<use href="<?php echo get_bloginfo( 'template_directory' ) . '/assets/img/logos/cc/logomark.svg#logomark'; ?>"></use>
31-
</svg>
25+
<?php echo CC_Site::get_current_website_logo(); ?>
3226
</a>
3327
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
3428
<span aria-hidden="true"></span>

inc/class-cc-site.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,29 @@ static function page_title() {
133133
the_title();
134134
}
135135
}
136+
/**
137+
* Set the default website logo and allows to filter it in child themes
138+
*
139+
* @return void
140+
*/
141+
public static function get_current_website_logo() {
142+
$default_logo = 'logomark';
143+
$current_main_logo = apply_filters( 'cc_theme_base_set_default_logo', $default_logo );
144+
return Components::cc_logos($current_main_logo, false);
145+
}
146+
/**
147+
* Get the top parent page of the current navigation level
148+
*
149+
* @return int $post_id : top level parent page
150+
*/
151+
public static function get_parent_page() {
152+
global $post;
153+
if ($post->post_parent) {
154+
$ancestors = get_post_ancestors($post->ID);
155+
$root = count( $ancestors )-1;
156+
return $ancestors[$root];
157+
} else {
158+
return $post->ID;
159+
}
160+
}
136161
}

inc/class-components.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ public static function card_link( $post_id = null, $use_post_data = false, $back
261261
$color_class = ( ! $has_border ) ? 'class="has-background-' . $background_color . '"' : '';
262262
$class = ( ! empty( $extra_class ) ) ? ' ' . $extra_class : '';
263263

264-
$out .= '<article class="card entry-post link ' . $border_class . $class . '">';
264+
$out = '<article class="card entry-post link ' . $border_class . $class . '">';
265265
$out .= '<a href="' . $the_url . '" ' . $color_class . '>';
266266
$out .= '<span class="card-content has-bottom-link">';
267267
$out .= '<h2 class="card-title">' . $the_title . '</h2>';
@@ -370,4 +370,28 @@ public static function simple_entry( $post_id, $has_content = true, $has_image =
370370
$out .= '</article>';
371371
return $out;
372372
}
373+
/**
374+
* cc_logos
375+
*
376+
* @param string $logo_name lettermark|letterheart
377+
* @param boolean $has_dark_background
378+
* @return void
379+
*/
380+
public static function cc_logos($logo_name = 'logomark', $has_dark_background = false) {
381+
$out = '';
382+
if ( $has_dark_background ) {
383+
$out .= '<div class="has-text-white">';
384+
}
385+
$out .= '<svg';
386+
$out .= ' class="logo"';
387+
$out .= ' xmlns="http://www.w3.org/2000/svg"';
388+
$out .= ' preserveAspectRatio="xMidyMid meet"';
389+
$out .= ' viewBox="0 0 304 73">';
390+
$out .= ' <use href="'.get_bloginfo( 'template_directory' ) . '/assets/img/logos/cc/'.$logo_name.'.svg#'.$logo_name.'"></use>';
391+
$out .= '</svg>';
392+
if ( $has_dark_background ) {
393+
$out .= '</div>';
394+
}
395+
return $out;
396+
}
373397
}

inc/widgets.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
/**
33
* THEME WIDGETS
44
*/
5-
require STYLESHEETPATH . '/inc/widgets/cc-columns-widgets.php';
6-
require STYLESHEETPATH . '/inc/widgets/cc-banner-link.php';
7-
require STYLESHEETPATH . '/inc/widgets/cc-notification.php';
8-
require STYLESHEETPATH . '/inc/widgets/cc-list-entries.php';
9-
require STYLESHEETPATH . '/inc/widgets/cc-newsletter-form.php';
10-
require STYLESHEETPATH . '/inc/widgets/cc-twitter-timeline.php';
11-
require STYLESHEETPATH . '/inc/widgets/cc-card.php';
12-
require STYLESHEETPATH . '/inc/widgets/cc-title.php';
13-
require STYLESHEETPATH . '/inc/widgets/cc-donate.php';
5+
require TEMPLATEPATH . '/inc/widgets/cc-columns-widgets.php';
6+
require TEMPLATEPATH . '/inc/widgets/cc-banner-link.php';
7+
require TEMPLATEPATH . '/inc/widgets/cc-notification.php';
8+
require TEMPLATEPATH . '/inc/widgets/cc-list-entries.php';
9+
require TEMPLATEPATH . '/inc/widgets/cc-newsletter-form.php';
10+
require TEMPLATEPATH . '/inc/widgets/cc-twitter-timeline.php';
11+
require TEMPLATEPATH . '/inc/widgets/cc-card.php';
12+
require TEMPLATEPATH . '/inc/widgets/cc-title.php';
13+
require TEMPLATEPATH . '/inc/widgets/cc-donate.php';

inc/widgets/cc-banner-link.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function widget( $args, $instance ) {
1616
$link_text = ( $instance['has_link'] ) ? $instance['link-text'] : '';
1717
$has_border = ( ! $instance['has_border'] ) ? false : true;
1818
$extra_class = ( ! empty( $spaces ) ) ? 'use-' . $spaces . '-cols' : '';
19-
echo Components::card_link( false, false, $color, esc_attr( $instance['title'] ), $content, $link_text, esc_url( $instance['url'] ), $instance['has_content'], $instance['has_border'], $instance['has_link'], $extra_class );
19+
echo Components::card_link( false, false, $color, esc_attr( $instance['title'] ), $content, $link_text, esc_url( $instance['url'] ), $instance['has_content'], $has_border, $instance['has_link'], $extra_class );
2020
}
2121

2222
function update( $new_instance, $old_instance ) {

page.php

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
11
<?php
22
get_header();
33
the_post();
4-
$post_format = get_post_format();
54
?>
65
<section class="main-content">
76
<header class="page-header">
87
<div class="container">
98
<div class="columns is-centered">
10-
<div class="column is-8">
11-
<?php get_template_part( 'inc/partials/post_formats/content', 'default' ); ?>
9+
<div class="column is-11">
10+
<?php get_template_part( 'inc/partials/entry/page', 'header' ); ?>
1211
</div>
1312
</div>
1413
</div>
1514
</header>
1615
<div class="container">
17-
<div class="columns is-centered">
16+
<div class="columns is-centered is-variable is-5">
17+
<div class="column is-3">
18+
<aside class="sidebar">
19+
<?php
20+
$parent = CC_Site::get_parent_page();
21+
echo '<nav class="side-navigation padding-vertical-big">';
22+
echo '<ul class="list-pages">';
23+
wp_list_pages(array(
24+
'child_of' => $parent,
25+
'show_date' => '',
26+
'depth' => 3,
27+
'title_li' => ''
28+
));
29+
echo '</ul>';
30+
echo '</nav>';
31+
32+
get_sidebar();
33+
?>
34+
</aside>
35+
</div>
1836
<div class="column is-8">
1937
<section class="entry-page-content">
2038
<div class="text-format">

sidebar.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php dynamic_sidebar( 'page' ); ?>

0 commit comments

Comments
 (0)