Skip to content

Commit

Permalink
Single articles, archives, forms
Browse files Browse the repository at this point in the history
  • Loading branch information
IntoJHyyry committed Mar 5, 2021
1 parent 7e726b1 commit eb0bba1
Show file tree
Hide file tree
Showing 34 changed files with 2,923 additions and 4,376 deletions.
43 changes: 43 additions & 0 deletions acf-json/group_6041e65d7bdf9.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"key": "group_6041e65d7bdf9",
"title": "Block \/ Article content",
"fields": [
{
"key": "field_60420703959d8",
"label": "Piilota kuvio",
"name": "hide_figure",
"type": "true_false",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"message": "",
"default_value": 0,
"ui": 0,
"ui_on_text": "",
"ui_off_text": ""
}
],
"location": [
[
{
"param": "block",
"operator": "==",
"value": "acf\/block-article-content"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"modified": 1614939938
}
46 changes: 46 additions & 0 deletions acf-json/group_6042206bbeb74.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"key": "group_6042206bbeb74",
"title": "Block \/ Form",
"fields": [
{
"key": "field_604220f544242",
"label": "Lomake",
"name": "gravity_forms",
"type": "select",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": [],
"default_value": false,
"allow_null": 0,
"multiple": 0,
"ui": 0,
"return_format": "value",
"ajax": 0,
"placeholder": ""
}
],
"location": [
[
{
"param": "block",
"operator": "==",
"value": "acf\/block-form"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"modified": 1614946567
}
73 changes: 13 additions & 60 deletions archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,70 +2,23 @@

<div id="primary" class="content-area">
<main id="main" class="site-main container" role="main">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
</header><!-- .page-header -->
<?php
if ( have_posts() ) : ?>
<header class="page-header">
<h1 class="page-title"><?php echo get_the_title(get_queried_object_id()); ?></h1>
</header>
<div class="row content-row">
<div class="col-12 col-lg-7 article-items">
<?php
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content', get_post_format() );
endwhile; ?>
</div>
<div class="col-12 offset-lg-2 col-lg-3 articles-sidebar">
<div class="sidebar-item sidebar-categories">
<div class="item-header categories-header">
<p class="item-title categories-title text-l"><?php _e('Kategoriat', 'ID'); ?></p>
</div>
<?php
$categories = get_categories();
if ($categories) : ?>
<ul>
<?php foreach ($categories as $cat) : ?>
<li><a href="<?php echo get_term_link($cat->term_id); ?>"><?php echo $cat->name; ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="col col-12 col-md-4">
<?php get_template_part('template-parts/partial', 'article-card', array(
'ID' => get_the_ID()
)); ?>
</div>
<div class="sidebar-item sidebar-tags">
<div class="item-header tags-header">
<p class="item-title tags-title text-l"><?php _e('Avainsanat', 'ID'); ?></p>
</div>
<?php
$tags = get_tags();
if ($tags) : ?>
<ul>
<?php foreach ($tags as $tag) : ?>
<li><a href="<?php echo get_term_link($tag->term_id); ?>"><?php echo $tag->name; ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>
</div>
<?php
// Previous/next page navigation.
the_posts_pagination( array(
'prev_text' => __( 'Edelliset', 'ID' ),
'next_text' => __( 'Seuraavat', 'ID' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Sivu', 'ID' ) . ' </span>',
));
// If no content, include the "No posts found" template.
else : ?>
<div class="row content-row">
<div class="col-12 col-lg-7 not-found-item">
<?php get_template_part( 'template-parts/content', 'none' ); ?>
</div>
<?php endwhile; ?>
</div>
<?php
endif;
?>
<?php endif; ?>
</main><!-- .site-main -->
</div><!-- .content-area -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>
<?php get_footer(); ?>
62 changes: 62 additions & 0 deletions components/block-article-content/acf-json/group_5ad09ed07f2e9.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"key": "group_5ad09ed07f2e9",
"title": "Elementti \/ Otsikko ja tekstialue",
"fields": [
{
"key": "field_5ad09f4c54a8e",
"label": "Otsikko",
"name": "title",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"prepend": "",
"append": "",
"maxlength": ""
},
{
"key": "field_5ad09ed0847dc",
"label": "Tekstialue",
"name": "content",
"type": "wysiwyg",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"tabs": "all",
"toolbar": "full",
"media_upload": 1,
"delay": 0
}
],
"location": [
[
{
"param": "block",
"operator": "==",
"value": "acf\/block-content"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "seamless",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": "",
"modified": 1596617127
}
50 changes: 50 additions & 0 deletions components/block-article-content/block-article-content.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* Component: Artikkelin sisältö
* Description: Artikkelin sisältö
* InnerBlocks: true
* InnerBlocksMode: preview
* Keywords:
* @version 1.0
*/

$allowed_blocks = array_merge(ID_allowed_inner_blocks(), array(
'acf/block-map'
));

$template = array(
array('core/heading', array(
'level' => 1,
)),
array('core/paragraph', array()),
);

$hide_figure = get_field('hide_figure');
?>
<div class="block-article-content article full-width id-block">
<div class="container-lg">
<div class="row">
<div class="col d-none d-lg-block col-lg-4 col-xxl-3">
<?php get_template_part('template-parts/partial' , 'sidebar-posts'); ?>
</div>
<div class="col col-12 col-lg-8 col-xxl-7 offset-xxl-1">
<p class="entry-date"><?php echo _x('Julkaistu', 'artikkeli', 'ID') . ' ' . get_the_date('j.n.Y', $post_id); ?></p>
<h1 class="entry-title"><?php echo get_the_title($post_id); ?></h1>
<div class="inner-blocks entry-content">
<InnerBlocks template="<?php echo esc_attr(wp_json_encode($template)); ?>" allowedBlocks="<?php echo esc_attr(wp_json_encode($allowed_blocks)); ?>" templateLock="false" />
</div>
</div>
</div>
</div>
<?php if(!$hide_figure): ?>
<div class="figures">
<svg class="figure mountain" xmlns="http://www.w3.org/2000/svg" width="107" height="45.956" viewBox="0 0 107 45.956">
<path d="M168.122 240.378l5.678-5.678-25.585-25.516-16.362 16.362-27.115-27.046L66.8 236.438l5.678 5.655 32.283-32.283 34.67 34.647 5.678-5.655-7.6-7.6 10.73-10.73z" transform="translate(-66.8 -198.5)"/>
</svg>

<svg class="figure tent" xmlns="http://www.w3.org/2000/svg" width="107" height="78.58" viewBox="0 0 107 78.58">
<path d="M217.722 215.089l10.643-13.474-10.227-8.115-8.756 11.059-8.757-11.059-10.225 8.115 10.681 13.474L155.9 272.08h16.645l36.837-46.5 36.875 46.5H262.9z" transform="translate(-155.9 -193.5)"/>
</svg>
</div>
<?php endif; ?>
</div>
Empty file.
56 changes: 56 additions & 0 deletions components/block-article-content/sass/_block-article-content.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.block-article-content {
position: relative;
overflow: hidden;
padding: 30px 0;

.entry-date {
margin-bottom: 5px;
text-transform: uppercase;
}

.entry-title {
margin-top: 0;
text-transform: uppercase;
font-weight: bold;
line-height: 1.2;
@include primary-color-text();
}

.figures {
display: flex;
justify-content: space-between;
margin-top: 70px;

@include media-breakpoint-up(md) {
margin-top: 80px;
}

.figure {
display: block;
height: auto;

path {
@include secondary-color-fill();
}
}

.mountain {
width: 424px;
margin-left: -80px;
margin-right: 25px;

@include media-breakpoint-up(md) {
margin-left: -20px;
}
}

.tent {
margin-right: -40px;
width: 232px;

@include media-breakpoint-up(md) {
margin-right: 60px;
}
}
}
}
Binary file added components/block-article-content/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit eb0bba1

Please sign in to comment.