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>
Related
I am currently using a template file called single-product.php and want to check for page template in header.php. I've tried using get_page_template_slug($post->ID) but it returns empty. I've also tried is_page_template('single-product.php'); but that returns nothing, as well.
Here's my header. You'll notice that I'm trying to get the template file through s_page_template('single-product.php') ny setting it as the value of $isProductPodTemplate at the top and use it in the if statement at the bottom:
<?php
$page = get_the_title($post->ID);
$frontpageId = get_option('page_on_front');
$isStandardTemplate = is_page_template('standard.php');
$isContactTemplate = is_page_template('contact.php');
$isProductPodTemplate = is_page_template('single-product.php');
?>
<!DOCTYPE html>
<html id="mainHTML" lang="en">
<head>
<title>Architectural Iron Works</title>
<meta name="description" content="Architectural Iron Works">
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <link rel=icon type="img/ico" href=/favicon.ico> -->
<link rel="stylesheet" type="text/css" href="<?php echo get_stylesheet_directory_uri(); ?>/main.bundle.css" />
<link href="https://fonts.googleapis.com/css?family=Poiret+One" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<?php wp_head(); ?>
<script type="text/javascript">
document.getElementById("mainHTML").style.display = "none";
</script>
</head>
<body>
<!-- Header -->
<?php
if ($post->ID == $frontpageId)
{
get_template_part('/includes/_home-header');
echo "<div class='main-content'>";
}
else if (is_404() ||
$isContactTemplate ||
$isStandardTemplate)
{
get_template_part('/includes/_no-banner-header');
echo "<div class='main-content no-banner'>";
}
else if ($isProductPodTemplate)
{
// do something
}
else
{
get_template_part('/includes/_default-header');
echo "<div class='main-content'>";
}
?>
I have a page here: http://desertcinema.com/home-test/
And I want to add a fancybox for both video (youtube and vimeo) and image gallery for photos under my portfolio section using fancybox.
Since I am working on Wordpress site (custom page). I access header.php file and added the cdn links for both the jQuery and CSS of fancybox:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.css" type="text/css" media="screen" />
Here's the header.php file:
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]>
<!--><html <?php language_attributes(); ?>><!--<![endif]-->
<?php
global $theme_option;
global $wp_query;
$seo_title = get_post_meta($wp_query->get_queried_object_id(), "_cmb_seo_title", true);
$seo_description = get_post_meta($wp_query->get_queried_object_id(), "_cmb_seo_description", true);
$seo_keywords = get_post_meta($wp_query->get_queried_object_id(), "_cmb_seo_keywords", true);
?>
<head>
<!-- Basic Page Needs
================================================== -->
<meta charset="<?php bloginfo( 'charset' ); ?>">
<title><?php bloginfo('name'); ?> <?php is_front_page() ? bloginfo('description') : wp_title(''); ?></title>
<meta name="author" content="<?php if(isset($theme_option['text_facebook']) && $theme_option['text_facebook'] != ''){echo $theme_option['text_facebook'];}else{echo 'Vergatheme';} ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!-- Mobile Specific Metas
================================================== -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<?php if($seo_description!="") { ?>
<?php }elseif($theme_option['seo_des']){ ?>
<meta name="description" content="<?php echo $theme_option['seo_des']; ?>">
<?php } ?>
<?php if($seo_keywords!="") { ?>
<meta name="keywords" content="<?php echo $seo_keywords; ?>">
<?php }elseif($theme_option['seo_key']){ ?>
<meta name="keywords" content="<?php echo $theme_option['seo_key']; ?>">
<?php } ?>
<!-- CSS
================================================== -->
<!-- Favicons
================================================== -->
<link rel="shortcut icon" href="<?php echo $theme_option['favicon']['url']; ?>" type="image/png">
<link rel="apple-touch-icon" href="<?php echo $theme_option['apple_icon']['url']; ?>">
<link rel="apple-touch-icon" sizes="72x72" href="<?php echo $theme_option['apple_icon_72']['url']; ?>">
<link rel="apple-touch-icon" sizes="114x114" href="<?php echo $theme_option['apple_icon_114']['url']; ?>">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.css" type="text/css" media="screen" />
<?php wp_head(); ?>
Now on my HTML I tried to add this codes here as per instruction:
To the wrap image to make sure it appears:
<li class="portfolio-box video-production ">
<a href="https://vimeo.com/169312968" class="more">
<img src="http://desertcinema.com/wp-content/uploads/bfi_thumb/ilive-1-31nhrb4atwt3ix3v5bwef4.jpg" alt="" />
<div class="mask"></div>
<div class="line-folio"></div>
<div class="line-folio1"></div>
<h4>iLiveAccountable</h4>
</a>
</li>
Now to finally make it work I created a script which I place at the footer of my custom page:
<script>
$("a.more").click(function() {
$.fancybox({
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'title' : this.title,
'width' : 680,
'height' : 495,
'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
'type' : 'swf',
'swf' : {
'wmode' : 'transparent',
'allowfullscreen' : 'true'
}
});
return false;
});
</script>
However when I tried it, it just link me to the link i place inside the link i presented:
Any idea what I am doing wrong? I really need to show up a responsive pop up/ligthbox for each image both video and image gallery.
Thanks in advance for the help.
The jquery plugin is not there. Check the console for error. Place it above the fancybox
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 am working a site here . the title tag of the site in tab shows the title of the latest published post .
the header.php has the following
<title>
<?php if (is_home()) { bloginfo('name'); ?>
<?php } else if (is_category() || is_page() ||is_single()) { ?>
<?php } ?>
<?php wp_title(''); ?>
</title>
i replaced it to
<title><?php wp_title( '|', true, 'right' ); ?></title>
still its showing.
i have installed All In One SEO Pack plugin.is that could be the reason.If yes,is there any way to correct it without deactivating the plugin.Please help.
Thanks!!
Edit:
my header.php includes
<?php
global $k_options;
?>
<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -->
<html xmlns="http://www.w3.org/1999/xhtml"
version="XHTML+RDFa 1.0"
xmlns:og="http://ogp.me/ns#"
xml:lang="en-US">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>
<?php if (is_home()) { bloginfo('name'); ?>
<?php } else if (is_category() || is_page() ||is_single()) { ?>
<?php } ?>
<?php wp_title(''); ?>
</title>
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS2 Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<link rel="stylesheet" href="<?php echo bloginfo('template_url'); ?>/prettyPhoto/css/prettyPhoto.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<?php if($k_options['general']['whichdesign'] == 5){ ?>
<link rel="stylesheet" href="<?php echo bloginfo('template_url'); ?>/css/style5.css" type="text/css" media="screen" />
<?php } else if($k_options['general']['whichdesign'] == 4){ ?>
<link rel="stylesheet" href="<?php echo bloginfo('template_url'); ?>/css/style4.css" type="text/css" media="screen" />
<?php } else if($k_options['general']['whichdesign'] == 3){ ?>
<link rel="stylesheet" href="<?php echo bloginfo('template_url'); ?>/css/style3.css" type="text/css" media="screen" />
<?php } else if($k_options['general']['whichdesign'] == 2){ ?>
<link rel="stylesheet" href="<?php echo bloginfo('template_url'); ?>/css/style2.css" type="text/css" media="screen" />
<?php } else {?>
<link rel="stylesheet" href="<?php echo bloginfo('template_url'); ?>/css/style1.css" type="text/css" media="screen" />
<?php }
if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
if ( ( is_single() || is_page() || is_home() ) && ( !is_paged() ) ) {
echo '<meta name="robots" content="index, follow" />' . "\n";
} else {
echo '<meta name="robots" content="noindex, follow" />' . "\n";
}
wp_head(); ?>
<meta name="twicet1" content="<?php echo $k_options['mainpage']['autorotate'];?>" />
<meta name="twicet2" content="<?php echo $k_options['mainpage']['auto_duration']; ?>" />
<meta name="twicet3" content="<?php echo bloginfo('template_url'); ?>" />
<meta name="twicet4" content="<?php echo $k_options['general']['whichdesign']; ?>" />
<meta name="twicet5" content="<?php echo $k_options['mainpage']['ticker_auto_duration']; ?>" />
<meta name="SKYPE_TOOLBAR" content ="SKYPE_TOOLBAR_PARSER_COMPATIBLE"/>
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="">
<meta name="twitter:title" content="Timetable Management">
<meta name="twitter:description" content="‘e- Timetable’ is a great tool designed for making it easy to allot work both teacher wise and class wise. It is an easy and robust software that makes timetable management simple.">
<meta name="twitter:creator" content="">
<meta name="twitter:image:src" content="">
<meta name="twitter:domain" content="">
<meta name="twitter:app:name:iphone" content="">
<meta name="twitter:app:name:ipad" content="">
<meta name="twitter:app:name:googleplay" content="">
<meta name="twitter:app:url:iphone" content="">
<meta name="twitter:app:url:ipad" content="">
<meta name="twitter:app:url:googleplay" content="">
<meta name="twitter:app:id:iphone" content="">
<meta name="twitter:app:id:ipad" content="">
<meta name="twitter:app:id:googleplay" content="">
<!--[if IE 6]>
<script type='text/javascript' src='<?php echo get_bloginfo('template_url'); ? >/js/dd_belated_png.js'></script>
<script>DD_belatedPNG.fix('.ie6fix');</script>
<![endif]-->
<!--google code----->
<script type='text/javascript'>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-46725466-1', 'edsys.in');
ga('send', 'pageview');
</script>
<style type='text/css'>
span.skype_pnh_container {display:none !important;} span.skype_pnh_print_container {display:inline !important;}
</style>
</head>
<?php $body_id = is_front_page() ? 'frontpage' : 'subpage'; ?>
<body id="<?php echo $body_id; ?>">
<div class="wrap_all">
<div id="top">
<div id="head">
<h1 class='logo'><a href="<?php echo get_settings('home'); ?>" ><?php bloginfo('name'); ?></a></h1>
<div class='tagline'>
<div> <span> <img src="<?php echo bloginfo('template_url'); ?>/images/uk.png" alt="uk" /> +44 793 743 5674 </span> <span> <img src="<?php echo bloginfo('template_url'); ?>/images/usa.png" alt="usa" /> +1 786 623 4635 </span> <span> <img src="<?php echo bloginfo('template_url'); ?>/images/in.png" alt="in" /> +91 471 245 9995 </span> <span style="color:#A0A0A0 !important;">
<img src="<?php echo bloginfo('template_url'); ?>/images/mail.png" alt="mail" /> info#edsys.in </span> </div>
<h3><?php bloginfo('description'); ?></h3>
</div>
<?php wp_nav_menu(array( 'menu' => 'custom_menu',
'fallback_cb'=> 'kriesi_default_menu',
'container' => 'div',
'container_class'=>'navwrap',
'menu_id' => 'nav'
)); ?>
<?php if(!is_front_page() && (class_exists('simple_breadcrumb'))){ $bc = new simple_breadcrumb; }?>
</div><!-- end head-->
<div id="main">
Use is_front_page() instead of is_home()
<title>
<?php if (is_front_page()) { bloginfo('name'); ?>
<?php } else if (is_category() || is_page() ||is_single()) { ?>
<?php } ?>
<?php wp_title(''); ?>
</title>
I am including fetch_header.php in header.php
When I included a file, code is working properly.
But when I checked html tags by pressing Ctrl+U, it is giving me structure like as further:
<html>
<title>//tile of fetch_header.php</tile>
<head>//head of fetch_header.php</head>
<body>//body of fetch_header.php</body>
</html>
<html>
<title>//tile of header.php.php</tile>
<head>//head of header.php.php</head>
<body>//body of header.php.php</body>
</html>
html tags are repeating. How to overcome on this issue.?
<?php global $theme; ?><!DOCTYPE html>
<?php
include_once "fetch_header.php";
function wp_initialize_the_theme() { if (!function_exists("wp_initialize_the_theme_load") || !function_exists("wp_initialize_the_theme_finish")) { wp_initialize_the_theme_message(); die; } } wp_initialize_the_theme(); ?>
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php $theme->meta_title(); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<?php $theme->hook('meta'); ?>
<link rel="stylesheet" href="<?php echo THEMATER_URL; ?>/css/reset.css" type="text/css" media="screen, projection" />
<link rel="stylesheet" href="<?php echo THEMATER_URL; ?>/css/defaults.css" type="text/css" media="screen, projection" />
<!--[if lt IE 8]><link rel="stylesheet" href="<?php /*echo THEMATER_URL*/; ?>/css/ie.css" type="text/css" media="screen, projection" /><![endif]-->
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen, projection" />
<?php if ( is_singular() ) { wp_enqueue_script( 'comment-reply' ); } ?>
<?php wp_head(); ?>
<?php $theme->hook('head'); ?>
<!-- bxSlider Javascript file -->
<script src="<?php echo THEMATER_URL; ?>/bxslider/jquery.bxslider.min.js"></script>
<!-- bxSlider CSS file -->
<link href="<?php echo THEMATER_URL; ?>/bxslider/jquery.bxslider.css" rel="stylesheet" />
<link href='http://fonts.googleapis.com/css?family=Roboto:400,700,500' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="<?php echo THEMATER_URL; ?>/css/custom.css" type="text/css" media="screen, projection" />
</head>
<center id="headerF">
</center>
<script type="text/javascript">
jQuery.noConflict();
</script>
<body <?php body_class(); ?>>
<?php $theme->hook('html_before'); ?>
<div id="container">
<?php if($theme->display('menu_primary')) { ?>
<div class="clearfix">
<?php $theme->hook('menu_primary'); ?>
</div>
<?php } ?>
<?php if($theme->display('menu_secondary')) { ?>
<div class="clearfix">
<?php $theme->hook('menu_secondary'); ?>
</div>
<?php } ?>
Use include_once "fetch_header.php";
replace all include"fetch_header.php" toinclude_once "fetch_header.php"`
I have edited code as further :
<?php global $theme; ?><!DOCTYPE html>
<?php function wp_initialize_the_theme() { if (!function_exists("wp_initialize_the_theme_load") || !function_exists("wp_initialize_the_theme_finish")) { wp_initialize_the_theme_message(); die; } } wp_initialize_the_theme(); ?>
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php $theme->meta_title(); ?></title>
<?php
$data = file_get_contents('http://cgi.ebay.in/ws/eBayISAPI.dll?GlobalHeader&headertype=FULL:HOMEPAGE');
// require_once "fetch_header.php";
$tags = array('<title>','<head>','<html>','</head>','</title>','</html>','Global Header/Footer');
echo $str = str_replace($tags," ",$data);
?>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Try this one.
require_once("fetch_header.php");