excerpt and catch first image support added

This commit is contained in:
jorge 2021-04-30 01:12:57 +02:00
parent 09b6f74c41
commit 89cbaafc41
19 changed files with 363 additions and 178 deletions

View File

@ -26,20 +26,20 @@
</aside>
<aside class="double newsletter">
<p> subscribe to our <br/>
<span class="h3"><a href="https://arc-hive.zone/newsletter/">news letter</a></span>
<span class="h4"><a href="https://arc-hive.zone/newsletter/">newsletter</a></span>
</p>
</aside>
<aside class="newsletter">
<p> follow us on <br/>
<span class="h3"><a href="https://www.facebook.com/arc.hive.platform/">facebook</a></span>
<span class="h3"><a href="https://www.instagram.com/arc.hive.zone/">instagram</a></span>
<span class="h4"><a href="https://www.facebook.com/arc.hive.platform/">facebook</a></span>
<span class="h4"><a href="https://www.instagram.com/arc.hive.zone/">instagram</a></span>
</p>
</aside>
</section>
<section class="subsection">
<aside class="contact">
<p><a href="mailto:info@arc-hive.zone">info@arc-hive.zone</a></p>
<p class="address">Emilia Coranty 16 <br /> 08018 Barcelona Spain</p>
<p class="h5"><a href="https://arc-hive.zone/contact/">CONTACT</a></p>
</aside>
<aside class="double partners">
<p>ARC-HIVE partners are:</p>
@ -47,7 +47,7 @@
<li class="h5"> <a href="#">Cultivamos Cultura</a></li>
<li class="h5"> <a href="#">Bioart Society</a></li>
<li class="h5"> <a href="#">Kersnikova</a></li>
<li class="h5"> <a href="#">Institute of natural sciences</a></li>
<li class="h5"> <a href="#">RBINS</a></li>
<li class="h5"> <a href="#">Kontejner</a></li>
<li class="h5"> <a href="#">Hangar</a></li>
</ul>

View File

@ -55,5 +55,11 @@ require_once( 'library/responsive-images.php' );
/** Gutenberg editor support */
require_once( 'library/gutenberg.php' );
/** Catch post first image */
require_once( 'library/catch-first-image.php' );
/** Reduce the excerpt length */
require_once( 'library/excerpt-mods.php' );
/** If your site requires protocol relative url's for theme assets, uncomment the line below */
// require_once( 'library/class-foundationpress-protocol-relative-theme-assets.php' );

View File

@ -43,6 +43,6 @@ get_header(); ?>
</main>
<?php get_announcement(); ?>
<?php //get_template_part( 'template-parts/announcement' ); ?>
<?php get_footer();

View File

@ -0,0 +1,26 @@
<?php
/**
* Start catch up first image in a post else get the custom logo
* ----------------------------------------------------------------------------
* @package arcHIVE
*/
if ( ! function_exists( 'catch_post_first_image' ) ) :
function catch_post_first_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(!empty($first_img)){
return $first_img;
}
if(empty($first_img)){ //Defines a default image
// https://developer.wordpress.org/reference/functions/the_custom_logo/
$custom_logo_image = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ) , 'full' );
$first_img = $custom_logo_image[0];
return $first_img;
}
}
endif;
?>

16
library/excerpt-mods.php Normal file
View File

@ -0,0 +1,16 @@
<?php
/**
* Filter the except length to 20 words.
*
* @param int $length Excerpt length.
* @return int (Maybe) modified excerpt length.
*/
if ( ! function_exists( 'foundationpress_custom_excerpt_length' ) ) :
function foundationpress_custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'foundationpress_custom_excerpt_length', 999 );
endif;

View File

@ -10,7 +10,7 @@
register_nav_menus(
array(
'top-bar-r' => esc_html__( 'Right Top Bar', 'foundationpress' ),
'mobile-nav' => esc_html__( 'Mobile', 'foundationpress' ),
// 'mobile-nav' => esc_html__( 'Mobile', 'foundationpress' ),
'home-hero-bar' => esc_html__( 'Home Hero bar', 'foundationpress' ),
)
);
@ -69,7 +69,7 @@ if ( ! function_exists( 'foundationpress_home_hero_bar' ) ) {
wp_nav_menu(
array(
'container' => false,
'menu_class' => 'menu button',
'menu_class' => 'menu button hollow',
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
'theme_location' => 'home-hero-bar',
'depth' => 3,

View File

@ -13,6 +13,4 @@ get_header(); ?>
<?php get_template_part( 'template-parts/section', 'news' ); ?>
</main>
</article>
<?php get_footer();

View File

@ -72,7 +72,7 @@
// 1. Global
// ---------
$global-font-size:1.5rem;
$global-font-size:100%;
$global-width: 100vw;
$global-lineheight: 1.5;

View File

@ -20,9 +20,9 @@
@include foundation-button-group;
@include foundation-close-button;
@include foundation-label;
@include foundation-progress-bar;
@include foundation-slider;
@include foundation-switch;
//@include foundation-progress-bar;
//@include foundation-slider;
//@include foundation-switch;
@include foundation-table;
// Basic components
@include foundation-badge;
@ -36,7 +36,7 @@
// Containers
@include foundation-accordion;
@include foundation-media-object;
@include foundation-orbit;
//@include foundation-orbit;
@include foundation-responsive-embed;
@include foundation-tabs;
@include foundation-thumbnail;
@ -67,21 +67,31 @@
// arcHIVE styles
// global project styles
@import "global/colors";
@import "global/wp-overrides"; //errors
@import "global/wp-admin"; //errors
@import "global/typography";
@import "global/gutenberg";
@import "global/colors";
@import "global/branding";
@import "global/accessibility";
// Modules
@import "modules/navigation";
@import "modules/header";
@import "modules/content";
@import "modules/footer";
//@import "modules/editor-syle";
@import "modules/content";
// Componentes
@import "components/links";
@import "components/featured-image";
@import "components/dividers";
@import "components/cards";
@import "components/buttons";
@import "components/accordion";
// Templates
//@import "templates/front";

View File

@ -10,4 +10,3 @@ $mid-grey: #808080;
$antracite-grey: #333333;
$forest-green: #1E6041;
$raspberry-purple: #54367B;

View File

@ -26,16 +26,19 @@
// not in foundation variables
// -----------------------------
h1,h2,h3,h4,h5,h6,
.h1,.h2,.h3,.h4,.h4,.h5,.h6,
button,.button,
header nav,
.hero .claim
{
font-variant:all-small-caps;
a {
color: #000;
}
}
//h1,h2,h3,h4,h5,h6,
//.h1,.h2,.h3,.h4,.h4,.h5,.h6,
//button,.button,
//header nav,
//.hero .claim
//{
// font-variant:all-small-caps;
//}
//
//
//h1,h2,h3,h4,h5,h6,
//.h1,.h2,.h3,.h4,.h4,.h5,.h6 {
// a {
// color: $black;
// }
//}

View File

@ -15,7 +15,7 @@ body.admin-bar {
&.offcanvas {
.off-canvas.is-open {
top: rem-calc(46);
@include breakpoint(783) {
@include breakpoint(small) {
top: rem-calc(32);
}
}

View File

@ -1,57 +1,57 @@
.wp-caption > figcaption {
max-width: 100%;
font-size: 0.8rem;
color: #999;
padding: 0.25rem 0;
}
p.wp-caption-text{
font-size:90%;
color: #666;
padding:rem-calc(10) 0;
}
.alignleft {
float: left;
padding-right: 1rem;
margin: 0;
}
.alignright {
float: right;
padding-left: 1rem;
margin: 0;
}
.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
}
.gallery {
@include xy-grid;
@include xy-gutters($negative: true);
@for $i from 1 through 9 {
&.gallery-columns-#{$i} {
@include xy-grid-layout(2, '.gallery-item', true);
}
@include breakpoint(medium){
&.gallery-columns-#{$i} {
@include xy-grid-layout(4, '.gallery-item', true, (small: 30px));
}
}
@include breakpoint(large) {
&.gallery-columns-#{$i} {
@include xy-grid-layout($i, '.gallery-item', true, (small: 30px));
}
}
}
.gallery-icon > a {
@include thumbnail;
@include thumbnail-link;
}
.gallery-icon > img {
@include thumbnail;
}
}
//.wp-caption > figcaption {
// max-width: 100%;
// font-size: 0.8rem;
// color: #999;
// padding: 0.25rem 0;
//}
//
//p.wp-caption-text{
// font-size:90%;
// color: #666;
// padding:rem-calc(10) 0;
//}
//
//.alignleft {
// float: left;
// padding-right: 1rem;
// margin: 0;
//}
//
//.alignright {
// float: right;
// padding-left: 1rem;
// margin: 0;
//}
//
//.aligncenter {
// display: block;
// margin-left: auto;
// margin-right: auto;
//}
//
//.gallery {
// @include xy-grid;
// @include xy-gutters($negative: true);
// @for $i from 1 through 9 {
// &.gallery-columns-#{$i} {
// @include xy-grid-layout(2, '.gallery-item', true);
// }
// @include breakpoint(medium){
// &.gallery-columns-#{$i} {
// @include xy-grid-layout(4, '.gallery-item', true, (small: 30px));
// }
// }
// @include breakpoint(large) {
// &.gallery-columns-#{$i} {
// @include xy-grid-layout($i, '.gallery-item', true, (small: 30px));
// }
// }
// }
// .gallery-icon > a {
// @include thumbnail;
// @include thumbnail-link;
// }
// .gallery-icon > img {
// @include thumbnail;
// }
//}

View File

@ -1,29 +1,84 @@
content {
//content {
// general styles
//----------------
//
// mods on fonts and typography
// not in foundation variables
// -----------------------------
h1,h2,h3,h4,h5,h6,
.h1,.h2,.h3,.h4,.h4,.h5,.h6,
button,.button,
header nav,
.hero .claim
{
font-variant:all-small-caps;
}
h1,h2,h3,h4,h5,h6,
.h1,.h2,.h3,.h4,.h4,.h5,.h6 {
a {
color: $body-font-color;
}
}
//
// main block
//--------------
main {
article {
@include xy-grid;
header {
@include xy-cell(12);
.entry-title {
width: 100%;
text-align: center;
}
}
.entry-content {
padding: $global-padding*3;
@include breakpoint(small){
@include xy-cell(12);
padding: $global-padding*2 ;
margin:0 auto;
}
@include breakpoint(medium){
@include xy-cell(12);
padding: $global-padding*2 $global-padding*3;
max-width: 50rem;
margin:0 auto;
}
@include breakpoint(xlarge){
@include xy-cell(12);
max-width: 50rem;
padding: $global-padding*2 $global-padding*3;
font-size: $global-font-size*1.2;
margin: 0 auto;
}
}
}
}
//
// news category
//--------------
.news {
.news,.news-category {
@include xy-grid;
header,main,aside {
@include breakpoint(small){
padding-top: 0;
@include xy-cell(12);
@include flex;
@include flex-align(center,top);
padding: $global-padding*3 0;
}
@include breakpoint(small){
padding-top: $global-padding*3;
}
}
main {
//@include xy-cell(12);
@ -40,9 +95,40 @@
@include breakpoint(large){
@include xy-cell(4);
}
figure {
@include breakpoint(small){
@include xy-cell(12);
height: 58vw;
max-width: 100%;
overflow: hidden;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
@include breakpoint(medium){
height: 28vw;
}
@include breakpoint(large){
height: 20vw;
}
}
.entry-title {
padding-top: 4rem;
line-height: 0.7;
font-size: 1.5rem;
}
}
}
aside {
@include breakpoint(small){
padding-top:0;
padding-bottom: $global-padding*3;
}
@include breakpoint(medium){
padding-top:$global-padding*3;
padding-bottom: 0;
}
}
}
// end news category
@ -89,40 +175,35 @@
// for big announcemnts
//---------------------
$hero-padding: $global-padding * 3;
.hero {
border-top: 2px solid $primary-color;
background-color: $primary-color;
.slide {
.slides {
@include xy-grid();
.claim, figure {
@include breakpoint(small){
@include xy-cell(full);
}
@include breakpoint(medium){
@include xy-cell(auto);
@include xy-cell-gutters(0,margin);
@include flex;
@include flex-align(center,middle);
}
padding: $hero-padding;
}
.claim{
color: $white;
.slide {
@include xy-grid;
@include breakpoint(medium) {
font-size: $lead-font-size;
@include breakpoint(small){
@include xy-cell(100%);
@include xy-cell-gutters(0,margin);
width: 100%;
padding: $global-padding*2;
}
@include breakpoint(medium){
@include xy-cell(50%);
@include xy-cell-gutters(0,margin);
font-size: $lead-font-size;
padding: $global-padding * 3;
}
&:first-child {
background-color: $primary-color;
}
color: $white;
> * {
@include xy-cell(full);
@include flex;
@include flex-align(center,bottom);
@include flex-align(center,middle);
}
}
figure {
background-color: $white;
.logo {
@include breakpoint(medium){
max-width: 80%;
@ -138,6 +219,12 @@ $hero-padding: $global-padding * 3;
@include flex;
@include flex-align(spaced,middle);
min-height: 8rem;
a {
color: $body-font-color;
}
.button {
justify-content:center;
}
}
}
//hero secondary
@ -156,5 +243,5 @@ $hero-padding: $global-padding * 3;
}
//end hero
}
//}
// end content

View File

@ -1,4 +1,3 @@
@include breakpoint(small) {
footer {
background-color: $secondary-color;
a {
@ -22,17 +21,39 @@
.logo {
}
.subsection {
@include breakpoint(small) {
@include xy-grid;
@include flex;
@include flex-align(left,bottom);
border-top: 1px solid black;
padding: $global-padding 0;
font-size: $global-font-size * 0.8;
&:first-child {
padding-top: $global-padding*3;
}
.co-founded {
text-align:right;
}
}
@include breakpoint(medium) {
font-size: $global-font-size;
}
aside {
@include breakpoint(small) {
@include xy-cell(12);
}
@include breakpoint(medium) {
@include xy-cell(3);
}
&.double {
@include breakpoint(small) {
@include xy-cell(12);
}
@include breakpoint(medium) {
@include xy-cell(6);
}
}
}
}
}

View File

@ -1,23 +1,48 @@
header {
@include xy-grid();
@include xy-gutters(0);
main {
@include xy-cell(shrink);
@include flex-align(left, middle);
@include breakpoint(small){
@include xy-cell(12);
@include flex-align(center, middle);
padding: $global-padding*2;
min-width: 14rem;
text-align: center;
}
@include breakpoint(medium){
@include xy-cell(shrink);
@include flex-align(left, middle);
text-align: unset;
}
}
nav {
@include xy-cell(auto);
@include breakpoint(small){
@include xy-cell(12);
@include flex;
@include flex-align(right, middle);
@include flex-align(center, middle);
a, button {
color: $black;
&:hover {
color: $anchor-color;
}
}
menu {
margin: 0;
padding: 0;
font-size: 0.9rem;
}
}
@include breakpoint(small){
@include breakpoint(medium){
@include xy-cell(auto);
@include flex;
@include flex-align(right, middle);
menu {
margin: inherit;
padding: inherit;
font-size: $global-font-size;
}
}
}
}

View File

@ -7,51 +7,45 @@
*/
?>
<section class="news">
<header>
<h2> News</h2>
</header>
<main class="">
<?php $the_query = new WP_Query( array( 'category_name' => 'news', 'posts_per_page' => 6 ) ); ?>
<?php if ( $the_query->have_posts() ) : ?>
<?php// the loop ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php //content here ?>
<article class="">
<figure>
<img src="assets/imgexample/img0001.jpg" />
<?php if ( has_post_thumbnail() ) :?>
<figure style="background-image: url(<?php echo get_the_post_thumbnail_url();?>);">
<!--img src="<?php //echo get_the_post_thumbnail_url();?>" /-->
</figure>
<aside class="date">12.03.2021</aside>
<h3> FACTT 20|21 - Improbable Times </h3>
<p class="excerpt">
ARC-HIVE is a curatorial space that gathers artworks that work int eh continuum of biomateriality
</p>
</article>
<article class="">
<figure>
<img src="assets/imgexample/img0002.jpg" />
<?php else :?>
<figure style="background-image: url(<?php echo catch_post_first_image();?>);">
<!--img src="<?php //echo catch_post_first_image();?>" /-->
</figure>
<aside class="date">12.03.2021</aside>
<h3> Conservtion and digitzation Workshop </h3>
<p class="excerpt">
They can be manipulation, modification or (re)creation of life and living processes.
</p>
</article>
<article class="">
<figure>
<img src="assets/imgexample/img0003.jpg" />
</figure>
<aside class="date">12.03.2021</aside>
<h3>Summer School 2021 | Elements of Care </h3>
<p class="excerpt">
This ARCHIVE is a curatorial space that gathers artworks that work in the continuum of biomateriality, from DNA, proteins.
</p>
</article>
<article class="">
<figure>
<img src="assets/imgexample/img0004.jpg" />
</figure>
<aside class="date">12.03.2021</aside>
<h3>ARC-HIVE Kick-off Meeting</h3>
<p class="excerpt">
This ARCHIVE is a curatorial space that gathers artworks that work in the continuum of biomateriality, from DNA, proteins.
</p>
<?php endif;?>
<h3 class="entry-title">
<a href="<?php the_permalink(); ?>" rel="bookmark">
<?php the_title(); ?>
</a>
</h3>
<p class="excerpt post-excerpt">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"></a>
<?php the_excerpt() //echo wp_strip_all_tags( get_the_excerpt(), true ); ?>
</div>
</article>
<?php endwhile; ?>
<?php // end of the loop ?>
<?php //pagination here ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
</main>
<aside>
<nav>