Introduce comprehensive localization capabilities and expanded theme customization options for the ifnex theme. - Add Polylang-compatible language switching logic and UI components - Implement LTR/RTL direction handling based on active language - Add new Customizer sections for logo management and language settings - Add localized content support for Hero section and site metadata - Refactor template files (header, footer, single, front-page) to use translation functions and dynamic content - Add support for custom logo images via WordPress Customizer - Implement new archive template and improved single post layout - Update CSS to handle English (LTR) mode and language-specific styling
124 lines
5.8 KiB
PHP
124 lines
5.8 KiB
PHP
<?php get_header(); ?>
|
||
|
||
<?php while (have_posts()) : the_post(); ?>
|
||
<article <?php post_class('single-article'); ?>>
|
||
|
||
<!-- Article Header -->
|
||
<header class="single-header">
|
||
<div class="container">
|
||
<div class="single-breadcrumb">
|
||
<a href="<?php echo esc_url(home_url('/')); ?>"><?php echo ifnex_t('خانه', 'Home'); ?></a>
|
||
<span>›</span>
|
||
<?php
|
||
$blog_url = get_option('page_for_posts') ? get_permalink(get_option('page_for_posts')) : home_url('/blog');
|
||
?>
|
||
<a href="<?php echo esc_url($blog_url); ?>"><?php echo ifnex_t('بلاگ', 'Blog'); ?></a>
|
||
<span>›</span>
|
||
<span class="current"><?php the_title(); ?></span>
|
||
</div>
|
||
|
||
<?php
|
||
$categories = get_the_category();
|
||
if (!empty($categories)) : ?>
|
||
<div class="single-categories">
|
||
<?php foreach ($categories as $cat) : ?>
|
||
<a href="<?php echo esc_url(get_category_link($cat)); ?>" class="single-category"><?php echo esc_html($cat->name); ?></a>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<h1 class="single-title"><?php the_title(); ?></h1>
|
||
|
||
<div class="single-meta">
|
||
<span class="single-author">
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16">
|
||
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/>
|
||
<circle cx="12" cy="7" r="4"/>
|
||
</svg>
|
||
<?php the_author(); ?>
|
||
</span>
|
||
<span class="single-date">
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16">
|
||
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"/>
|
||
<line x1="16" y1="2" x2="16" y2="6"/>
|
||
<line x1="8" y1="2" x2="8" y2="6"/>
|
||
<line x1="3" y1="10" x2="21" y2="10"/>
|
||
</svg>
|
||
<?php echo get_the_date(); ?>
|
||
</span>
|
||
<span class="single-reading-time">
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16">
|
||
<circle cx="12" cy="12" r="10"/>
|
||
<polyline points="12 6 12 12 16 14"/>
|
||
</svg>
|
||
<?php
|
||
$word_count = str_word_count(strip_tags(get_the_content()));
|
||
$reading_time = max(1, ceil($word_count / 200));
|
||
echo sprintf(ifnex_t('%d دقیقه مطالعه', '%d min read'), $reading_time);
|
||
?>
|
||
</span>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
<!-- Featured Image -->
|
||
<?php if (has_post_thumbnail()) : ?>
|
||
<div class="single-featured">
|
||
<div class="container">
|
||
<?php the_post_thumbnail('large', ['class' => 'single-featured-img']); ?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<!-- Content -->
|
||
<div class="single-content">
|
||
<div class="container">
|
||
<div class="single-body">
|
||
<?php the_content(); ?>
|
||
</div>
|
||
|
||
<!-- Tags -->
|
||
<?php
|
||
$tags = get_the_tags();
|
||
if (!empty($tags)) : ?>
|
||
<div class="single-tags">
|
||
<span class="single-tags-label"><?php echo ifnex_t('برچسبها:', 'Tags:'); ?></span>
|
||
<?php foreach ($tags as $tag) : ?>
|
||
<a href="<?php echo esc_url(get_tag_link($tag)); ?>" class="single-tag">#<?php echo esc_html($tag->name); ?></a>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<!-- Share -->
|
||
<div class="single-share">
|
||
<span class="single-share-label"><?php echo ifnex_t('اشتراکگذاری:', 'Share:'); ?></span>
|
||
<a href="https://twitter.com/intent/tweet?url=<?php echo urlencode(get_permalink()); ?>&text=<?php echo urlencode(get_the_title()); ?>" target="_blank" class="share-btn">Twitter</a>
|
||
<a href="https://www.linkedin.com/sharing/share-offsite/?url=<?php echo urlencode(get_permalink()); ?>" target="_blank" class="share-btn">LinkedIn</a>
|
||
<a href="https://wa.me/?text=<?php echo urlencode(get_the_title() . ' ' . get_permalink()); ?>" target="_blank" class="share-btn">WhatsApp</a>
|
||
</div>
|
||
|
||
<!-- Navigation -->
|
||
<nav class="single-nav">
|
||
<div class="single-nav-prev">
|
||
<?php
|
||
$prev = get_previous_post();
|
||
if ($prev) : ?>
|
||
<span class="single-nav-label"><?php echo ifnex_t('پست قبلی', 'Previous'); ?></span>
|
||
<a href="<?php echo esc_url(get_permalink($prev)); ?>"><?php echo esc_html($prev->post_title); ?></a>
|
||
<?php endif; ?>
|
||
</div>
|
||
<div class="single-nav-next">
|
||
<?php
|
||
$next = get_next_post();
|
||
if ($next) : ?>
|
||
<span class="single-nav-label"><?php echo ifnex_t('پست بعدی', 'Next'); ?></span>
|
||
<a href="<?php echo esc_url(get_permalink($next)); ?>"><?php echo esc_html($next->post_title); ?></a>
|
||
<?php endif; ?>
|
||
</div>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
</article>
|
||
<?php endwhile; ?>
|
||
|
||
<?php get_footer(); ?>
|