Commit 636f4aac authored by numeroteca's avatar numeroteca

create specific displays for activities and entidades

parent 9d5d36f2
Pipeline #91 canceled with stages
<?php
/**
* The template used for displaying single activity content in single.php
*
* @package ThemeGrill
* @subpackage ColorMag
* @since ColorMag 1.0
*/
//Gets the data
$post_id = $post->ID;
$prefixact = '_act_';
$tit = get_the_title();
$place = get_post_meta( $post_id, $prefixact.'place', true );
$time = get_post_meta( $post_id, $prefixact.'time', true );
$dateinit = get_post_meta( $post_id, $prefixact.'date-init', true );
$dateend = get_post_meta( $post_id, $prefixact.'date-end', true );
$organizer = get_post_meta( $post_id, $prefixact.'organizador', true );
$numero_asistentes = get_post_meta( $post_id, $prefixact.'numero-asistentes', true );
$relacion_barrio = get_post_meta( $post_id, $prefixact.'relacion-barrio', true );
$relacion_ayuntamiento = get_post_meta( $post_id, $prefixact.'relacion-ayuntamiento', true );
$activity_summary = get_post_meta( $post_id, $prefixact.'resumen-actividad', true );
$entries = get_post_meta( get_the_ID(), $prefixact . 'mas_info_url', true );
$the_content = get_the_content();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php do_action( 'colormag_before_post_content' ); ?>
<?php
$image_popup_id = get_post_thumbnail_id();
$image_popup_url = wp_get_attachment_url( $image_popup_id );
?>
<?php if ( ( get_theme_mod( 'colormag_featured_image_show', 0 ) == 0 ) && ( has_post_thumbnail() ) ) { ?>
<div class="featured-image">
<?php if (get_theme_mod('colormag_featured_image_popup', 0) == 1) { ?>
<a href="<?php echo $image_popup_url; ?>" class="image-popup"><?php the_post_thumbnail( 'colormag-featured-image' ); ?></a>
<?php } else { ?>
<?php the_post_thumbnail( 'colormag-featured-image' ); ?>
<?php } ?>
</div>
<?php } ?>
<div class="article-content clearfix">
<?php if( get_post_format() ) { get_template_part( 'inc/post-formats' ); } ?>
<?php colormag_colored_category(); ?>
<header class="entry-header">
<h1 class="entry-title">
<?php the_title(); ?>
</h1>
</header>
<?php colormag_entry_meta(); ?>
<div class="entry-content clearfix">
<?php
echo "<p><strong>"._e('Activity data','colormag-child')."</strong><br>";
if ( $tit!= '' ) echo __('What','colormag').": ".$tit."<br>";
if ( $place != '' ) echo __('Place','colormagchild').": ". $place."<br>";
if ( $time != '' ) echo __('Hour','wikitoki').": ".$time."<br>";
if ( $dateinit != '' ) echo __('Start date','wikitoki').": ".date( 'd/M/Y', $dateinit )."<br>";
if ( $dateend!= '') echo __('End date','wikitoki').": ".date( 'd/M/Y', $dateend )."<br>";
echo __('Type','wikitoki').": ". get_the_term_list( $post->ID, 'tipo-actividad', ' ', ', ', '' )."<br>";
echo __('Organized by','wikitoki').": ". $organizer."<br>";
if ( $numero_asistentes != '' ) echo __('Number of people','wikitoki').": ".$numero_asistentes."<br>";
echo "</p>";
the_content();
wp_link_pages( array(
'before' => '<div style="clear: both;"></div><div class="pagination clearfix">'.__( 'Pages:', 'colormag' ),
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>'
) );
?>
</div>
</div>
<?php do_action( 'colormag_after_post_content' ); ?>
</article>
<?php
/**
* The template used for displaying single post content in single.php
*
* @package ThemeGrill
* @subpackage ColorMag
* @since ColorMag 1.0
*/
//Gets the data
$post_id = $post->ID;
$tit = get_the_title();
$web = get_post_meta( $post_id, 'web', true );
$twitter = get_post_meta( $post_id, 'twitter', true );
$feed = get_post_meta( $post_id, 'feed_rss', true );
$facebook = get_post_meta( $post_id, 'facebook', true );
$usuario_web = get_post_meta( $post_id, 'usuario_web', true );
$pertenece = get_post_meta( $post_id, '_pods_pertecene', true );
$pertenece_id = array_values($pertenece); //gets id of organization it belongs to
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php do_action( 'colormag_before_post_content' ); ?>
<?php
$image_popup_id = get_post_thumbnail_id();
$image_popup_url = wp_get_attachment_url( $image_popup_id );
?>
<?php if ( ( get_theme_mod( 'colormag_featured_image_show', 0 ) == 0 ) && ( has_post_thumbnail() ) ) { ?>
<div class="featured-image">
<?php if (get_theme_mod('colormag_featured_image_popup', 0) == 1) { ?>
<a href="<?php echo $image_popup_url; ?>" class="image-popup"><?php the_post_thumbnail( 'colormag-featured-image' ); ?></a>
<?php } else { ?>
<?php the_post_thumbnail( 'colormag-featured-image' ); ?>
<?php } ?>
</div>
<?php } ?>
<div class="article-content clearfix">
<?php if( get_post_format() ) { get_template_part( 'inc/post-formats' ); } ?>
<?php colormag_colored_category(); ?>
<header class="entry-header">
<h1 class="entry-title">
<?php the_title(); ?>
</h1>
</header>
<?php colormag_entry_meta(); ?>
<div class="entry-content clearfix">
<!--
<?php
if ( $web!= '' ) echo __('Web','colormag').": ".$web."<br>";
if ( $feed!= '' ) echo __('Feed','colormag').": ".$feed."<br>";
if ( $twitter!= '' ) echo __('Twitter','colormag').": ".$twitter."<br>";
if ( $facebook!= '' ) echo __('Facebook','colormag').": ".$facebook."<br>";
print_r($usuario_web);
?>
-->
<dl>
<dt>Website</dt>
<dd><a href="<?php echo $web; ?>"><?php echo $curauth->user_url; ?></a></dd>
<dt>Feed</dt>
<dd><a href="<?php echo $feed; ?>"><?php echo $feed; ?></a></dd>
<dt>Twitter</dt>
<dd><a href="<?php echo $twitter; ?>"><?php echo $twitter; ?></a></dd>
<dt>Facebook</dt>
<dd><a href="<?php echo $facebook; ?>"><?php echo $facebook; ?></a></dd>
<dt>Profile</dt>
<dd><?php
the_content();
?></dd>
</dl>
<h2>Organizaciones/Personas a las que pertenece <?php echo $usuario_web["user_nicename"]; ?></h2>
<ul>
<!-- The Loop of entidades-->
<?php
$args = array(
'post_type' => 'entidad', //sets post type to "entidad"
'order' => 'DESC',
'posts_per_page'=> -1,
'post__in' => $pertenece_id, //id de la entidad a la que pertenece
);
$my_query = new WP_Query($args);
$wp_count = $my_query->post_count;
if ($my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
<li>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
<?php the_title(); ?>
</a>
</li>
<?php endwhile; else: ?>
<p><?php _e('No posts by this author.'); ?></p>
<?php endif; ?>
<!-- End Loop -->
</ul>
<!--
<h2>Personas que pertenecen a <?php echo $usuario_web["user_nicename"]; ?>:</h2>
<ul>
-->
<?php //The Loop of entidades
$args = array(
'post_type' => 'entidad', //sets post type to "entidad" TODO: query by current organization
'order' => 'DESC',
'posts_per_page'=> -1,
'tax_query' => array(
array(
'taxonomy' => 'user-type',
'field' => 'slug',
'terms' => 'individual',
)
)
);
$my_query = new WP_Query($args);
$wp_count = $my_query->post_count;
if ($my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
<!--
<li>
<?php the_title(); ?></a>,
</li>
-->
<?php endwhile; else: ?>
<p><?php _e('No posts by this author.'); ?></p>
<?php endif; ?>
<!-- End Loop -->
<!--
</ul>
-->
<h2>Posts de <?php echo $usuario_web["user_nicename"]; ?> en Wikitoki.org:</h2>
<ul>
<!-- The Loop of posts by author -->
<?php
$args = array(
'post_type' => 'post', //sets post type to "Project"
'order' => 'DESC',
'author' => $usuario_web["ID"],
'posts_per_page'=> -1,
);
$my_query = new WP_Query($args);
$wp_count = $my_query->post_count;
if ($my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
<li>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
<?php the_title(); ?></a>,
<?php the_time('d M Y'); ?> in <?php the_category('&');?>
</li>
<?php endwhile; else: ?>
<p><?php _e('No posts by this author.'); ?></p>
<?php endif; ?>
<!-- End Loop -->
</ul>
<h2><?php
//Lists posts in feed from users website
_e( 'Posts de', 'wikitoki' ); ?> <?php echo $usuario_web["user_nicename"]; ?> <?php _e( 'en su blog', 'wikitoki' ); ?>.</h2>
<?php // Get RSS Feed(s)
// code from http://www.wpbeginner.com/wp-tutorials/how-to-display-any-rss-feed-on-your-wordpress-blog/
include_once( ABSPATH . WPINC . '/feed.php' );
// Get a SimplePie feed object from the specified feed source.
$rss = fetch_feed( $feed );
if ( ! is_wp_error( $rss ) ) : // Checks that the object is created correctly
// Figure out how many total items there are, but limit it to 5.
$maxitems = $rss->get_item_quantity( 5 );
// Build an array of all the items, starting with element 0 (first element).
$rss_items = $rss->get_items( 0, $maxitems );
endif;
?>
<ul>
<?php if ( $maxitems == 0 ) : ?>
<li><?php _e( 'No items', 'my-text-domain' ); ?></li>
<?php else : ?>
<?php // Loop through each feed item and display each item as a hyperlink. ?>
<?php foreach ( $rss_items as $item ) : ?>
<li>
<a href="<?php echo esc_url( $item->get_permalink() ); ?>"
title="<?php printf( __( 'Posted %s', 'my-text-domain' ), $item->get_date('j F Y | g:i a') ); ?>">
<?php echo esc_html( $item->get_title() ); ?>
</a>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</div>
</div>
<?php do_action( 'colormag_after_post_content' ); ?>
</article>
......@@ -13,3 +13,16 @@ function my_theme_enqueue_styles() {
}
// TODO: mas_info_url multiple field box i nactivities. Convert it to Pods format.
/*
// Use it to display meta data of a custom post type
add_action('wp_head', 'output_all_postmeta' );
function output_all_postmeta() {
$postmetas = get_post_meta(get_the_ID());
foreach($postmetas as $meta_key=>$meta_value) {
echo $meta_key . ' : ' . $meta_value[0] . '<br/>';
}
}
*/
<?php
/**
* Theme Single Post Section for our theme.
*
* @package ThemeGrill
* @subpackage ColorMag
* @since ColorMag 1.0
*/
get_header(); ?>
<?php do_action( 'colormag_before_body_content' ); ?>
<div id="primary">
<div id="content" class="clearfix">
<?php while ( have_posts() ) : the_post(); ?>
<?php if ( is_singular( 'entidad' ) ) { ?>
<?php get_template_part( 'content', 'entidad' ); ?>
<?php } else if ( is_singular( 'actividad' ) ) { ?>
<?php get_template_part( 'content', 'actividad' ); ?>
<?php } else if ( is_singular( 'actividad' ) ) { ?>
<?php get_template_part( 'content', 'single' ); ?>
<?php } else { ?>
<?php get_template_part( 'content', 'single' ); ?>
<?php } ?>
<?php endwhile; ?>
</div><!-- #content -->
<?php get_template_part( 'navigation', 'single' ); ?>
<?php if ( get_the_author_meta( 'description' ) ) : ?>
<div class="author-box">
<div class="author-img"><?php echo get_avatar( get_the_author_meta( 'user_email' ), '100' ); ?></div>
<h4 class="author-name"><?php the_author_meta( 'display_name' ); ?></h4>
<p class="author-description"><?php the_author_meta( 'description' ); ?></p>
</div>
<?php endif; ?>
<?php if ( get_theme_mod( 'colormag_related_posts_activate', 0 ) == 1 )
get_template_part( 'inc/related-posts' );
?>
<?php
do_action( 'colormag_before_comments_template' );
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() )
comments_template();
do_action ( 'colormag_after_comments_template' );
?>
</div><!-- #primary -->
<?php colormag_sidebar_select(); ?>
<?php do_action( 'colormag_after_body_content' ); ?>
<?php get_footer(); ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment