$elementor->widgets_manager->register_widget_type( new Widgets\BackgroundImage() );
$elementor->widgets_manager->register_widget_type( new Widgets\TextBlock() );
$elementor->widgets_manager->register_widget_type( new Widgets\HeaderSlideshow() );
+ $elementor->widgets_manager->register_widget_type( new Widgets\NewsBanner() );
}
protected function _customise_sections() {
--- /dev/null
+<?php
+
+namespace Cube\Elementor\Widgets;
+
+use Elementor\Widget_Base;
+use Elementor\Controls_Manager;
+
+
+class NewsBanner extends Widget_Base {
+
+ protected $_has_template_content = false; // Tell Elementor that content is all rendered dynamically
+
+ // Widget name / ID
+ public function get_name() {
+ return 'cube-news-banner';
+ }
+
+ // Elementor widget title
+ public function get_title() {
+ return __( 'News Banner', 'cube' );
+ }
+
+ // Elementor interface icon
+ public function get_icon() {
+ return 'eicon-posts-ticker';
+ }
+
+ // Where to display the widget in the Elementor interface
+ public function get_categories() {
+ return [ 'theme-elements' ];
+ }
+
+ /**
+ * List of scripts the widget depends on.
+ * Used to set scripts dependencies required to run the widget.
+ *
+ * @since 1.0.0
+ * @access public
+ * @return array Widget scripts dependencies.
+ */
+ public function get_script_depends() {
+ return [];
+ }
+ /**
+ * Register the widget controls.
+ * Adds different input fields to allow the user to change and customize the widget settings.
+ *
+ * @since 1.0.0
+ * @access protected
+ */
+ protected function _register_controls() {
+
+ $this->start_controls_section(
+ 'section_content',
+ [
+ 'label' => __( 'Latest News Banner', 'cube' ),
+ ]
+ );
+
+ $this->add_control(
+ 'widget_description',
+ [
+ 'raw' => __( 'This widget will display the most recent news post. If no published news posts are available, nothing will be shown.', 'cube' ),
+ 'type' => Controls_Manager::RAW_HTML,
+ 'content_classes' => 'elementor-descriptor',
+ ]
+ );
+
+ $this->end_controls_section();
+ }
+ /**
+ * Render the widget output on the frontend.
+ * Written in PHP and used to generate the final HTML.
+ *
+ * @since 1.0.0
+ * @access protected
+ */
+ protected function render() {
+
+ $post = wp_get_recent_posts([
+ 'numberposts' => 1,
+ 'orderby' => 'post_date',
+ 'order' => 'DESC',
+ 'post_type' => 'post',
+ 'post_status' => 'publish',
+ 'suppress_filters' => true
+ ]);
+
+ if ($post && isset($post[0]['post_title'])) {
+
+ echo '<div class="bg-purple-dark text-white px-2v py-4 flex items-center justify-between">';
+ echo '<a href="'. get_permalink($post[0]['ID']) .'">'. $post[0]['post_title'] .'</a>';
+ echo '<a href="'. get_permalink(get_option('page_for_posts')) .'" class="btn ml-2">'. __("Voir toute l'actualité", 'cube') .'</a>';
+ echo '</div>';
+
+ }
+
+
+ }
+}
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support('post-thumbnails');
+ set_post_thumbnail_size(336, 336, true); // Square featured images cropped
/**
* Enable HTML5 markup support
},
{
"name": "log1x/sage-svg",
- "version": "v1.0.1",
+ "version": "v1.0.2",
"source": {
"type": "git",
"url": "https://github.com/Log1x/sage-svg.git",
- "reference": "c7b459191b416e64a31a9a782a962b9a6ef565c9"
+ "reference": "2b6722da8a393dbaa07b5aecbc2a916bf0752145"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Log1x/sage-svg/zipball/c7b459191b416e64a31a9a782a962b9a6ef565c9",
- "reference": "c7b459191b416e64a31a9a782a962b9a6ef565c9",
+ "url": "https://api.github.com/repos/Log1x/sage-svg/zipball/2b6722da8a393dbaa07b5aecbc2a916bf0752145",
+ "reference": "2b6722da8a393dbaa07b5aecbc2a916bf0752145",
"shasum": ""
},
"require": {
"php": ">=7.1.3"
},
+ "require-dev": {
+ "squizlabs/php_codesniffer": "^3.4"
+ },
"type": "package",
"extra": {
"acorn": {
"svg",
"wordpress"
],
- "time": "2019-07-20T20:37:25+00:00"
+ "time": "2019-09-25T10:12:58+00:00"
},
{
"name": "monolog/monolog",
},
{
"name": "nesbot/carbon",
- "version": "2.24.0",
+ "version": "2.25.1",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
- "reference": "934459c5ac0658bc765ad1e53512c7c77adcac29"
+ "reference": "d59c6cea9c4a3547bb6c0dfec451319abdaa4fb1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/934459c5ac0658bc765ad1e53512c7c77adcac29",
- "reference": "934459c5ac0658bc765ad1e53512c7c77adcac29",
+ "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d59c6cea9c4a3547bb6c0dfec451319abdaa4fb1",
+ "reference": "d59c6cea9c4a3547bb6c0dfec451319abdaa4fb1",
"shasum": ""
},
"require": {
"homepage": "http://github.com/kylekatarnls"
}
],
- "description": "A API extension for DateTime that supports 281 different languages.",
+ "description": "An API extension for DateTime that supports 281 different languages.",
"homepage": "http://carbon.nesbot.com",
"keywords": [
"date",
"datetime",
"time"
],
- "time": "2019-08-31T16:37:55+00:00"
+ "time": "2019-10-05T15:52:23+00:00"
},
{
"name": "psr/container",
"source": {
"type": "git",
"url": "https://github.com/roots/acorn.git",
- "reference": "ef9bd3d4f6beb874c996f9214c9a9f8626c8448d"
+ "reference": "d1f8b68151c9931f97fe0e2e1ceef6e5c17be9f4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/roots/acorn/zipball/ef9bd3d4f6beb874c996f9214c9a9f8626c8448d",
- "reference": "ef9bd3d4f6beb874c996f9214c9a9f8626c8448d",
+ "url": "https://api.github.com/repos/roots/acorn/zipball/d1f8b68151c9931f97fe0e2e1ceef6e5c17be9f4",
+ "reference": "d1f8b68151c9931f97fe0e2e1ceef6e5c17be9f4",
"shasum": ""
},
"require": {
"sage",
"wordpress"
],
- "time": "2019-09-21T06:19:33+00:00"
+ "time": "2019-10-01T11:24:39+00:00"
},
{
"name": "roots/support",
"packages-dev": [
{
"name": "squizlabs/php_codesniffer",
- "version": "3.4.2",
+ "version": "3.5.0",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
- "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8"
+ "reference": "0afebf16a2e7f1e434920fa976253576151effe9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8",
- "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8",
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/0afebf16a2e7f1e434920fa976253576151effe9",
+ "reference": "0afebf16a2e7f1e434920fa976253576151effe9",
"shasum": ""
},
"require": {
"phpcs",
"standards"
],
- "time": "2019-04-10T23:49:02+00:00"
+ "time": "2019-09-26T23:12:26+00:00"
}
],
"aliases": [],
--- /dev/null
+<?php
+
+use function Roots\base_path;
+
+return [
+
+ /*
+ |--------------------------------------------------------------------------
+ | Path
+ |--------------------------------------------------------------------------
+ |
+ | This value is the default path used by SageSVG for finding SVG files.
+ | This path is then resolved internally if an absolute path is not being
+ | used.
+ |
+ */
+
+ 'path' => base_path('dist/images'),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Class
+ |--------------------------------------------------------------------------
+ |
+ | Here you can specify a default class to be added on all inlined SVGs.
+ | Much like how you would define multiple classes in an HTML attribute,
+ | you may separate each class using a space.
+ |
+ */
+
+ 'class' => 'svg',
+];
"rupture": "^0.7.1",
"stylelint": "^10.1",
"stylelint-config-standard": "^18.2",
- "stylus": "github:acidjazz/stylus#dev",
+ "stylus": "^0.54.7",
"stylus-loader": "^3.0.2",
"tailwindcss": "^1.0",
"tailwindcss-wordpress": "^0.1",
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 32"><path d="M3.1 31c-.5 0-1.1-.2-1.5-.6-.8-.8-.8-2.1 0-2.9L13.8 16 1.6 4.4c-.8-.8-.8-2.1 0-2.9s2.2-.8 3 0l13.7 13c.5.5.7 1 .7 1.5s-.2 1-.6 1.4l-13.7 13c-.5.4-1 .6-1.6.6z" /></svg>
h1, .h1, h2, .h2
- @apply font-display font-medium mb-2 uppercase
line-height: 1.1
+ font-weight: 400
+
+ &:not(.plain)
+ @apply font-display font-medium mb-2 uppercase
h1, .h1
@apply text-3xl
// Pink dash
h1, .h1, h2, .h2, .decorated
- @apply relative
-
- +below($breakpoint-columns)
- margin-left: 0.9em
-
- &:before
- content: ''
- display: block
- position: absolute
- top: 0.55em
- constrain(left, -5vw)
- constrain(width, 2.5vw)
- height: 5px
- background: theme('colors.pink')
-
- +below(1150px)
- width: 0.9em
- left: -1.3em
- height: 4px
+ &:not(.plain)
+ @apply relative
+below($breakpoint-columns)
- height: 3px
+ margin-left: 0.9em
+
+ &:before
+ content: ''
+ display: block
+ position: absolute
+ top: 0.55em
+ constrain(left, -5vw)
+ constrain(width, 2.5vw)
+ height: 5px
+ background: theme('colors.pink')
+
+ +below(1150px)
+ width: 0.9em
+ left: -1.3em
+ height: 4px
+
+ +below($breakpoint-columns)
+ height: 3px
h3, .h3, h4, .h4
--- /dev/null
+.post
+
+ &-featured-image
+ @apply bg-gray-300 bg-cover bg-center
+ @apply w-full
+ constrain(margin-right, 5vw)
+ max-width: 336px
+
+ &-sizer
+ padding-bottom: 100%
@extends('layouts.app')
@section('content')
- @include('partials.page-header')
- @if (! have_posts())
- @alert(['type' => 'warning'])
- {{ __('Sorry, no results were found.', 'sage') }}
- @endalert
+ <div class="bg-light py-2v px-4v">
- {!! get_search_form(false) !!}
- @endif
+ <h1 class="h2">{!! get_the_title(get_option('page_for_posts', true)) !!}</h1>
- @while (have_posts()) @php(the_post())
- @includeFirst(['partials.content-'.get_post_type(), 'partials.content'])
- @endwhile
+ <div class="mt-1v">
- {!! get_the_posts_navigation() !!}
+ @if (! have_posts())
+ @alert(['type' => 'warning'])
+ {{ __('Sorry, no results were found.', 'sage') }}
+ @endalert
+
+ {!! get_search_form(false) !!}
+ @endif
+
+ @while (have_posts()) @php(the_post())
+ @includeFirst(['partials.content-'.get_post_type(), 'partials.content'])
+ @endwhile
+
+ {!! get_the_posts_navigation() !!}
+
+ </div>
+
+ </div>
@endsection
@section('sidebar')
-<article @php(post_class())>
+<article @php(post_class('flex items-start'))>
+
+ <div class="post-featured-image" style="background-image: url({{ get_the_post_thumbnail_url() }})">
+ <div class="post-featured-image-sizer">{{-- Just here as a proportional sizer thanks to the padding --}}</div>
+ </div>
+
<header>
- <h2 class="entry-title">
+ @include('partials/entry-meta')
+
+ <h2 class="plain my-4">
<a href="{{ get_permalink() }}">
{!! $title !!}
</a>
</h2>
- @include('partials/entry-meta')
+ <div class="entry-summary">
+ @php(the_excerpt())
+ </div>
+
+ <p class="mt-6">
+ <a class="uppercase text-pink inline-flex items-center" href="{{ get_permalink() }}">@svg('arrow', 'h-3 mr-2 fill-current') Lire la suite</a>
+ </p>
+
</header>
- <div class="entry-summary">
- @php(the_excerpt())
- </div>
</article>
{{ get_the_date() }}
</time>
+{{--
<p class="byline author vcard">
<span>{{ __('By', 'sage') }}</span>
<a href="{{ get_author_posts_url(get_the_author_meta('ID')) }}" rel="author" class="fn">
{{ get_the_author() }}
</a>
</p>
+--}}
'xl': '1.9091rem', // 42px
'2xl': '2.4545rem', // 54px
'3xl': '3.0909rem', // 68px
- }
+ },
+ padding: {
+ '100%': '100%', // Used for proportional padding to make a square
+ },
},
},
variants: {},
resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab"
integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=
-glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@~7.1.2:
+glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3:
version "7.1.4"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255"
integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==
dependencies:
ret "~0.1.10"
-"safer-buffer@>= 2.1.2 < 3":
+"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b"
integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==
+semver@^6.0.0:
+ version "6.3.0"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
+ integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
+
semver@^6.1.0, semver@^6.1.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.1.1.tgz#53f53da9b30b2103cd4f15eab3a18ecbcb210c9b"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
-source-map@~0.7.2:
+source-map@^0.7.3:
version "0.7.3"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==
lodash.clonedeep "^4.5.0"
when "~3.6.x"
-"stylus@github:acidjazz/stylus#dev":
- version "0.54.5"
- resolved "https://codeload.github.com/acidjazz/stylus/tar.gz/f6d39f350166e15db4b662f287d1cdbdf88103e1"
+stylus@^0.54.7:
+ version "0.54.7"
+ resolved "https://registry.yarnpkg.com/stylus/-/stylus-0.54.7.tgz#c6ce4793965ee538bcebe50f31537bfc04d88cd2"
+ integrity sha512-Yw3WMTzVwevT6ZTrLCYNHAFmanMxdylelL3hkWNgPMeTCpMwpV3nXjpOHuBXtFv7aiO2xRuQS6OoAdgkNcSNug==
dependencies:
css-parse "~2.0.0"
debug "~3.1.0"
- glob "~7.1.2"
+ glob "^7.1.3"
mkdirp "~0.5.x"
+ safer-buffer "^2.1.2"
sax "~1.2.4"
- source-map "~0.7.2"
+ semver "^6.0.0"
+ source-map "^0.7.3"
sugarss@^2.0.0:
version "2.0.0"