| Server IP : 160.187.147.141 / Your IP : 216.73.216.229 Web Server : nginx/1.28.0 System : Linux inter3 6.8.0-63-generic #66-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 20:25:30 UTC 2025 x86_64 User : butparkerkhactencom ( 1005) PHP Version : 8.4.8 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /home/butparkerkhactencom/butparkerkhacten.com/wp-content/themes/generatepress-child/ |
Upload File : |
<?php
/**
* Blog single layout using the Parker/Orologio shell.
*/
get_header();
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
$post_id = get_the_ID();
$categories = get_the_category( $post_id );
$category = ! empty( $categories ) ? $categories[0] : null;
$permalink = oc_local_url( get_permalink( $post_id ) );
$image_id = get_post_thumbnail_id( $post_id );
$image_url = $image_id ? wp_get_attachment_image_url( $image_id, 'full' ) : '';
$breadcrumb_items = array(
array(
'@type' => 'ListItem',
'position' => 1,
'name' => 'Trang chủ',
'item' => oc_local_url( home_url( '/' ) ),
),
array(
'@type' => 'ListItem',
'position' => 2,
'name' => 'Tin tức',
'item' => oc_local_url( home_url( '/tin-tuc/' ) ),
),
);
if ( $category ) {
$breadcrumb_items[] = array(
'@type' => 'ListItem',
'position' => 3,
'name' => $category->name,
'item' => oc_local_url( get_category_link( $category ) ),
);
}
$breadcrumb_items[] = array(
'@type' => 'ListItem',
'position' => count( $breadcrumb_items ) + 1,
'name' => get_the_title( $post_id ),
'item' => $permalink,
);
$schemas = array(
array(
'@context' => 'https://schema.org',
'@type' => 'BlogPosting',
'headline' => get_the_title( $post_id ),
'description' => wp_strip_all_tags( get_the_excerpt( $post_id ) ),
'datePublished' => get_the_date( DATE_W3C, $post_id ),
'dateModified' => get_the_modified_date( DATE_W3C, $post_id ),
'mainEntityOfPage'=> $permalink,
'author' => array(
'@type' => 'Organization',
'name' => get_bloginfo( 'name' ),
'url' => oc_local_url( home_url( '/' ) ),
),
'publisher' => array(
'@type' => 'Organization',
'name' => get_bloginfo( 'name' ),
'url' => oc_local_url( home_url( '/' ) ),
),
),
array(
'@context' => 'https://schema.org',
'@type' => 'BreadcrumbList',
'itemListElement' => $breadcrumb_items,
),
);
if ( $image_url ) {
$schemas[0]['image'] = array( oc_local_url( $image_url ) );
}
?>
<main class="orologio-clone oc-page oc-article-page">
<?php oc_clone_header(); ?>
<?php foreach ( $schemas as $schema ) : ?>
<script type="application/ld+json"><?php echo wp_json_encode( $schema, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); ?></script>
<?php endforeach; ?>
<article <?php post_class( 'oc-article' ); ?>>
<header class="oc-article-hero">
<nav class="oc-breadcrumbs oc-article-breadcrumbs" aria-label="Breadcrumb">
<a href="<?php echo esc_url( oc_local_url( home_url( '/' ) ) ); ?>">Trang chủ</a>
<span>/</span>
<a href="<?php echo esc_url( oc_local_url( get_post_type_archive_link( 'post' ) ?: home_url( '/tin-tuc/' ) ) ); ?>">Tin tức</a>
<?php if ( $category ) : ?>
<span>/</span>
<a href="<?php echo esc_url( oc_local_url( get_category_link( $category ) ) ); ?>"><?php echo esc_html( $category->name ); ?></a>
<?php endif; ?>
</nav>
<?php if ( $category ) : ?>
<p class="oc-article-kicker"><?php echo esc_html( $category->name ); ?></p>
<?php endif; ?>
<h1><?php the_title(); ?></h1>
<div class="oc-article-meta">
<time datetime="<?php echo esc_attr( get_the_date( DATE_W3C ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time>
<span><?php echo esc_html( get_the_author() ); ?></span>
</div>
</header>
<?php if ( has_post_thumbnail() ) : ?>
<figure class="oc-article-featured">
<?php the_post_thumbnail( 'full' ); ?>
</figure>
<?php endif; ?>
<div class="oc-article-shell">
<div class="oc-article-content">
<?php the_content(); ?>
<?php
wp_link_pages(
array(
'before' => '<nav class="oc-article-pages" aria-label="Post pages">',
'after' => '</nav>',
)
);
?>
</div>
<aside class="oc-article-sidebar" aria-label="Bài viết liên quan">
<div class="oc-article-cta">
<p>Tư vấn Parker</p>
<h2>Khắc tên, in logo và set quà tặng</h2>
<a href="<?php echo esc_url( oc_local_url( home_url( '/lien-he/' ) ) ); ?>">Liên hệ tư vấn</a>
</div>
<div class="oc-article-side-list">
<h2>Bài viết mới</h2>
<?php
$latest_posts = new WP_Query(
array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 4,
'post__not_in' => array( $post_id ),
'ignore_sticky_posts' => true,
)
);
if ( $latest_posts->have_posts() ) :
while ( $latest_posts->have_posts() ) :
$latest_posts->the_post();
?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php
endwhile;
wp_reset_postdata();
endif;
?>
</div>
</aside>
</div>
</article>
<?php oc_clone_footer_cta(); ?>
</main>
<?php
endwhile;
endif;
get_footer();