Sindbad~EG File Manager
<?php
/*
* Security : blocking direct access
* Source : http://codex.wordpress.org/Theme_Development#Template_Files
*/
defined('ABSPATH') or die("Access Restricted");
$queried_object = get_queried_object();
$related_posts = mwp_get_related_posts_amp($queried_object->ID);
$video_ids = mwp_option('category-videos');
$article_ids = mwp_option('category-article');
$amp_relate_title_vi = mwp_option('amp-related-title-video');
$amp_relate_title = mwp_option('amp-related-title');
global $post;
if (!empty($article_ids) && in_category($article_ids, $post->ID)) {
if ($related_posts->have_posts()):
?>
<div class="related">
<?php
if (in_category($video_ids, $post->ID)) {
if (!empty($amp_relate_title_vi)) {
echo '<h2 class="title">'.$amp_relate_title_vi.'</h2>';
} else {
echo '<h2 class="title">'.__('Related Videos', MWP_TEXT_DOMAIN).'</h2>';
}
} else {
if (!empty($amp_relate_title)) {
echo '<h2 class="title">'.$amp_relate_title.'</h2>';
} else {
echo '<h2 class="title">'.__('Related News', MWP_TEXT_DOMAIN).'</h2>';
}
} ?>
<ul>
<?php while ($related_posts->have_posts()) : $related_posts->the_post(); ?>
<?php if ( get_option('permalink_structure') ) {
$link = amp_get_permalink($post->ID);
} else {
$link = get_permalink(). '&=1';
} ?>
<li>
<a href="<?php echo $link; ?>" title="<?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a>
<span>(<?php echo mwp_display_category_name($post->ID); ?>)</span>
</li>
<?php endwhile; ?>
</ul>
</div>
<?php
endif;
} else {
if ($related_posts->have_posts()):
?>
<div class="related">
<?php
if (in_category($video_ids, $post->ID)) {
if (!empty($amp_relate_title_vi)) {
echo '<h2 class="title">'.$amp_relate_title_vi.'</h2>';
} else {
echo '<h2 class="title">'.__('Related Videos', MWP_TEXT_DOMAIN).'</h2>';
}
} else {
if (!empty($amp_relate_title)) {
echo '<h2 class="title">'.$amp_relate_title.'</h2>';
} else {
echo '<h2 class="title">'.__('Related News', MWP_TEXT_DOMAIN).'</h2>';
}
} ?>
<ul class="related-amp">
<?php
while ($related_posts->have_posts()) : $related_posts->the_post();
if ( get_option('permalink_structure') ) {
$link = amp_get_permalink($post->ID);
} else {
$link = get_permalink(). '&=1';
}
?>
<li>
<div class="thumbnail">
<a href="<?php echo $link; ?>" title="<?php the_title_attribute(); ?>">
<?php
mwp_smart_thumb_amp($post->ID, 310, 200);
if (in_category($video_ids, $post->ID)) {
$duration = mwp_video_duration($post->ID);
if (!empty($duration)) {
?><div class="duration"><?php echo $duration; ?></div><?php
}
} ?>
</a>
</div>
<div class="title">
<a href="<?php echo $link; ?>" title="<?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a>
<span><?php mwp_amp_posted_on(); ?></span>
</div>
</li>
<?php endwhile; ?>
</ul>
</div>
<?php
endif;
}
wp_reset_query();
/*
* END Related Posts
*/
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists