add agenda page template, archive view and styles

This commit is contained in:
Jorge vitrubio.net 2024-04-03 03:21:48 +02:00
parent fa52f880d6
commit ca2cb8419b
19 changed files with 493 additions and 226 deletions

View File

@ -740,6 +740,11 @@ Add your custom styles in this file so it is easier to update the theme.
font-size: 1.1rem;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .archive .page-header,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category .page-header {
text-transform: capitalize;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .home-featured h2,
.edit-post-visual-editor__content-area .editor-styles-wrapper .home-featured .h2 {
margin: 1.2rem 0;
@ -1662,6 +1667,10 @@ Add your custom styles in this file so it is easier to update the theme.
width: 100%;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .page-template-agenda-archive .site-main > article {
padding-bottom: 1rem;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .site-main {
padding: 0;
}
@ -1729,6 +1738,7 @@ Add your custom styles in this file so it is easier to update the theme.
.edit-post-visual-editor__content-area .editor-styles-wrapper .archive-posts {
grid-template-columns: repeat(2, 1fr);
min-height: 40vh;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .post-type-archive-xarxaprod-associat .archive-posts {
@ -1839,6 +1849,28 @@ Add your custom styles in this file so it is easier to update the theme.
width: 100%;
background-color: #000;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .menu-menu-agenda-container .menu-item-has-children {
padding-right: 0;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .menu-menu-agenda-container > ul {
border-bottom: 0.05rem solid #000;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .menu-menu-agenda-container li > ul {
margin-left: 0;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .menu-menu-agenda-container li > a {
display: block;
padding: 0.5rem 0;
border-top: 0.05rem solid #000;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .menu-menu-agenda-container .current-menu-item > a {
font-weight: 900;
}
}
@media screen and (min-width: 48em) {
@ -2094,7 +2126,8 @@ Add your custom styles in this file so it is easier to update the theme.
* * * * * * * * * * * * * * * */
/* used in
* ./template-parts/section-agenda.php
* template-parts/section-last-agenda.php
* template-parts/section-each-agenda-entry.php
* */
/* filters form custom fields
@ -2119,10 +2152,6 @@ Add your custom styles in this file so it is easier to update the theme.
margin: 1.5em 0 0;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .site-main .entry-title {
margin: 0.5em 0 0 0;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .page-links {
clear: both;
margin: 0 0 1.5em;
@ -2333,7 +2362,7 @@ Add your custom styles in this file so it is easier to update the theme.
padding: 0;
color: inherit;
border: none;
background-color: none;
background-color: transparent;
font-size: inherit;
}
@ -2457,10 +2486,7 @@ Add your custom styles in this file so it is easier to update the theme.
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-cards,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-convocatories,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-activitats,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-agenda,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-agenda-es {
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-convocatories {
display: flex;
flex-flow: column;
justify-content: flex-end;
@ -2468,10 +2494,7 @@ Add your custom styles in this file so it is easier to update the theme.
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-cards .wp-block-post-title,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-convocatories .wp-block-post-title,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-activitats .wp-block-post-title,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-agenda .wp-block-post-title,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-agenda-es .wp-block-post-title {
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-convocatories .wp-block-post-title {
text-transform: lowercase;
font-size: 1.5rem;
margin-bottom: 0.5em;
@ -2482,13 +2505,7 @@ Add your custom styles in this file so it is easier to update the theme.
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-cards .post-excerpt,
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-cards .wp-block-post-excerpt,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-convocatories .post-excerpt,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-convocatories .wp-block-post-excerpt,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-activitats .post-excerpt,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-activitats .wp-block-post-excerpt,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-agenda .post-excerpt,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-agenda .wp-block-post-excerpt,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-agenda-es .post-excerpt,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-agenda-es .wp-block-post-excerpt {
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-convocatories .wp-block-post-excerpt {
min-height: 7rem;
margin: 0.5em 0;
font-size: 1rem;
@ -2496,10 +2513,7 @@ Add your custom styles in this file so it is easier to update the theme.
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-cards .wp-block-read-more,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-convocatories .wp-block-read-more,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-activitats .wp-block-read-more,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-agenda .wp-block-read-more,
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-agenda-es .wp-block-read-more {
.edit-post-visual-editor__content-area .editor-styles-wrapper .category-convocatories .wp-block-read-more {
margin: 1em 0;
}
@ -2526,7 +2540,57 @@ Add your custom styles in this file so it is easier to update the theme.
padding: 0.5rem 0;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-card-each.category-activitats,
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-card-each.category-activitats {
justify-content: flex-start;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-card-each.category-activitats .entry-title {
min-height: 5.5rem;
overflow: hidden;
border: none;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-card-each.category-activitats figure {
order: -1;
margin: 0 0 1rem 0;
width: 100%;
aspect-ratio: 16/9;
overflow: hidden;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-card-each.category-activitats figure img {
object-position: 50% 50%;
max-height: 100%;
object-fit: cover;
width: 100%;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-card-each.category-activitats .xarxaprod-agenda-info {
margin-bottom: 0;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-card-each.category-activitats li {
display: inline-flex;
width: 100%;
max-height: 2.9rem;
overflow: hidden;
font-weight: 100;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-card-each.category-activitats dt {
padding-right: 0.5rem;
text-transform: uppercase;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-card-each.category-activitats dd {
font-weight: 100;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-card-each.category-activitats .post-excerpt {
margin: 0;
min-height: 5rem;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper li.category-activitats,
.edit-post-visual-editor__content-area .editor-styles-wrapper li[class*="category-agenda"] {
position: relative;
@ -2534,7 +2598,6 @@ Add your custom styles in this file so it is easier to update the theme.
align-content: space-between;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-card-each.category-activitats .wp-block-post-featured-image,
.edit-post-visual-editor__content-area .editor-styles-wrapper li.category-activitats .wp-block-post-featured-image,
.edit-post-visual-editor__content-area .editor-styles-wrapper li[class*="category-agenda"] .wp-block-post-featured-image {
position: absolute;
@ -2544,7 +2607,6 @@ Add your custom styles in this file so it is easier to update the theme.
overflow: hidden;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-card-each.category-activitats .wp-block-post-featured-image img,
.edit-post-visual-editor__content-area .editor-styles-wrapper li.category-activitats .wp-block-post-featured-image img,
.edit-post-visual-editor__content-area .editor-styles-wrapper li[class*="category-agenda"] .wp-block-post-featured-image img {
object-position: 50% 50%;
@ -2552,13 +2614,11 @@ Add your custom styles in this file so it is easier to update the theme.
object-fit: cover;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-card-each.category-activitats .wp-block-post-title,
.edit-post-visual-editor__content-area .editor-styles-wrapper li.category-activitats .wp-block-post-title,
.edit-post-visual-editor__content-area .editor-styles-wrapper li[class*="category-agenda"] .wp-block-post-title {
height: 100%;
}
.edit-post-visual-editor__content-area .editor-styles-wrapper .xarxaprod-card-each.category-activitats .wp-block-post-title::before,
.edit-post-visual-editor__content-area .editor-styles-wrapper li.category-activitats .wp-block-post-title::before,
.edit-post-visual-editor__content-area .editor-styles-wrapper li[class*="category-agenda"] .wp-block-post-title::before {
content: "";

File diff suppressed because one or more lines are too long

View File

@ -21,8 +21,18 @@ get_header();
<?php xarxaprod_display_faqs_labels();//display all faq subcategories as labels ?>
<?php xarxaprod_display_faqs_search(); ?>
<?php endif; //end if is_category faq ?>
<?php if ( in_category( array( 'agenda', 'agenda-es','activitats') ) ) : ?>
<?php wp_nav_menu(
array(
'theme_location' => 'menu-3',
'menu_id' => 'agenda-menu',
)
); ?>
<?php endif; //end in_category agenda activitats ?>
</aside>
<?php if ( have_posts() ) : ?>
<content class="archive-posts <?php xarxaprod_class_posttype(); ?>">
@ -36,7 +46,9 @@ get_header();
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Type name) and that will be used instead.
*/
get_template_part( 'template-parts/content', get_post_type() );
//get_template_part( 'template-parts/content', get_post_type() );
get_template_part( 'template-parts/section', 'each-agenda-entry' );
endwhile;

File diff suppressed because one or more lines are too long

View File

@ -51,6 +51,7 @@ function xarxaprod_setup() {
array(
'menu-1' => esc_html__( 'Primary', 'xarxaprod' ),
'menu-2' => esc_html__( 'Secondary', 'xarxaprod' ),
'menu-3' => esc_html__( 'Agenda', 'xarxaprod' ),
)
);
@ -174,3 +175,8 @@ require get_template_directory() . '/inc/archive-title.php';
* Functions to add admin styles
*/
require get_template_directory() . '/inc/admin-style.php';
/**
* Function to get the first post image, used when there is no featured image
*/
require get_template_directory() . '/inc/catch-first-image.php';

27
inc/catch-first-image.php Normal file
View File

@ -0,0 +1,27 @@
<?php
/**
* Start catch up first image in a post else get the custom logo
* ----------------------------------------------------------------------------
* @package Xarxaprod_theme
* @used by template-parts/section-each-agenda-entry.php
*/
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;
?>

View File

@ -4,8 +4,8 @@
*
* Docs: https://wordpress.org/documentation/article/roles-and-capabilities/
*
* @package EGV-Guies
* @since EGV-Guies 1.0.0
* @package Xarxaprod_theme
* @since Xarxaprod_theme 1.0.0
*/
// https://wordpress.stackexchange.com/questions/4191/allow-editors-to-edit-menus
// add editor the privilege to edit theme

View File

@ -0,0 +1,90 @@
<?php
/**
* The template for displaying the "agenda" activities with search capabilities
*
* Template Name: Pagina Agenda
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
* @link https://developer.wordpress.org/themes/template-files-section/page-template-files/
*
* @package Xarxaprod_theme
* @since 1.0
*/
get_header();
?>
<!-- page-templates convos-search-php -->
<main id="primary" class="site-main">
<?php if ( have_posts() ) : ?>
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content', 'page' );
endwhile;
the_posts_navigation();
else :
//get_template_part( 'template-parts/content', 'none' );
endif;
?>
<section id="filteredagenda" class="xarxaprod-filtered-content xarxaprod-filtered-agenda xarxaprod-activitats-filtrats category-agenda xarxaprod-activitats">
<aside id="agendafilter" class="xarxaprod-filter-agenda xarxaprod-fitre-agenda">
<?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); if ( is_plugin_active( 'xarxaprod-wp-plugin/xarxaprod-wp-plugin.php' ) ) { // if plugin active do?>
<?php } //end if is_plugin_active ?>
<?php wp_nav_menu(
array(
'theme_location' => 'menu-3',
'menu_id' => 'agenda-menu',
)
); ?>
</aside>
<?php
$the_query_archive_agenda = new WP_Query(
array(
'post_type' => 'post',
'posts_per_page' => '10', //show all => -1
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => 'activitats'
)
)
//'order_by' => 'meta_value', //order by meta value
//'meta_key' => 'xxp_convo_apply_end', // order by meta key convo apply end
//'order' => 'ASC', //order ascendent
//'meta_query' => array(
// array( //filter results show only older than today
// 'key' => 'xxp_convo_apply_end',
// 'value' => date("Y-m-d"), // consider using date_i18n() https://developer.wordpress.org/reference/functions/date_i18n/
// 'compare' => '<', //show events before today
// 'type' => 'DATE',
// )
//)
)
);
?>
<?php if ( $the_query_archive_agenda->have_posts() ) : ?>
<content class="archive-posts <?php //xarxaprod_class_posttype(); ?>">
<?php while ( $the_query_archive_agenda->have_posts() ) : $the_query_archive_agenda->the_post(); ?>
<?php get_template_part( 'template-parts/section', 'each-agenda-entry' ); ?>
<?php endwhile;//end of the loop ?>
<?php wp_reset_postdata(); ?>
</content>
<?php endif; //end query convo ?>
</section>
</main><!-- #main -->
<?php
get_footer();

View File

@ -31,7 +31,7 @@ get_header();
if ( is_front_page() ) :
//get_template_part( 'template-parts/section', 'featured' );
get_template_part( 'template-parts/section', 'last-convos' );
get_template_part( 'template-parts/section', 'agenda' );
get_template_part( 'template-parts/section', 'last-agenda' );
endif;
?>

View File

@ -95,6 +95,12 @@
// margin: 0;
// }
//}
.archive,.category {
.page-header {
text-transform: capitalize;
}
}
.home-featured {
h2,.h2 {
margin: 1.2rem 0;

View File

@ -20,7 +20,7 @@
}
.site-main {
.entry-title {
margin: 0.5em 0 0 0;
//margin: 0.5em 0 0 0;
}
}
.page-links {
@ -207,11 +207,9 @@
display:grid;
grid-template-columns: 0.75fr 2.25fr;
padding: 0.2em 0;
//border-top: 0.05em solid $color__black;
border-top: $border__line;
font-size: $font__size-body*1;
&:last-of-type{
//border-bottom: 0.05em solid $color__black;
border-bottom: $border__line;
}
.xarxaprod-label li {
@ -220,7 +218,7 @@
padding: 0;
color: inherit;
border: none;
background-color: none;
background-color: transparent;
font-size: inherit;
&:nth-child(n+2):before {
content:", ";
@ -349,8 +347,8 @@
* agenda, activitats, agenda-es
*
* * * * * * * * * * * * * * * */
.xarxaprod-cards,.category-convocatories,
.category-activitats,.category-agenda,.category-agenda-es {
.xarxaprod-cards,.category-convocatories {
//.category-activitats,.category-agenda,.category-agenda-es {
display: flex;
flex-flow: column;
justify-content: flex-end;
@ -375,7 +373,8 @@
}
/* used in
* ./template-parts/section-agenda.php
* template-parts/section-last-agenda.php
* template-parts/section-each-agenda-entry.php
* */
.xarxaprod-agenda {
.xarxaprod-card-each {
@ -405,7 +404,51 @@
}
}
}
.xarxaprod-card-each.category-activitats,
.xarxaprod-card-each{
&.category-activitats {
justify-content: flex-start;
.entry-title {
min-height: $font__size-body * 5.5;
overflow: hidden;
border: none;
}
figure {
// position: absolute;
order: -1;
margin: 0 0 1rem 0;
width: 100%;
aspect-ratio: 16/9;
overflow: hidden;
img {
object-position: 50% 50%;
max-height: 100%;
object-fit: cover;
width: 100%;
}
}
.xarxaprod-agenda-info {
margin-bottom: 0;
}
li {
display: inline-flex;
width: 100%;
max-height: 2.9rem;
overflow: hidden;
font-weight: 100;
}
dt {
padding-right: 0.5rem;
text-transform: uppercase;
}
dd {
font-weight: 100;
}
.post-excerpt {
margin: 0;
min-height: 5rem;
}
}
}
li.category-activitats,
li[class*='category-agenda'] {
position: relative;

View File

@ -70,6 +70,32 @@
}
.menu-item-has-children {
}
.menu-menu-agenda-container {
.menu-item-has-children {
padding-right: 0;
}
> ul{
border-bottom: $border__line;
}
li {
> ul {
margin-left: 0;
}
> a {
display: block;
padding: 0.5rem 0;
border-top: $border__line;
&:last-of-type {
}
}
}
.current-menu-item {
> a {
font-weight: 900;
}
}
}
/* begin of menu-hidden */
//.toggle-secondary-navigation .show-mobile{

View File

@ -194,6 +194,13 @@
width: 100%;
}
}
.page-template-agenda-archive {
.site-main {
> article {
padding-bottom: 1rem;
}
}
}
.site-main {
padding: 0;
> article {
@ -256,6 +263,7 @@
}
.archive-posts {
grid-template-columns: repeat(2 , 1fr);
min-height: 40vh;
}
.post-type-archive-xarxaprod-associat {
.archive-posts {

120
style.css
View File

@ -590,6 +590,11 @@ textarea {
font-size: 1.1rem;
}
.archive .page-header,
.category .page-header {
text-transform: capitalize;
}
.home-featured h2,
.home-featured .h2 {
margin: 1.2rem 0;
@ -1526,6 +1531,10 @@ textarea {
width: 100%;
}
.page-template-agenda-archive .site-main > article {
padding-bottom: 1rem;
}
.site-main {
padding: 0;
}
@ -1593,6 +1602,7 @@ textarea {
.archive-posts {
grid-template-columns: repeat(2, 1fr);
min-height: 40vh;
}
.post-type-archive-xarxaprod-associat .archive-posts {
@ -1703,6 +1713,28 @@ textarea {
background-color: #000;
}
.menu-menu-agenda-container .menu-item-has-children {
padding-right: 0;
}
.menu-menu-agenda-container > ul {
border-bottom: 0.05rem solid #000;
}
.menu-menu-agenda-container li > ul {
margin-left: 0;
}
.menu-menu-agenda-container li > a {
display: block;
padding: 0.5rem 0;
border-top: 0.05rem solid #000;
}
.menu-menu-agenda-container .current-menu-item > a {
font-weight: 900;
}
/* begin of menu-hidden */
/* end of menu hidden*/
@ -1928,10 +1960,6 @@ textarea {
margin: 1.5em 0 0;
}
.site-main .entry-title {
margin: 0.5em 0 0 0;
}
.page-links {
clear: both;
margin: 0 0 1.5em;
@ -2162,7 +2190,7 @@ textarea {
padding: 0;
color: inherit;
border: none;
background-color: none;
background-color: transparent;
font-size: inherit;
}
@ -2303,10 +2331,7 @@ textarea {
*
* * * * * * * * * * * * * * * */
.xarxaprod-cards,
.category-convocatories,
.category-activitats,
.category-agenda,
.category-agenda-es {
.category-convocatories {
display: flex;
flex-flow: column;
justify-content: flex-end;
@ -2314,10 +2339,7 @@ textarea {
}
.xarxaprod-cards .wp-block-post-title,
.category-convocatories .wp-block-post-title,
.category-activitats .wp-block-post-title,
.category-agenda .wp-block-post-title,
.category-agenda-es .wp-block-post-title {
.category-convocatories .wp-block-post-title {
text-transform: lowercase;
font-size: 1.5rem;
margin-bottom: 0.5em;
@ -2328,13 +2350,7 @@ textarea {
.xarxaprod-cards .post-excerpt,
.xarxaprod-cards .wp-block-post-excerpt,
.category-convocatories .post-excerpt,
.category-convocatories .wp-block-post-excerpt,
.category-activitats .post-excerpt,
.category-activitats .wp-block-post-excerpt,
.category-agenda .post-excerpt,
.category-agenda .wp-block-post-excerpt,
.category-agenda-es .post-excerpt,
.category-agenda-es .wp-block-post-excerpt {
.category-convocatories .wp-block-post-excerpt {
min-height: 7rem;
margin: 0.5em 0;
font-size: 1rem;
@ -2342,15 +2358,13 @@ textarea {
}
.xarxaprod-cards .wp-block-read-more,
.category-convocatories .wp-block-read-more,
.category-activitats .wp-block-read-more,
.category-agenda .wp-block-read-more,
.category-agenda-es .wp-block-read-more {
.category-convocatories .wp-block-read-more {
margin: 1em 0;
}
/* used in
* ./template-parts/section-agenda.php
* template-parts/section-last-agenda.php
* template-parts/section-each-agenda-entry.php
* */
.xarxaprod-agenda .xarxaprod-card-each {
display: flex;
@ -2375,7 +2389,57 @@ textarea {
padding: 0.5rem 0;
}
.xarxaprod-card-each.category-activitats,
.xarxaprod-card-each.category-activitats {
justify-content: flex-start;
}
.xarxaprod-card-each.category-activitats .entry-title {
min-height: 5.5rem;
overflow: hidden;
border: none;
}
.xarxaprod-card-each.category-activitats figure {
order: -1;
margin: 0 0 1rem 0;
width: 100%;
aspect-ratio: 16/9;
overflow: hidden;
}
.xarxaprod-card-each.category-activitats figure img {
object-position: 50% 50%;
max-height: 100%;
object-fit: cover;
width: 100%;
}
.xarxaprod-card-each.category-activitats .xarxaprod-agenda-info {
margin-bottom: 0;
}
.xarxaprod-card-each.category-activitats li {
display: inline-flex;
width: 100%;
max-height: 2.9rem;
overflow: hidden;
font-weight: 100;
}
.xarxaprod-card-each.category-activitats dt {
padding-right: 0.5rem;
text-transform: uppercase;
}
.xarxaprod-card-each.category-activitats dd {
font-weight: 100;
}
.xarxaprod-card-each.category-activitats .post-excerpt {
margin: 0;
min-height: 5rem;
}
li.category-activitats,
li[class*="category-agenda"] {
position: relative;
@ -2383,7 +2447,6 @@ textarea {
align-content: space-between;
}
.xarxaprod-card-each.category-activitats .wp-block-post-featured-image,
li.category-activitats .wp-block-post-featured-image,
li[class*="category-agenda"] .wp-block-post-featured-image {
position: absolute;
@ -2393,7 +2456,6 @@ textarea {
overflow: hidden;
}
.xarxaprod-card-each.category-activitats .wp-block-post-featured-image img,
li.category-activitats .wp-block-post-featured-image img,
li[class*="category-agenda"] .wp-block-post-featured-image img {
object-position: 50% 50%;
@ -2401,13 +2463,11 @@ textarea {
object-fit: cover;
}
.xarxaprod-card-each.category-activitats .wp-block-post-title,
li.category-activitats .wp-block-post-title,
li[class*="category-agenda"] .wp-block-post-title {
height: 100%;
}
.xarxaprod-card-each.category-activitats .wp-block-post-title::before,
li.category-activitats .wp-block-post-title::before,
li[class*="category-agenda"] .wp-block-post-title::before {
content: "";

File diff suppressed because one or more lines are too long

View File

@ -11,53 +11,23 @@
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php
the_title( '<h3 class="entry-title">', '</h3>' );
<h1 class="entry-title">
<?php the_title(); ?>
</h1>
<?php
if ( 'post' === get_post_type() ) :
?>
<div class="entry-meta">
<?php if ( in_category('faq') ){
<?php if ( in_category('faq') ){
// display each faq category of the post as label
xarxaprod_display_each_faq_categories();
//xarxaprod_display_faqs_labels();
} ;?>
<?php if ( in_category( array( 'agenda', 'agenda-es','activitats') ) ) : ?>
<aside class="xarxaprod-agenda-info">
<ul>
<li>
<dt>Data</dt>
<dd><?php the_field('xxp_agenda_date_start'); ?> </dd>
</li>
<li>
<dt>Lloc</dt>
<dd>
</div><!-- .entry-meta -->
<?php endif; ?>
</header><!-- .entry-header -->
<?php //output xxp_agenda_who who is doing the activity
$fielditerate='xxp_agenda_who';
$fields= get_field($fielditerate);
if( $fields ):
?>
<ul class="xarxaprod-label item-<?php echo $fielditerate ?>">
<?php foreach( $fields as $field ): ?>
<li>
<?php echo $field['label']; ?>
<?php //echo '<a href="' . get_category_link( get_the_category()[0]->term_id ) . '?' . $fielditerate . '=' . $field['value'] . '">'; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; // end list xxp_agena_who?>
</div><!-- .entry-meta -->
<?php endif; ?>
</header><!-- .entry-header -->
</dd>
</li>
</ul>
</aside>
<?php endif; //end in_category agenda activitats ?>
<div class="entry-content">
<?php
the_content(

View File

@ -0,0 +1,70 @@
<?php
/**
* Template part for displaying posts from category "agenda"
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Xarxaprod_theme
* @used by template-parts/content-post.php
* @shown in : archive category
*
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('xarxaprod-card-each'); ?> >
<h3 class="entry-title">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark">
<?php the_title(); ?>
</a>
</h3>
<?php if ( has_post_thumbnail() ){?>
<figure class="xarxaprod-activitat-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
</a>
<img src="<?php echo get_the_post_thumbnail_url(); ?>" title="<?php the_title(); ?>" alt="imatge ilustra <?php the_title(); ?>" />
</figure>
<?php } else { ?>
<figure class="xarxaprod-activitat-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
</a>
<img src="<?php echo catch_post_first_image();?>" title="<?php the_title(); ?>" alt="imatge ilustra <?php the_title(); ?>" />
</figure>
<?php };?>
<aside class="xarxaprod-agenda-info">
<ul>
<li>
<dt>Data:</dt>
<?php if( get_field('xxp_agenda_date_start') || get_field('xxp_agenda_date_start') ): ?>
<?php if( get_field('xxp_agenda_date_start') ){ ?>
<dd class="item-xxp-agenda-date-start"><?php the_field('xxp_agenda_date_start'); ?></dd>
<?php } elseif ( get_field('xxp_agenda_date_end') ){ ?>
<dt>Fins al</dt>
<dd class="item-xxp-agenda-date-end"><?php the_field('xxp_agenda_date_end'); ?></dd>
<?php }; ?>
<?php endif; ?>
</li>
<?php if ( get_field('xxp_agenda_free_text') ){?>
<li>
<span class="item-xxp-agenda-free-text"><?php the_field('xxp_agenda_free_text'); ?></span>
</li>
<?php }; ?>
</ul>
</aside>
<?php if ( get_the_excerpt() ){ ?>
<section class="excerpt post-excerpt">
<?php //the_excerpt() ?>
<?php echo wp_trim_words(get_the_excerpt(), 22); // https://developer.wordpress.org/reference/functions/wp_trim_words/?>
</section>
<?php ; }?>
<nav class="more-link">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark" class="button button-more">
Més info
<span class="hide"><?php the_title(); ?></span>
</a>
</nav>
</article>

View File

@ -61,7 +61,7 @@
<?php if( get_field('xxp_agenda_date_start') ){ ?>
<span class="item-xxp-agenda-date-start">el <?php the_field('xxp_agenda_date_start'); ?></span>
<?php } elseif ( get_field('xxp_agenda_date_end') ){ ?>
<span class="item-xxp-agenda-date-end">fins al<?php the_field('xxp_agenda_date_start'); ?></span>
<span class="item-xxp-agenda-date-end">fins al<?php the_field('xxp_agenda_date_end'); ?></span>
<?php } elseif ( get_field('xxp_agenda_free_text') ){?>
<span class="item-xxp-agenda-free-text"><?php the_field('xxp_agenda_free_text'); ?></span>
<?php }; ?>

View File

@ -1,111 +0,0 @@
<?php
/**
* Template part for importing wordpress menus from other sites usin the REST api
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Xarxaprod_theme
*/
# Config
$wordpress_site="https://xarxaprod.cat";
$wordpress_endpoint="https://xarxaprod.cat/wp-json/menus/v1/menus/4";
$items = new ArrayObject;
$items[0] = new ArrayObject(); // top level menu items go here
if ($wordpress_endpoint) {
try {
$client = new Client($wordpress_endpoint);
$client->setOptions(array("timeout"=>2));
$response = $client->send();
}
catch (exception $e) {
$response = null;
}
if ($response) {
$response_data = json_decode($response->getBody());
if (!$response->isClientError() && $response_data) {
foreach ($response_data as $menu_item) {
$lowered_title = strtolower($menu_item->title);
$item_url = $menu_item->url;
if ($lowered_title == 'login') {
// manipulate login url
$item_url = "/login";
}
$item_title = $menu_item->title;
/*
if ($lowered_title == 'collections') {
if ($wordpress_site) {
// change Collections item
$item_title = "Project";
$item_url = $wordpress_site;
} else {
continue; // do not render the Collections item
}
}
*/
$item = [
"id" => $menu_item->ID,
"title" => $item_title,
"url" => $item_url
];
if (!isset($items[$menu_item->menu_item_parent])) {
$items[$menu_item->menu_item_parent] = new ArrayObject();
}
$items[$menu_item->menu_item_parent][$menu_item->ID] =$item;
}
}
}
}
if (count($items[0]) == 0) {
// we did not retrieve a menu from the wordpress site
// let's create a default menu
if ($wordpress_site) {
$collections_item = [
"id" => 1,
"title" => "Collections",
"url" => "/"
];
$items[0][1] = $collections_item;
}
$login_item = [
"id" => 2,
"title" => "Login",
"url" => "/login"
];
$items[0][2] = $login_item;
}
//print_r($items);
if (!function_exists('render_menu')) {
function render_menu($items, $level_id) {
if ($level_id == 0) {
echo '<ul id="" class="dropdown menu" data-dropdown-menu="dropdown-menu" role="menubar">'.
PHP_EOL;
} else {
echo '<ul class="dropdown menu vertical submenu is-dropdown-submenu first-sub" data-toggle="" data-submenu="" role="">'.
PHP_EOL;
}
foreach ($items[$level_id] as $menu_item) {
if ($level_id == 0) {
echo '<li id="" class="" role="">'.PHP_EOL;
} else {
echo '<li id="" class="is-submenu-item is-dropdown-submenu-item" role="">'.PHP_EOL;
}
echo '<a role="" href="'.$menu_item['url'].'">'.$menu_item['title'].'</a>'.PHP_EOL;
if (isset($items[$menu_item['id']])) {
render_menu($items, $menu_item['id']); // render sub menu
}
echo '</li>' . PHP_EOL;
}
echo '</ul>' . PHP_EOL;
}
}
render_menu($items, 0);
?>