File "archive.php"
Full Path: /home/mba/public_html/wp-content-20250804013034-20250807183448/themes/twentytwenty-child-theme/archive.php
File size: 4.84 KB
MIME-type: text/x-php
Charset: utf-8
<?php get_header(); ?>
<?php
$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
?>
<!--Section-3-->
<div class="digital-news mt-5" id="content_main">
<div class="container">
<div class="col-md-8 mt-1 mb-3">
<a href="<?php echo site_url(); ?>" >Home</a> /
<?php
if(is_category()){
$categories = get_the_category();
?>
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": "1",
"item": {
"@id": "<?php echo site_url(); ?>",
"name": "Home"
}
},
{
"@type": "ListItem",
"position": "2",
"item": {
"@id": "<?php echo get_category_link( $categories[0]->term_id );?>",
"name": "Category"
}
}
]
}
</script>
<a href="<?php echo get_category_link( $categories[0]->term_id ); ?>"><?php echo esc_html( $categories[0]->name ); ?> </a>
<?php
}elseif(is_author()){
$author = get_user_by( 'slug', get_query_var( 'author_name' ) );
$displayname = get_the_author_meta('display_name',$curauth->ID)
?>
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": "1",
"item": {
"@id": "<?php echo site_url(); ?>",
"name": "Home"
}
},
{
"@type": "ListItem",
"position": "2",
"item": {
"@id": "<?php echo site_url('authors/');?>",
"name": "Author"
}
},
{
"@type": "ListItem",
"position": "3",
"item": {
"@id": "<?php echo get_author_posts_url($author->ID); ?>",
"name": "<?php echo $author->display_name; ?>"
}
}
]
}
</script>
<a title="" href="#">Author </a> /
<a title="" href="<?php echo get_author_posts_url($curauth->ID); ?>"><?php echo $displayname; ?> </a>
<?php
}
?>
</div>
<div class="row">
<div class="col-md-8 grid-sidebar">
<div class="jl_cat_mid_title">
<?php if ( is_category() ) { ?>
<h1 class="mb-4"><?php echo single_term_title('');?></h1>
<?php } elseif ( is_author() ) {
$displayname = get_the_author_meta('display_name',$curauth->ID)?>
<h1 class="mb-4"><?php echo esc_html($displayname);?></h1>
<?php } elseif ( is_tag() ) {
$displayname = get_the_author_meta('display_name')?>
<h1 class="mb-4"><?php echo single_tag_title();?></h1>
<?php }?>
</div>
<?php if ( is_author() ) {?>
<div class="jl_cat_mid_title">
<div class="col-md-6">
<div class="author_content">
<?php if ($authorDescription = get_the_author_meta('description',$curauth->ID)) : ?>
<p class="dmbs-author-description"><?php echo esc_html($authorDescription); ?></p>
<?php endif; ?>
</div>
</div>
</div>
<?php } ?>
<div class="row">
<?php if ( have_posts() ) : ?>
<?php
// Start the loop.
while ( have_posts() ) : the_post();
$post_author_id = get_post_field( 'post_author', get_the_ID() );
?>
<div class="col-lg-6 col-md-6 col-sm-12 mb-3 border-line">
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink();?>"> <?php the_post_thumbnail('featured', array('class' => 'img-fluid w-100')); ?> </a>
<?php endif; ?>
<div class="content-overlay cont-2 py-4">
<?php
$categories = get_the_category();
if ( ! empty( $categories ) ) {
echo esc_html( $categories[0]->name );
}?>
<a class="d-block mb-2 entry-category" href="<?php the_permalink();?>" rel="category tag"></a>
<a class="d-block mb-2 dgtl-entry-title" href="<?php the_permalink();?>"><?php the_title();?></a>
<p class="mb-4 w-100"><?php echo wp_trim_words( get_the_content(), 20 );?></p>
<span class="byline">
<i>by</i>
<span class="vcard">
<a href="<?php echo
get_author_posts_url($post_author_id);?>"><?php echo get_the_author_meta('display_name',$post_author_id);?></a>
</span>
<span class="spacer-time"></span>
<time class="entry-date"><?php the_time(get_option( 'date_format' ));?></time>
</span>
</div>
</div>
<?php
// End the loop.
endwhile;
?>
<?php endif; ?>
</div>
</div>
<?php include("singlesidebar.php"); ?>
<?php get_template_part( 'template-parts/pagination' ); ?>
</div>
</div>
</div>
<?php get_footer(); ?>