Posso condividere il codice, se questo aiuta a capire...
Questo è l'header.php
codice:
<!DOCTYPE html>
<html lang="en">
<head itemscope itemtype="https://schema.org/WebSite">
<title itemprop="name"><?php bloginfo('name'); ?> <?php wp_title(); ?></title>
<meta https-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta https-equiv="X-UA-Compatible" content="IE=edge">
<meta name="keywords" content="this website main keywords" />
<meta name="author" content="admin">
<meta property="og:image" itemprop="image" content="<?php echo get_the_post_thumbnail_url(); ?>">
<meta property="og:url" content="<?php the_permalink(); ?>"/>
<meta property="og:description" content="This website description"/>
<link rel="profile" href="https://gmpg.org/xfn/11">
<link rel="stylesheet" id="bootstrap-css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" type="text/css" media="all">
<link rel="stylesheet" id="jasny-css" href="//cdnjs.cloudflare.com/ajax/libs/jasny-bootstrap/3.1.3/css/jasny-bootstrap.min.css" type="text/css" media="all">
<link rel="stylesheet" id="awesome-css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css" media="all">
<link rel="stylesheet" id="simple-css" href="//cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.min.css" type="text/css" media="all">
<link rel="stylesheet" id="google-font" href="//fonts.googleapis.com/css?family=Oswald|Open+Sans" type="text/css" media="all">
<link rel="stylesheet" id="style-font" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="all">
<link rel="shortcut icon" href="<?php echo get_site_icon_url() ;?>">
<link href="../../img/video-js.css" rel="stylesheet">
<link href="../../img/resolution-switcher.css" rel="stylesheet">
<link href="../../img/videojs-overlay.css" rel="stylesheet">
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<script src="../../img/videojs-ie8.min.js"></script>
<script src="../../img/video.js"></script>
<script src="../../img/resolution-switcher.js"></script>
<script src="../../img/videojs-overlay.min.js"></script>
<script src="../../img/videojs.disableProgress.js"></script>
<script>function gotomyurl(url,blank){if(blank=='yes'){window.open(url);}else{document.location.href=url;}}</script>
<?php
$alice = get_the_title();
$kuma = get_the_post_thumbnail_url();
$poster_id = get_post_thumbnail_id();
$poster_src = wp_get_attachment_image_src($poster_id,'medium', true);
$local = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
$lang = locale_get_display_language($local);
?>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-nav">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span><a class="navbar-brand1" href="<?php bloginfo('home'); ?>"><img src="<?php bloginfo('home'); ?>/img/logo_small.png" ;?></a></span>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-left">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="icon fa fa-youtube-play" style="color:#c00"></i> Novità <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="<?php bloginfo('home'); ?>/page/"><i class="icon fa fa-youtube-play" style="color:#c00"></i> page1</a></li>
<li><a href="<?php bloginfo('home'); ?>/page/"><i class="icon fa fa-youtube-play" style="color:#c00"></i> page1</a></li>
<li><a href="<?php bloginfo('home'); ?>/page/"><i class="icon fa fa-youtube-play" style="color:#c00"></i> page2</a></li>
<li><a href="<?php bloginfo('home'); ?>/page/"><i class="icon fa fa-youtube-play" style="color:#c00"></i> page3</a></li>
<li><a href="<?php bloginfo('home'); ?>/page/"><i class="icon fa fa-youtube-play" style="color:#c00"></i> page4</a></li>
<li><a href="<?php bloginfo('home'); ?>/page/"><i class="icon fa fa-youtube-play" style="color:#c00"></i> page5</a></li>
<li><a href="<?php bloginfo('home'); ?>/page/"><i class="icon fa fa-youtube-play" style="color:#c00"></i> page6</a></li>
<li><a href="<?php bloginfo('home'); ?>/page/"><i class="icon fa fa-youtube-play" style="color:#c00"></i> page7</a></li>
<li><a href="<?php bloginfo('home'); ?>/page/"><i class="icon fa fa-youtube-play" style="color:#c00"></i> page8</a></li>
<li><a href="<?php bloginfo('home'); ?>/page/"><i class="icon fa fa-youtube-play" style="color:#c00"></i> page9</a></li>
<li><a href="<?php bloginfo('home'); ?>/page/"><i class="icon fa fa-youtube-play" style="color:#c00"></i> page10</a></li>
<li><a href="<?php bloginfo('home'); ?>/page/"><i class="icon fa fa-youtube-play" style="color:#c00"></i> page11</a></li>
</ul>
</li>
</ul>
<form method="GET" action="/" class="navbar-form navbar-right">
<div class="input-group">
<input type="text" name="s" class="form-control" placeholder="SEARCH ITEM...">
<span class="input-group-btn">
<button class="btn btn-primary" type="submit">
<i class="fa fa-search" aria-hidden="true"></i>
</button>
</span>
</div>
</form>
</div>
</div>
</nav>
Questo è l'index.php
codice:
<?php if (have_posts()) : ?>
<?php if (is_category()) { ?>
<div class="page-title" align="left">
<h2 class="page-title-border">
<?php _e(' Post di'); ?>
<?php echo single_cat_title(); ?> [<?php echo $wp_query->found_posts; ?>]
</h2>
</div>
<?php } elseif (is_search()) { ?>
<div class="page-title" align="left">
<h2 class="page-title-border">
<?php _e(' Prodotti trovati:'); ?> <?php echo $wp_query->found_posts; ?>
</h2>
</div>
<?php } ?><?php while (have_posts()) : the_post(); ?>
<?php get_header(); ?>
<div class="container" itemscope itemtype="https://schema.org/Item">
<div class="row" align="center">
<article class="post col-md-8">
<h1 class="entry-title">
<span itemprop="name" class="widget-title"><a href="<?php the_permalink() ?>"><?php the_title(); ?> (<?php $date = get_post_meta($post->ID, 'custom_field', true); echo date('Y', strtotime($date)); ?>)</a></span>
</h1>
<header class="entry-header ">
<meta itemprop="datePublished" content="<?php $date = get_post_meta($post->ID, 'custom_field', true); echo date('d/m/Y', strtotime($date)); ?>">
<div itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
<meta itemprop="worstRating" content="1">
<meta itemprop="bestRating" content="10">
<meta itemprop="ratingValue" content="4.7">
<meta itemprop="ratingCount" content="9">
</div>
<div class="entry-content">
<div class="row">
<br>
<div class="col-md-3 text-center">
<a href="<?php the_permalink() ?>"><img style="border-radius: 10px;" src="<?php echo get_the_post_thumbnail_url(); ?>" alt="<?php the_title(); ?>" width="500" height="750" class="img-responsive inblock main-poster"></a>
<div class="rating-star" itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating"><div class="movie-rating"><span itemprop="ratingValue"></span>
</div>
</div>
</div>
<div class="col-md-9">
<table class="table table-condensed table-bordered table-hover">
<tr><th><i class="icon fa fa-pencil-square-o"></i> Yes yes yese</th><td><?php echo get_post_meta($post->ID, 'custom_field', true); ?></td></tr>
<tr><th><i class="icon fa fa-clock-o"></i> Yes yes yes</th><td><time itemprop="duration" datetime="PT98M"><?php echo get_post_meta($post->ID, 'custom_field', true) ? get_post_meta($post->ID, 'custom_field', true) : ''; ?></time></td></tr>
<tr><th><i class="icon fa fa-film"></i> Yes yes yes</th><td><span itemprop="genre"><span itemprop="blabla"><?php $value=get_post_meta($post->ID,'custom_field',true);$value_array=explode(',',$value);$num_values=count($value_array);foreach($value_array as $key=>$array){$remove_space=str_replace(' ','-',$array);$url=esc_url('link/'.$remove_space);if(''!==$url){$display=esc_html($array);print"<a href='$url'>$display</a>";}if($key<$num_values-1){echo',';};}?></span></span></td></tr>
<tr><th><i class="icon fa fa-globe"></i> Yes yes yes</th><td><span itemprop="creator" itemscope itemtype="https://schema.org/Person"><span itemprop="name" onclick="gotomyurl('link/?s=<?php echo get_post_meta($post->ID, 'custom_field', true); ?>','yes')"><?php echo get_post_meta($post->ID, 'custom_field', true); ?></span></span></td></tr>
<tr><th><i class="icon fa fa-video-camera"></i> Yes yes yes</th><td><span itemprop="creator" itemscope itemtype="https://schema.org/Person"><span itemprop="name"><?php $value=get_post_meta($post->ID,'custom_field',true);$value_array=explode(',',$value);$num_values=count($value_array);foreach($value_array as $key=>$array){$remove_space=str_replace(' ','-',$array);$url=esc_url('link'.$remove_space);if(''!==$url){$display=esc_html($array);print"<a href='$url'>$display</a>";}if($key<$num_values-1){echo',';};}?></span></span></td></tr>
<tr ><th><i class="icon fa fa-user"></i> Yes yes yes</th><td><span itemprop="keywords"><span class="itemprop" itemprop="keywords"><?php $value = get_post_meta($post->ID, 'custom_field', true); $value_array = explode(',', $value); $hrefs = []; for($i = 0; $i < 7; $i++) { $remove_space = str_replace(' ', '-', $value_array[$i]); $url = esc_url('link' . $remove_space); if ('' !== $url) { $display = esc_html($value_array[$i]); $hrefs[] = "<a href='$url'>$display</a>";}} echo implode(",", $hrefs);?></span></span></td></tr>
</table>
</div>
</div>
</div>
</article>
<?php get_sidebar(); ?>
</div>
</div>
<?php endwhile; ?>
<?php get_footer(); ?>
<?php else : ?>
<?php get_header(); ?>
<br><div class="post" align="center"><h2><?php _e('Prodotto non disponibile!'); ?><br> <br><img src="/img/404.png"><br> <br><a href="<?php bloginfo('home'); ?>">Clicca qui per tornare al Menu Principale</a></h2><br><br></div>
<?php get_footer(); ?>
<?php endif; ?>