I am tired to resolve the issue of Stray end tag head.
<!doctype html>
<html <?php language_attributes(); ?> >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="X-FRAME-OPTIONS" content="ALLOW-FROM" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
<?php wp_title("|",true, 'right'); ?>
<?php if (!defined('WPSEO_VERSION')) { bloginfo('name'); } ?>
</title>
<link rel='shortcut icon' href='<?php echo get_template_directory_uri(); ?>/img/favicon.ico' type='image/x-icon' />
<?php
$page_amp_url = get_post_meta(get_the_ID(), 'amp_page_url', TRUE);
if(!empty($page_amp_url)){
echo'<link rel="amphtml" href="'.$page_amp_url.'" />';
}
?>
<?php $options = get_option('salient'); ?>
<?php if(!empty($options['responsive']) && $options['responsive'] == 1) { ?>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
<?php } else { ?>
<meta name="viewport" content="width=1200" />
<?php } ?>
<!--Shortcut icon-->
<?php if(!empty($options['favicon'])) { ?>
<link rel="shortcut icon" href="<?php echo nectar_options_img($options['favicon']); ?>" />
<?php } ?>
<?php if(is_page('5584')){ ?>
<meta property="og:image" content="https://www.accudock.com/wp-content/uploads/2016/11/willy-375x376-375x376.jpg" />
<meta property="og:image:width" content="375" />
<meta property="og:image:height" content="376" />
<meta property="og:image" content="https://www.accudock.com/wp-content/uploads/2016/11/willy1-375x376.jpg" />
<meta property="og:image:width" content="375" />
<meta property="og:image:height" content="376" />
<meta property="og:image" content="https://www.accudock.com/wp-content/uploads/2016/11/Untitled-1-375x376.jpg" />
<meta property="og:image:width" content="375" />
<meta property="og:image:height" content="376" />
<meta property="og:image" content="https://www.accudock.com/wp-content/uploads/2016/11/4x20-floating-dock-375x376.jpg" />
<meta property="og:image:width" content="375" />
<meta property="og:image:height" content="376" />
<?php }?>
<?php wp_head(); ?>
<?php
global $post;
global $woocommerce;
//check if parallax nectar slider is being used
$parallax_nectar_slider = using_nectar_slider();
$force_effect = get_post_meta($post->ID, '_force_transparent_header', true);
// header transparent option
$transparency_markup = null;
$activate_transparency = null;
$using_fw_slider = using_nectar_slider();
$using_fw_slider = (!empty($options['transparent-header']) && $options['transparent-header'] == '1') ? $using_fw_slider : 0;
if($force_effect == 'on') $using_fw_slider = '1';
$disable_effect = get_post_meta($post->ID, '_disable_transparent_header', true);
if(!empty($options['transparent-header']) && $options['transparent-header'] == '1') {
$starting_color = (empty($options['header-starting-color'])) ? '#ffffff' : $options['header-starting-color'];
$activate_transparency = using_page_header($post->ID);
$remove_border = (!empty($options['header-remove-border']) && $options['header-remove-border'] == '1') ? 'true' : 'false';
$transparency_markup = ($activate_transparency == 'true') ? 'data-transparent-header="true" data-remove-border="'.$remove_border.'" class="transparent"' : null ;
}
//header vars
$logo_class = (!empty($options['use-logo']) && $options['use-logo'] == '1') ? null : 'class="no-image"';
$sideWidgetArea = (!empty($options['header-slide-out-widget-area'])) ? $options['header-slide-out-widget-area'] : 'off';
$sideWidgetClass = (!empty($options['header-slide-out-widget-area-style'])) ? $options['header-slide-out-widget-area-style'] : 'slide-out-from-right';
$fullWidthHeader = (!empty($options['header-fullwidth']) && $options['header-fullwidth'] == '1') ? 'true' : 'false';
$headerSearch = (!empty($options['header-disable-search']) && $options['header-disable-search'] == '1') ? 'false' : 'true';
$headerFormat = (!empty($options['header_format'])) ? $options['header_format'] : 'default';
$mobile_fixed = (!empty($options['header-mobile-fixed'])) ? $options['header-mobile-fixed'] : 'false';
$fullWidthHeader = (!empty($options['header-fullwidth']) && $options['header-fullwidth'] == '1') ? 'true' : 'false';
$headerColorScheme = (!empty($options['header-color'])) ? $options['header-color'] : 'light';
$userSetBG = (!empty($options['header-background-color']) && $headerColorScheme == 'custom') ? $options['header-background-color'] : '#ffffff';
$trans_header = (!empty($options['transparent-header']) && $options['transparent-header'] == '1') ? $options['transparent-header'] : 'false';
$bg_header = (!empty($post->ID) && $post->ID != 0) ? using_page_header($post->ID) : 0;
$bg_header = ($bg_header == 1) ? 'true' : 'false'; //convert to string for references in css
$perm_trans = (!empty($options['header-permanent-transparent']) && $trans_header != 'false' && $bg_header == 'true') ? $options['header-permanent-transparent'] : 'false';
$headerResize = (!empty($options['header-resize-on-scroll']) && $perm_trans != '1') ? $options['header-resize-on-scroll'] : '0';
$button_styling = (!empty($options['button-styling'])) ? $options['button-styling'] : 'default';
$footer_reveal = (!empty($options['footer-reveal'])) ? $options['footer-reveal'] : 'false';
$footer_reveal_shadow = (!empty($options['footer-reveal-shadow']) && $footer_reveal == '1') ? $options['footer-reveal-shadow'] : 'none';
$has_main_menu = (has_nav_menu('top_nav')) ? 'true' : 'false';
if($headerColorScheme == 'dark') { $userSetBG = '#1f1f1f'; }
$userSetSideWidgetArea = $sideWidgetArea;
if($has_main_menu == 'true' && $mobile_fixed == '1') $sideWidgetArea = '1';
if($headerFormat == 'centered-menu-under-logo') $fullWidthHeader = 'false';
?>
</head>
Mostly the theme header is customized. I don't see any issue in that code. Please guide me how I can resolve this issue.
Here is the w3c validation
You have some comment errors in your html.
First around here: (this is the corrected code)
<!-- [if IE 8]-->
<link rel="stylesheet" type="text/css" href="https://www.accudock.com/wp-content/plugins/js_composer_salient/assets/css/vc-ie8.css" media="screen">
<!--[endif]-->
<!-- BEGIN recaptcha, injected by plugin wp-recaptcha-integration -->
<!-- END recaptcha -->
<!-- WP Facebook Pixel Code - Main -->
Next, remove the <img> tag from the <noscript> tag in head portion here:
<noscript><img alt="" height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=638313929660068&ev=PageView&noscript=1"
/></noscript>
This will solve the stray head tag error.
Related
Iam trying to create artist gallery. Gallery is created but when i need to have 50 artists, i have to create 50 pages. So i need to change only direction to folder after link is clicked.
What is the best way to do it ?
Link to my gallery
http://www.divart.sk/vg/krajina.php
links to artists
<option value="http://www.divart.sk/vg/krajina.php">krajina</option>
<option value="http://www.divart.sk/vg/virtualgallery.php">Adina Chitu</option>
php code
$dir = "krajina/";
if (is_dir($dir)){
if ($dh = opendir($dir)){
while (($file = readdir($dh)) !== false){
if( $file == '.' || $file == '..')
continue;
echo " <div><img src='krajina/" . $file . "'/></div>";
}
closedir($dh);
}
}
You can do simple by passing the folder name to php script via Query String using (Parse String) and ScanDir.
You'll have to create this structure:
http://www.divart.sk/vg/gallery.php?dir=the_artist_folder
http://www.divart.sk/vg/krajina/
http://www.divart.sk/vg/nicole/
http://www.divart.sk/vg/jonathan/
Where the folder name is the folder artist, while the gallery.php is the php script that read the folder artist!
As requested in the comments, you can add artist info by loading a text file (is not the best way) put inside the folder artist, example:
http://www.divart.sk/vg/krajina/artist.txt
http://www.divart.sk/vg/nicole/artist.txt
http://www.divart.sk/vg/jonathan/artist.txt
Example of text file artist.txt:
Artist: krajina;
Born: 1967/04/18;
Photo Genre: Nature;
License Photo: Creative Commons;
For example: <option value="http://www.divart.sk/vg/gallery.php?dir=krajina">krajina</option>
gallery.php
<?php ini_set('default_charset', 'UTF-8'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="distribution" content="global">
<meta name="language" content="italian it">
<meta name="language" content="english en">
<meta name="rating" content="general">
<meta name="revisit-after" content="6 days">
<meta name="pragma" content="no-cache">
<meta name="robots" content="index, nofollow">
<title>Gallery</title>
<link rel="stylesheet" type="text/css" media="all" href="gallery.css">
<link rel="shortcut icon" href="/favicon.ico">
</head>
<body>
<?php
// example: http://www.divart.sk/vg/gallery.php?dir=krajina
// rev .04 (23.04.2019)
function file_get_contents_utf8($fn) {
$content = file_get_contents($fn);
return mb_convert_encoding($content, 'UTF-8', mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true));
}
$gurl = $_SERVER['QUERY_STRING'];
$ourl = array();
$list = array();
parse_str($gurl, $ourl);
$valid_artist = array("krajina", "nicole", "jonathan");
if (isset($ourl['dir']) || (!empty($ourl['dir']))) {
if (!in_array($ourl['dir'], $valid_artist)) {
exit("This artist name isn't allowed");
}
if ((!file_exists($ourl['dir'])) || (!is_dir($ourl['dir']))) {
exit("This folder doen't exist!");
}
if (preg_match('/[\s]/', $ourl['dir'])) {
exit("Detected white space, please don't use it");
} else {
$dir = htmlspecialchars($ourl['dir'], ENT_NOQUOTES, 'UTF-8');
}
}
if ((isset($dir)) || (!empty($dir))) {
if (file_exists("$dir/artist.txt") && is_file("$dir/artist.txt")) {
$artist = file_get_contents_utf8("$dir/artist.txt");
$artist = htmlentities($artist, ENT_QUOTES, 'UTF-8');
echo "<div>$artist</div>\n";
}
$list = scandir($dir);
foreach ($list as $file) {
if (is_file($dir . '/' . $file)) {
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
if ($ext == 'gif' || $ext == 'jpeg' || $ext == 'jpg' || $ext == 'png') {
echo "<div>\n<img src=\"" . $dir . '/' . $file . "\" alt=\"" . $dir . "\"><br />\n</div>\n";
echo "<div>\nPhoto: " . basename($file) . "<br />\n</div>\n";
}
}
}
} else {
echo "No Artist Folder to Show!";
}
?>
</body>
</html>
If you see the html source generated by Php you can see:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="distribution" content="global">
<meta name="language" content="italian it">
<meta name="language" content="english en">
<meta name="rating" content="general">
<meta name="revisit-after" content="6 days">
<meta name="pragma" content="no-cache">
<meta name="robots" content="index, nofollow">
<title>Gallery</title>
<link rel="stylesheet" type="text/css" media="all" href="gallery.css">
<link rel="shortcut icon" href="/favicon.ico">
</head>
<body>
<div>Artist: krajina;
Born: 1967/04/18;
Photo Genre: Nature;
License Photo: Creative Commons;</div>
<div>
<img src="krajina/001.jpg" alt="krajina"><br />
</div>
<div>
Photo: 001.jpg<br />
</div>
<div>
<img src="krajina/002.jpg" alt="krajina"><br />
</div>
<div>
Photo: 002.jpg<br />
</div>
<div>
<img src="krajina/003.jpg" alt="krajina"><br />
</div>
<div>
Photo: 003.jpg<br />
</div>
<div>
<img src="krajina/004.jpg" alt="krajina"><br />
</div>
<div>
Photo: 004.jpg<br />
</div>
<div>
<img src="krajina/005.jpg" alt="krajina"><br />
</div>
<div>
Photo: 005.jpg<br />
</div>
</body>
</html>
I hope this helps.
My child theme for the WP Organics theme is not overwriting the parent CSS. I found some sources saying to implement the parent CSS in a different way, however I cannot find the CSS link in the header.
The theme is installed in WP, and working exactly as the parent theme.
<?php
// Theme init - don't remove next row! Load custom options
organics_core_init_theme();
$theme_skin = organics_esc(organics_get_custom_option('theme_skin'));
$body_scheme = organics_get_custom_option('body_scheme');
if (empty($body_scheme) || organics_is_inherit_option($body_scheme)) $body_scheme = 'original';
$blog_style = organics_get_custom_option(is_singular() && !organics_get_global('blog_streampage') ? 'single_style' : 'blog_style');
$body_style = organics_get_custom_option('body_style');
$article_style = organics_get_custom_option('article_style');
$top_panel_style = organics_get_custom_option('top_panel_style');
$top_panel_position = organics_get_custom_option('top_panel_position');
$top_panel_scheme = organics_get_custom_option('top_panel_scheme');
?><!DOCTYPE html>
<html <?php language_attributes(); ?> class="<?php echo esc_attr('scheme_'.$body_scheme); ?>">
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1<?php echo (organics_get_theme_option('responsive_layouts') == 'yes' ? ', maximum-scale=1' : ''); ?>">
<meta name="format-detection" content="telephone=no">
<?php
if (floatval(get_bloginfo('version')) < 4.1) {
?><title><?php wp_title( '|', true, 'right' ); ?></title><?php
}
?>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php
if ( !function_exists('has_site_icon') || !has_site_icon() ) {
$favicon = organics_get_custom_option('favicon');
if (!$favicon) {
if ( file_exists(organics_get_file_dir('skins/'.($theme_skin).'/images/favicon.ico')) )
$favicon = organics_get_file_url('skins/'.($theme_skin).'/images/favicon.ico');
if ( !$favicon && file_exists(organics_get_file_dir('favicon.ico')) )
$favicon = organics_get_file_url('favicon.ico');
}
if ($favicon) {
?><link rel="icon" type="image/x-icon" href="<?php echo esc_url($favicon); ?>" /><?php
}
}
wp_head();
?>
</head>
I'm building a custom theme in Wordpress and I need to add a CSS attribute to the body tag when the URL ends in ?checklist-view=1
What is wrong with my code below, since no fullscreen is being added?
I understand that I need to use the superglobal $_GET, however I'm completely new to PHP.
Is there an easier way to do this with the body_class template tag (like im trying below) or is this something that would require more complicated PHP
EDIT: Changed $class to equal a string and not have it set to an array.
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0">
<title>Process Street <?php wp_title(); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" media="screen" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]>
<script src="<?php echo get_stylesheet_uri(); ?>bower_components/html5shiv/dist/html5shiv.js"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
<?php
//?checklist-view=1
$is_checklist = $_GET['checklist-view'];
$class= 'fullscreen';
if($is_checklist == '1') {
echo $class;
}
?>
<body <?php body_class($class); ?>>
You shouldn't echo the class but, rather, you should just assign it to the variable to be passed to body_class() later. I'd also check whether or not checklist-view is set, to avoid errors:
<?php
$is_checklist = $_GET['checklist-view'];
if ( !empty( $is_checklist ) && $is_checklist === '1') {
$class= 'fullscreen';
} else {
$class = '';
}
?>
<body <?php body_class($class); ?>>
You can also achieve the same thing with the ternary operator:
$checklist = $_GET['checklist-view'];
$class = ( !empty( $checklist ) && $checklist === '1') ? 'fullscreen' : '';
?>
<body <?php body_class($class); ?>>
I have to add noindex to some url's, this is my code at the moment:
<?php if ($metanoindex) { ?>
<meta name="robots" content="noindex,follow" />
<?php } elseif ($_SERVER['REQUEST_URI']=='/dolls/1/bestselling' ) { ?>
<meta name="robots" content="noindex,follow" />
<?php } elseif ($_SERVER['REQUEST_URI']=='/dolls/1/bestselling/30' ) { ?>
<meta name="robots" content="noindex,follow" />
<?php } elseif ($_SERVER['REQUEST_URI']=='/dolls/1' ) { ?>
<meta name="robots" content="noindex,follow" />
<?php } else { ?>
<meta name="robots" content="index,follow" />
<?php } ?>
I wondered if there is a way to make an array of urls instead of repeating "else if" each time.
Try as below
<?php
$arr = array('/dolls/1/bestselling','/dolls/1/bestselling/30','/dolls/1');
if($metanoindex || in_array($_SERVER['REQUEST_URI'],$arr)){ ?>
<meta name="robots" content="noindex,follow" />
<?php
}
else {
?>
<meta name="robots" content="index,follow" />
<?php } ?>
PHP Manual: in_array()
$urls = array('/dolls/1/bestselling', '/dolls/1/bestselling/30', '/dolls/1');
if (in_array($_SERVER['REQUEST_URI'], $urls)) {
// Insert meta tag here
}
how to add differents meta (opengrapg) tag to every dynamic created page (www.page.com/index.php?page=article&id=1), i tried to put this in article page:
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta property="og:title" content="<?php echo $title?>" />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://www.page.com/index.php?page=article&id=<?php echo $id ?>" />
<meta property="og:image" content="http://www.page.com/image.png" />
<meta property="og:site_name" content="eeeeee" />
<meta property="og:description" content="<?php echo $desc; ?>"/>
<meta property="fb:admins" content="blabla" />
</head>
but FB Linter cant see them - "Required Property Missing"
I simple include with switch function article.php page
$conlibrary="play/pages/" ;
IF(!isset($_GET['page'])){
$page = 'deafault';
} ELSE {
$page = $_GET['page'];
$findme = '&';
$pos = strpos($page, $findme);
IF ($pos ===true) {
$data = explode("&", $data);
$dest =$conlibrary."/".$data[0].".php";
IF (file_exists($dest)) {
$page = $_GET['page'];
} ELSE {
$page = '404';
}
} ELSE {
$dest =$conlibrary."/".$page.".php";
IF (file_exists($dest)) {
$page = $_GET['page'];
} ELSE {
$page = '404';
}
}
}
include($conlibrary . $page .".php");
ty
Your missing the ? in your URL...
www.page.com/?page=article&id=1
not
www.page.com/page=article&id=1