wp_back/wp-content/themes/simple-theme/header.php
2024-05-20 15:37:46 +03:00

122 lines
2.7 KiB
PHP

<?php
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly.
}
$title = YoastSEO()->meta->for_current_page()->title;
// global $PAGEN;
$PAGEN = filter_var ($_REQUEST["PAGEN"], FILTER_SANITIZE_STRING) ? filter_var ($_REQUEST["PAGEN"], FILTER_SANITIZE_STRING) : 1;
$author_id = get_the_author_meta('ID');
// $count_user_posts = count_user_posts( $author_id ); // string(2) "16"
$container_class = isset($args['container_class']) ? $args['container_class'] : 'default';
?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<?php if (str_contains($_SERVER['HTTP_HOST'], 'pamtest')) {
echo $_SERVER['HTTP_HOST'];
}
?>
<script>
// window.location.replace("http://www.w3schools.com");
</script>
<title><?php echo $title; ?><?php if ($PAGEN > 1) echo ". Страница " . $PAGEN; ?></title>
<script>console.log('title', document.title);</script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<link rel="canonical" href="#" class="yoast-seo-meta-tag">
<?php
function count_cat_post($category) {
if(is_string($category)) {
$catID = get_cat_ID($category);
}
elseif(is_numeric($category)) {
$catID = $category;
} else {
return 0;
}
$cat = get_category($catID);
return $cat->count;
}
$tag = get_queried_object();
$url = $_SERVER['REQUEST_URI'];
$tag = $tag->slug;
$author_slug = get_the_author_meta('user_nicename');
$total_pages = get_pages_count($tag);
$total_pages2 = get_pages_count2($tag);
function get_pages_count2($tag = false)
{
$args = array(
'category_name' => 'Blog Post',
'numberposts' => -1,
);
if(($tag)&&($tag!='all')){ $args['tag'] = $tag; }
$posts = new WP_Query( $args );
$total = $posts->found_posts;
return $total;
wp_reset_postdata();
}
$numberofpostsnew = $total_pages2;
$term = get_term_by('slug', $tag, $taxonomy);
if ($tag) {
$suffix = '/blog/tag/'. $tag;
}
elseif ($author_slug && str_contains($url, '/author')) {
$suffix = '/blog/author/'. $author_slug;
}
else {
$suffix = "/blog";
}
?>
<?php wp_head();
?>
</head>
<body>
<div class="i-body theme--light v-application v-application--is-ltr">
<div class="v-application--wrap">
<?php
// body_class();
get_template_part('template-parts/header');
echo '<pre>' . var_export($_REQUEST, true) . '</pre>';
// var_dump($_REQUEST);
echo '<br>';
var_dump($_REQUEST['tags']);
echo '<br>';
var_dump($_GET);
// ob_start();
// header("Location: index.php");
// exit( );
//
// if ($_REQUEST['tags']){
// wp_redirect( home_url() );
// exit;
// }
// echo $tag . '$tag';
?>
<div class="content-wrapper">
<?php