created the page templates for fund search and faq page. Created the template part for each post or fund

This commit is contained in:
jorge 2022-12-29 23:27:17 +01:00
parent e479b32a75
commit d2fa402323
4 changed files with 39 additions and 43 deletions

View File

@ -15,12 +15,8 @@ get_header();
<?php if ( have_posts() ) : ?>
<header class="page-header">
<?php
// the_archive_title( '<h1 class="page-title">', '</h1>' );
// the_archive_description( '<div class="archive-description">', '</div>' );
?>
</header><!-- .page-header -->
<content class="archive-posts <?php ofisuport_class_posttype(); //if( is_post_type_archive( array('ofisuport-ajut') )) { echo 'archive-custom-post-type-'; ofisuport_echo_posttype_slug(); } ?>">
<content class="archive-posts <?php ofisuport_class_posttype(); ?>">
<?php
/* Start the Loop */
while ( have_posts() ) :

View File

@ -37,19 +37,9 @@ function ofisuport_pingback_header() {
add_action( 'wp_head', 'ofisuport_pingback_header' );
function ofisuport_echo_posttype_slug() {
$post_type = get_post_type();
if ( $post_type )
{
$post_type_data = get_post_type_object( $post_type );
$post_type_slug = $post_type_data->rewrite['slug'];
echo $post_type_slug;
};
}
function ofisuport_class_posttype (){
if( is_post_type_archive( array('ofisuport-ajut') )) {
echo ' archive-custom-post-type-';
ofisuport_echo_posttype_slug();
printf(get_post_type_object( get_post_type() )->rewrite['slug'] );
}
}

View File

@ -0,0 +1,36 @@
<?php /**
* Template part for displaying each ajut with each field.
* to be used inside the loop.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Oficina_de_Suport_theme
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h3 class="entry-title">
<a href="<?php the_permalink(); ?>" rel="bookmark">
<?php the_title(); ?>
</a>
</h3>
<?php if( get_field('os_funder_name') ): ?>
<p class="ofisuport-funder-name"><?php the_field('os_funder_name'); ?></p>
<?php endif; ?>
<section class="excerpt post-excerpt">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
</a>
<?php the_excerpt() ?>
</section>
<aside>
<?php get_template_part( 'template-parts/section', 'list-checkbox', array('iterate_field' => 'os_fund_target') ); ?>
<?php get_template_part( 'template-parts/section', 'list-checkbox', array('iterate_field' => 'os_fund_source') ); ?>
<?php get_template_part( 'template-parts/section', 'list-checkbox', array('iterate_field' => 'os_fund_field') ); ?>
<?php get_template_part( 'template-parts/section', 'list-checkbox', array('iterate_field' => 'os_fund_apply_begin') ); ?>
<?php get_template_part( 'template-parts/section', 'list-checkbox', array('iterate_field' => 'os_fund_apply_end') ); ?>
<?php get_template_part( 'template-parts/section', 'list-checkbox', array('iterate_field' => 'os_fund_call') ); ?>
</aside>
<button class="button button-more" >
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">accedeix</a>
</button>
</article><!-- #post-<?php the_ID(); ?> -->

View File

@ -40,33 +40,7 @@
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<article class="">
<h3 class="entry-title">
<a href="<?php the_permalink(); ?>" rel="bookmark">
<?php the_title(); ?>
</a>
</h3>
<?php if( get_field('os_funder_name') ): ?>
<p class="ofisuport-funder-name"><?php the_field('os_funder_name'); ?></p>
<?php endif; ?>
<section class="excerpt post-excerpt">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
</a>
<?php the_excerpt() ?>
</section>
<aside>
<?php get_template_part( 'template-parts/section', 'list-checkbox', array('iterate_field' => 'os_fund_target') ); ?>
<?php get_template_part( 'template-parts/section', 'list-checkbox', array('iterate_field' => 'os_fund_source') ); ?>
<?php get_template_part( 'template-parts/section', 'list-checkbox', array('iterate_field' => 'os_fund_field') ); ?>
<?php get_template_part( 'template-parts/section', 'list-checkbox', array('iterate_field' => 'os_fund_apply_begin') ); ?>
<?php get_template_part( 'template-parts/section', 'list-checkbox', array('iterate_field' => 'os_fund_apply_end') ); ?>
<?php get_template_part( 'template-parts/section', 'list-checkbox', array('iterate_field' => 'os_fund_call') ); ?>
</aside>
<button class="button button-more" >
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">accedeix</a>
</button>
</article>
<?php get_template_part( 'template-parts/section', 'eachpost' ); ?>
<?php endwhile;//end of the loop ?>
<?php wp_reset_postdata(); ?>