File "page-papers.php"

Full Path: /home/ozbarhaber/public_html/19052025___siteeee/wp-content/themes/anka/pages/page-papers.php
File size: 2.18 KB
MIME-type: text/x-php
Charset: utf-8

<?php if(!defined('ABSPATH')) exit; ?>
<?php
/*
	Template Name: Gazete Manşetleri
*/
$safirPapers = safir_get_contents("papers");
$papers = xoption("papers");
if(!is_array($papers)) $papers = array_keys((array)$safirPapers)[0];
$currentPaper = get_query_var("gazete");
if( $currentPaper == "" ) $currentPaper = $papers[0];

if(!in_array($currentPaper, $papers)) {
	$currentPaper = $papers[0];
}

function safir_custom_page_title($title) {
	global $currentPaper;
	$safirPapers = safir_get_contents("papers");
	return $safirPapers->$currentPaper->name . " - " . get_the_title() . " - " . get_bloginfo("name");
}
add_filter( 'pre_get_document_title', 'safir_custom_page_title', 10, 1 );
add_filter( 'wpseo_title', 'safir_custom_page_title', 10, 1 );
add_filter( 'rank_math/frontend/title', 'safir_custom_page_title', 10, 1 );	
?>
<?php get_header(); ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id="main">
	<div class="innerContainer pad">
		<div id="content">
			<div id="papersPage">
				<div class="pageHeading">
					<h1 class="title"><?php echo $safirPapers->$currentPaper->name ?></h1>
					<?php if(xoption('breadcrumb')) sfrBreadcrumbs(); ?>
				</div>

				<div class="bigImage">
					<img src="<?php echo $safirPapers->$currentPaper->image ?>" width="1100" height="1650" alt="<?php echo $safirPapers->$currentPaper->name ?>">
				</div>

				<div class="mainHeading topMargin">
					<?php safirIcon("icon60") ?>
					<div class="title"><?php _e("Diğer Gazeteler", "anka") ?></div>
				</div>
				<ul>
					<?php
					foreach ($papers as $paper) {
						if(!in_array($paper, array_keys((array)$safirPapers))) continue;
						if (get_option('permalink_structure') != '') {
							$link = user_trailingslashit( get_permalink() . $paper );
						} else {
							$link = add_query_arg( 'gazete', $paper, get_permalink() );
						}				
						?>
						<li>
							<a href="<?php echo $link ?>" title="<?php echo $safirPapers->$paper->name ?>">
								<?php echo $safirPapers->$paper->name ?>
							</a>
						</li>
						<?php
					}
					?>
				</ul>
			</div>
		</div>
	</div>
</div>
<?php endwhile; ?>
<?php get_footer(); ?>