Skip to content

Commit

Permalink
Merge branch 'release/1.2.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
GregLeBarbar committed Sep 7, 2018
2 parents b3758e4 + 10448ff commit 7f3f2c7
Show file tree
Hide file tree
Showing 24 changed files with 334 additions and 143 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@

# CHANGELOG

*1.2.5* (2018-09-07)
- epfl-video: render HTML
- epfl-links-group: render HTML
- epfl-cover: render HTML
- epfl-toggle: render HTML
- epfl-memento: fix resolution image 448x448
- epfl-news: fix div tag badly closed PR#74
- Custom highlight handle image with caption, legend, alt etc..
- Name menu location, change default name from 'primary' to 'top' to match 2010 theme, prepare for footer

*1.2.4* (2018-08-30)
- remove top padding on homepage
- hotfix overflow hidden events
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.4
1.2.5
19 changes: 14 additions & 5 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
* @package epfl
*/

global $EPFL_MENU_LOCATION;
$EPFL_MENU_LOCATION = 'top';

global $EPFL_FOOTER_MENU_LOCATION;
$EPFL_FOOTER_MENU_LOCATION = 'footer_nav';

if ( ! function_exists( 'epfl_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
Expand Down Expand Up @@ -43,9 +49,12 @@ function epfl_setup() {
add_theme_support( 'post-thumbnails' );

// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'epfl' ),
) );
global $EPFL_MENU_LOCATION;
global $EPFL_FOOTER_MENU_LOCATION;
$nav_menus_args = [];
$nav_menus_args[$EPFL_MENU_LOCATION] = esc_html__( 'Primary', 'epfl' );
$nav_menus_args[$EPFL_FOOTER_MENU_LOCATION] = esc_html__( 'Footer', 'epfl' );
register_nav_menus($nav_menus_args);

/*
* Switch default core markup for search form, comment form, and comments
Expand Down Expand Up @@ -298,8 +307,8 @@ function get_archives_link_mod ( $link_html ) {
* @return string
*/
function get_current_menu_slug() {
$theme_location = 'primary';
global $EPFL_MENU_LOCATION;
$menu_locations = get_nav_menu_locations();
$menu_term = get_term($menu_locations[$theme_location], 'nav_menu');
$menu_term = get_term($menu_locations[$EPFL_MENU_LOCATION], 'nav_menu');
return $menu_term;
}
3 changes: 3 additions & 0 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
</a>

<?php
global $EPFL_MENU_LOCATION;
wp_nav_menu( array(
'theme_location' => $EPFL_MENU_LOCATION,
'menu_id' => $EPFL_MENU_LOCATION.'-menu',
'menu_class'=> 'nav-header d-none d-xl-flex',
'container' => 'ul',
'depth' => 1
Expand Down
25 changes: 0 additions & 25 deletions shortcodes/collapsable/controller.php

This file was deleted.

31 changes: 0 additions & 31 deletions shortcodes/collapsable/shortcake.php

This file was deleted.

41 changes: 0 additions & 41 deletions shortcodes/collapsable/view.php

This file was deleted.

38 changes: 22 additions & 16 deletions shortcodes/custom_highlight/view.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
<?php
<?php
$data = get_query_var('epfl_custom_highlight_data');

// manage layout
$classes = '';
if ($data['layout'] == 'bottom') $classes = 'fullwidth-teaser-horizontal';
if ($data['layout'] == 'left') $classes = 'fullwidth-teaser-left';

if ($data['layout'] == '') $classes = 'fullwidth-teaser-right';
?>

<div class="container-full">
<div class="fullwidth-teaser mt-5 <?php echo $classes; ?>">
<picture>
<?php echo wp_get_attachment_image(
$data['image'],
'thumbnail_16_9_large', // see functions.php
'',
[
'class' => 'img-fluid'
]
) ?>
<img src="<?php echo $data['image'] ?>" aria-labelledby="background-label" alt="An image description"
/>
</picture>

<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject" class="cover">
<!-- <picture> -->
<?php // get/slice image informations
$image_src = wp_get_attachment_image_src($data['image'], 'thumbnail_16_9_large')[0]; // see functions.php
$image_caption = wp_get_attachment_caption($data['image']);
$image_alt = get_post_meta($data['image'] , '_wp_attachment_image_alt', true);
?>
<img src="<?php echo $image_src ?>" alt="<?php echo $image_alt ?>" />
<!-- </picture> -->
<?php if ($image_caption): ?>
<figcaption>
<button aria-hidden="true" type="button" class="btn-circle" data-toggle="popover" data-content="<?php echo $image_caption ?>">
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-info"></use></svg>
<svg class="icon icon-rotate-90" aria-hidden="true"><use xlink:href="#icon-chevron-right"></use></svg>
</button>
<p class="sr-only"><?php echo $image_caption ?></p>
</figcaption>
<?php endif; ?>
</figure>
<div class="fullwidth-teaser-text">

<div class="fullwidth-teaser-header">
Expand All @@ -47,4 +53,4 @@
</div>
</div>
</div>
</div>
</div>
27 changes: 27 additions & 0 deletions shortcodes/epfl_card/controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/**
* 3rd argument is the priority, higher means executed first
* 4rth argument is number of arguments the function can accept
**/

add_action('epfl_card_action', 'renderCard', 10, 4);

function renderCard ($title, $text, $link, $image) {

if (is_admin()) {

// render placeholder for backend editor
set_query_var('epfl_placeholder_title', 'Card');
get_template_part('shortcodes/placeholder');

} else {

set_query_var('epfl_card_title', $title);
set_query_var('epfl_card_text', $text);
set_query_var('epfl_card_link', $link);
set_query_var('epfl_card_image', $image);
get_template_part('shortcodes/epfl_card/view');

}
}
18 changes: 18 additions & 0 deletions shortcodes/epfl_card/view.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
$title = get_query_var('epfl_card_title');
$text = get_query_var('epfl_card_text');
$link = get_query_var('epfl_card_link');
$image = get_query_var('epfl_card_image');
?>

<a href="<?php echo $link; ?>" class="card link-trapeze-horizontal">
<?php if ($image): ?>
<picture class="card-img-top">
<img src="<?php echo $image; ?>" class="img-fluid" title="<?php echo $title; ?>" alt="<?php echo $title; ?>" />
</picture>
<?php endif ?>
<div class="card-body">
<h3 class="card-title"><?php echo $title; ?></h3>
<p><?php echo $text; ?></p>
</div>
</a>
26 changes: 26 additions & 0 deletions shortcodes/epfl_cover/controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/**
* 3rd argument is the priority, higher means executed first
* 4rth argument is number of arguments the function can accept
**/

add_action('epfl_cover_action', 'renderCover', 10, 2);

function renderCover ($image, $description) {

if (is_admin()) {

// render placeholder for backend editor
set_query_var('epfl_placeholder_title', 'Cover');
get_template_part('shortcodes/placeholder');

} else {

// render for frontend
set_query_var('epfl_cover_image', $image);
set_query_var('epfl_cover_description', $description);
get_template_part('shortcodes/epfl_cover/view');

}
}
25 changes: 25 additions & 0 deletions shortcodes/epfl_cover/view.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
$description = get_query_var('epfl_cover_description');
$image = get_query_var('epfl_cover_image');
?>

<div class="container">
<figure class="cover">
<picture>
<img src="<?php echo $image; ?>" class="img-fluid" alt="<?php echo $description; ?>">
</picture>
<figcaption>
<button
aria-hidden="true"
type="button"
class="btn-circle"
data-toggle="popover"
data-content="<?php echo $description; ?>"
>
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-info"></use></svg>
<svg class="icon icon-rotate-90" aria-hidden="true"><use xlink:href="#icon-chevron-right"></use></svg>
</button>
<p class="sr-only"><?php echo $description; ?></p>
</figcaption>
</figure>
</div>
36 changes: 36 additions & 0 deletions shortcodes/epfl_links_group/controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* 3rd argument is the priority, higher means executed first
* 4rth argument is number of arguments the function can accept
**/

add_action('epfl_links_group_action', 'renderLinksGroup', 10, 1);

function renderLinksGroup ($args) {

if (is_admin()) {

// render placeholder for backend editor
set_query_var('epfl_placeholder_title', 'Links group');
get_template_part('shortcodes/placeholder');

} else {

set_query_var('epfl_links_group_main_url', $args['main_url']);
set_query_var('epfl_links_group_title', $args['title']);

unset($args['main_url']);
unset($args['title']);

$links = [];
foreach ($args as $key => $value) {
$field_key = substr($key, -1);
$field_name = substr($key, 0, -1);
$links[$field_key][$field_name] = $value;
}
set_query_var('epfl_links_group_links', $links);

get_template_part('shortcodes/epfl_links_group/view');
}
}
24 changes: 24 additions & 0 deletions shortcodes/epfl_links_group/view.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
$links = get_query_var('epfl_links_group_links');
$main_url = get_query_var('epfl_links_group_main_url');
$title = get_query_var('epfl_links_group_title');
$is_links_teaser = ("" !== $main_url);
?>
<div class="links-group <?php if ($is_links_teaser):?>links-group-teaser<?php endif; ?>">
<h5 id="links-group-title">
<?php if($is_links_teaser): ?>
<a class="link-pretty" href="<?php echo $main_url; ?>"><?php echo $title; ?></a>
<?php else: ?>
<?php echo $title; ?>
<?php endif; ?>
</h5>
<nav
class="nav flex-column flex-wrap align-items-start"
role="navigation"
aria-labelledby="links-group-title"
>
<?php foreach($links as $link): ?>
<a class="nav-link link-pretty" href="<?php echo $link['url']; ?>"><?php echo $link['label']; ?></a>
<?php endforeach ?>
</nav>
</div>
Loading

0 comments on commit 7f3f2c7

Please sign in to comment.