Commit 77aa6b7a authored by numeroteca's avatar numeroteca

remove feeds if no user or feed is provided in Entidad page

parent 74b87e7e
......@@ -169,72 +169,84 @@ $entity_type_simple = $entity_type[0]->slug;
<!--
</ul>
-->
<h2 style="clear:both;">Posts de <?php echo $tit; ?> 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' => $web_user_id,
'posts_per_page'=> -1,
);
$my_query = new WP_Query($args);
$wp_count = $my_query->post_count;
<?php
if ($web_user_id) { // Do not display if no user is provided
?>
<h2 style="clear:both;">Posts de <?php echo $tit; ?> 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' => $web_user_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'); ?>. <?php the_category('|');?>
</li>
<?php endwhile; else: ?>
<p><?php _e('No posts by this author.'); ?></p>
<?php endif; ?>
<!-- End Loop -->
</ul>
<?php } ?>
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'); ?>. <?php the_category('|');?>
</li>
<?php endwhile; else: ?>
<p><?php _e('No posts by this author.'); ?></p>
<?php endif; ?>
<!-- End Loop -->
</ul>
<?php
if ($feed) { // do not display if no feed is provided
?>
<h2><?php
//Lists posts in feed from users website
_e( 'Posts de', 'wikitoki' ); ?> <?php echo $tit; ?> <?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;
<h2><?php
//Lists posts in feed from users website
_e( 'Posts de', 'wikitoki' ); ?> <?php echo $tit; ?> <?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>
<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>
<?php } ?>
</div>
......
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