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; ...@@ -169,72 +169,84 @@ $entity_type_simple = $entity_type[0]->slug;
<!-- <!--
</ul> </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); <?php
$wp_count = $my_query->post_count; 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(); ?> <?php
<li> if ($feed) { // do not display if no feed is provided
<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>
<h2><?php <h2><?php
//Lists posts in feed from users website //Lists posts in feed from users website
_e( 'Posts de', 'wikitoki' ); ?> <?php echo $tit; ?> <?php _e( 'en su blog', 'wikitoki' ); ?>.</h2> _e( 'Posts de', 'wikitoki' ); ?> <?php echo $tit; ?> <?php _e( 'en su blog', 'wikitoki' ); ?>.</h2>
<?php // Get RSS Feed(s) <?php // Get RSS Feed(s)
// code from http://www.wpbeginner.com/wp-tutorials/how-to-display-any-rss-feed-on-your-wordpress-blog/ // code from http://www.wpbeginner.com/wp-tutorials/how-to-display-any-rss-feed-on-your-wordpress-blog/
include_once( ABSPATH . WPINC . '/feed.php' ); include_once( ABSPATH . WPINC . '/feed.php' );
// Get a SimplePie feed object from the specified feed source. // Get a SimplePie feed object from the specified feed source.
$rss = fetch_feed( $feed ); $rss = fetch_feed( $feed );
if ( ! is_wp_error( $rss ) ) : // Checks that the object is created correctly 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. // Figure out how many total items there are, but limit it to 5.
$maxitems = $rss->get_item_quantity( 5 ); $maxitems = $rss->get_item_quantity( 5 );
// Build an array of all the items, starting with element 0 (first element). // Build an array of all the items, starting with element 0 (first element).
$rss_items = $rss->get_items( 0, $maxitems ); $rss_items = $rss->get_items( 0, $maxitems );
endif; endif;
?> ?>
<ul> <ul>
<?php if ( $maxitems == 0 ) : ?> <?php if ( $maxitems == 0 ) : ?>
<li><?php _e( 'No items', 'my-text-domain' ); ?></li> <li><?php _e( 'No items', 'my-text-domain' ); ?></li>
<?php else : ?> <?php else : ?>
<?php // Loop through each feed item and display each item as a hyperlink. ?> <?php // Loop through each feed item and display each item as a hyperlink. ?>
<?php foreach ( $rss_items as $item ) : ?> <?php foreach ( $rss_items as $item ) : ?>
<li> <li>
<a href="<?php echo esc_url( $item->get_permalink() ); ?>" <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') ); ?>"> title="<?php printf( __( 'Posted %s', 'my-text-domain' ), $item->get_date('j F Y | g:i a') ); ?>">
<?php echo esc_html( $item->get_title() ); ?> <?php echo esc_html( $item->get_title() ); ?>
</a> </a>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
</ul> </ul>
<?php } ?>
</div> </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