I am currently working on a website I didn't code in the first place. It was created by someone else on Wordpress using the Sidney Theme and there is no child-theme.
Here is my problem : when I update the header.php file by going to Appearance -> Editor, the website crashes and all the CSS disappears.
Fortunalely, I made a backup of the website so I recovered it.
I never had any problem like this one. It is the first time I post on Stack Overflow so if you need any info just tell me.
The website is under version 5.1.1 of Wordpress.
Here is header.php file if it can help :
<?php
/**
* The header for our theme.
*
* Displays all of the <head> section and everything up till <div
id="content">
*
* #package Sydney
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<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()
) : ?>
<?php if ( get_theme_mod('site_favicon') ) : ?>
<link rel="shortcut icon" href="<?php echo
esc_url(get_theme_mod('site_favicon')); ?>" />
<?php endif; ?>
<?php endif; ?>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php do_action('sydney_before_site'); //Hooked: sydney_preloader() ?>
<div id="page" class="hfeed site">
<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'sydney' ); ?></a>
<?php do_action('sydney_before_header'); //Hooked: sydney_header_clone() ?>
<header id="masthead" class="site-header" role="banner">
<div class="header-wrap">
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-8 col-xs-12">
<?php if ( get_theme_mod('site_logo') ) : ?>
<img class="site-logo" src="<?php echo esc_url(get_theme_mod('site_logo')); ?>" alt="<?php bloginfo('name'); ?>" />
<?php else : ?>
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
<?php endif; ?>
</div>
<div class="col-md-8 col-sm-4 col-xs-12">
<div class="btn-menu"></div>
<nav id="mainnav" class="mainnav" role="navigation">
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'fallback_cb' => 'sydney_menu_fallback' ) ); ?>
</nav><!-- #site-navigation -->
</div>
</div>
</div>
</div>
</header><!-- #masthead -->
<?php do_action('sydney_after_header'); ?>
<div class="sydney-hero-area">
<?php sydney_slider_template(); ?>
<div class="header-image">
<?php sydney_header_overlay(); ?>
<img class="header-inner" src="<?php header_image(); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?>">
</div>
<?php sydney_header_video(); ?>
<?php do_action('sydney_inside_hero'); ?>
</div>
<?php do_action('sydney_after_hero'); ?>
<div id="content" class="page-wrap">
<div class="container content-wrapper">
<div class="row">
don't use theme Editor. open your cpanel. go to your theme folder. edit your header file. then paste your code.
thankyou.
Related
I have a strange message in header in Wordpress. It belows on my navigation bar in the wordpress. I do not know how to fix the code. Help people, please..
I have installed plugins but nothing new. The problem has occurred today.
At first I thought I had a syntax error but I tested the code and it is ok.
For example:
enter image description here
Whether the problem is in any other file?
How can i remove this? May be I have an error in header.php...I dont know.
That is my header.php file:
<!doctype html>
<!--[if IE 7 ]> <html <?php language_attributes(); ?> class="isie ie7 oldie no-js"> <![endif]-->
<!--[if IE 8 ]> <html <?php language_attributes(); ?> class="isie ie8 oldie no-js"> <![endif]-->
<!--[if IE 9 ]> <html <?php language_attributes(); ?> class="isie ie9 no-js"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html <?php language_attributes(); ?> class="no-js"> <!--<![endif]-->
<head>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W5FZJCF');</script>
<!-- End Google Tag Manager -->
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<?php is_dt_theme_moible_view(); ?>
<script charset="UTF-8" src="//cdn.sendpulse.com/28edd3380a1c17cf65b137fe96516659/js/push/c62b1197420513c7a9c7298ef1e2bb6e_1.js" async></script>
<meta name="author" content="designthemes">
<title><?php dt_theme_public_title(); ?></title>
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php
global $dt_allowed_html_tags;
#Load Theme Styles...
if(dt_theme_option('integration', 'enable-header-code') != '') echo '<script type="text/javascript">'.wp_kses(stripslashes(dt_theme_option('integration', 'header-code')), $dt_allowed_html_tags).'</script>';
wp_head(); ?>
</head>
<body <!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W5FZJCF"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) --> <?php if(dt_theme_option("appearance","layout") == "boxed") body_class('boxed'); else body_class(); ?>
<?php if(dt_theme_option('general','loading-bar') != "true") echo '<div id="loader-wrapper"><div class="loader"><span class="fa fa-spinner fa-spin"></span></div></div>'; ?>
<!-- **Wrapper** -->
<div class="wrapper">
<div class="inner-wrapper">
<!-- header-wrapper starts here -->
<?php $htype = dt_theme_option('appearance','header_type'); $htype = !empty($htype) ? $htype : 'header1'; ?>
<div id="header-wrapper" class="<?php if(dt_theme_option('general','header-top-bar') == "true") echo esc_attr('notop-bar'); if($htype == 'header3') echo esc_attr(' header3-wrapper'); ?>">
<header id="header" class="<?php echo esc_attr($htype); ?>">
<?php if(dt_theme_option('general','header-top-bar') != "true"): ?>
<!-- Top bar starts here -->
<div class="top-bar">
<div class="container">
<?php if(dt_theme_option('general', 'top-bar-left-content') != NULL && $htype != 'header5'): ?>
<div class="dt-sc-contact-info">
<p><?php echo wp_kses(do_shortcode(stripslashes(dt_theme_option('general', 'top-bar-left-content'))), $dt_allowed_html_tags); ?></p>
</div>
<?php elseif($htype == 'header5'):
echo do_shortcode('[dt_social/]');
endif; ?>
<div class="top-right">
<ul><?php
if(function_exists("is_woocommerce")): ?>
<li><span class="fa fa-shopping-cart"></span><?php echo sprintf (_n( '%d item', '%d items', WC()->cart->cart_contents_count ), WC()->cart->cart_contents_count ); ?> - <?php echo WC()->cart->get_cart_total(); ?></li><?php
endif;
if(!is_user_logged_in()):
$loginurl = ( class_exists('c_ws_plugin__s2member_check_activation') ) ? wp_login_url() : wp_login_url(get_permalink()); ?>
<li><a title="<?php _e('Login', 'iamd_text_domain'); ?>" href="<?php echo $loginurl; ?>"><span class="fa fa-sign-in"></span><?php _e('Member Login', 'iamd_text_domain'); ?></a></li>
<li><a title="<?php _e('Register Now', 'iamd_text_domain'); ?>" href="<?php echo wp_registration_url(); ?>"><span class="fa fa-user"></span><?php _e('Register', 'iamd_text_domain'); ?></a></li><?php
else: ?>
<li><a title="<?php _e('Logout', 'iamd_text_domain'); ?>" href="<?php echo wp_logout_url(get_permalink()); ?>"><span class="fa fa-sign-out"></span><?php _e('Logout', 'iamd_text_domain'); ?></a></li>
<li><a title="<?php _e('My Profile', 'iamd_text_domain'); ?>" href="<?php
$current_user = wp_get_current_user();
echo get_edit_user_link($current_user->ID); ?>"><span class="fa fa-dashboard"></span><?php _e('My Profile', 'iamd_text_domain'); ?></a></li><?php
endif; ?>
</ul>
</div>
</div>
</div>
<!-- Top bar ends here -->
<?php endif;
if($htype == 'header3'): ?>
<div id="logo"><?php
if( dt_theme_option('general', 'logo') ):
$template_uri = get_template_directory_uri();
$url = dt_theme_option('general', 'logo-url');
$url = !empty( $url ) ? $url : $template_uri."/images/logo.png";
$retina_url = dt_theme_option('general','retina-logo-url');
$retina_url = !empty($retina_url) ? $retina_url : $template_uri."/images/logo#2x.png";
$width = dt_theme_option('general','retina-logo-width');
$width = !empty($width) ? $width."px;" : "187px";
$height = dt_theme_option('general','retina-logo-height');
$height = !empty($height) ? $height."px;" : "49px";?>
<a href="<?php echo esc_url(home_url());?>" title="<?php bloginfo('title'); ?>">
<img class="normal_logo" src="<?php echo esc_url($url);?>" alt="<?php bloginfo('title'); ?>" title="<?php bloginfo('title'); ?>" />
<img class="retina_logo" src="<?php echo esc_url($retina_url);?>" alt="<?php bloginfo('title'); ?>" title="<?php bloginfo('title'); ?>" style="width:<?php echo esc_attr($width);?>; height:<?php echo esc_attr($height);?>;"/>
</a><?php
else: ?>
<div class="logo-title">
<h1 id="site-title"><?php bloginfo('title'); ?></h1>
<h2 id="site-description"><?php bloginfo('description'); ?></h2>
</div><?php
endif; ?>
</div>
<div class="main-menu-container">
<div class="main-menu">
<div id="primary-menu">
<div class="dt-menu-toggle" id="dt-menu-toggle"><?php _e('Menu','iamd_text_domain'); ?><span class="dt-menu-toggle-icon"></span></div>
<nav id="main-menu">
<?php wp_nav_menu( array('theme_location' => 'primary-menu', 'container' => false, 'menu_id' => 'menu-main-menu', 'menu_class' => 'menu', 'fallback_cb' => 'dt_theme_default_navigation', 'walker' => new DTFrontEndMenuWalker())); ?>
</nav>
</div>
</div>
</div><?php
else: ?>
<div class="main-menu-container">
<div class="main-menu">
<div id="logo"><?php
if( dt_theme_option('general', 'logo') ):
$template_uri = get_template_directory_uri();
$url = dt_theme_option('general', 'logo-url');
$url = !empty( $url ) ? $url : $template_uri."/images/logo.png";
$retina_url = dt_theme_option('general','retina-logo-url');
$retina_url = !empty($retina_url) ? $retina_url : $template_uri."/images/logo#2x.png";
$width = dt_theme_option('general','retina-logo-width');
$width = !empty($width) ? $width."px;" : "187px";
$height = dt_theme_option('general','retina-logo-height');
$height = !empty($height) ? $height."px;" : "49px";?>
<a href="<?php echo esc_url(home_url());?>" title="<?php bloginfo('title'); ?>">
<img class="normal_logo" src="<?php echo esc_url($url);?>" alt="<?php bloginfo('title'); ?>" title="<?php bloginfo('title'); ?>" />
<img class="retina_logo" src="<?php echo esc_url($retina_url);?>" alt="<?php bloginfo('title'); ?>" title="<?php bloginfo('title'); ?>" style="width:<?php echo esc_attr($width);?>; height:<?php echo esc_attr($height);?>;"/>
</a><?php
else: ?>
<div class="logo-title">
<h1 id="site-title"><?php bloginfo('title'); ?></h1>
<h2 id="site-description"><?php bloginfo('description'); ?></h2>
</div><?php
endif; ?>
</div>
<div id="primary-menu">
<div class="dt-menu-toggle" id="dt-menu-toggle"><?php _e('Menu','iamd_text_domain'); ?><span class="dt-menu-toggle-icon"></span></div>
<nav id="main-menu">
<?php wp_nav_menu( array('theme_location' => 'primary-menu', 'container' => false, 'menu_id' => 'menu-main-menu', 'menu_class' => 'menu', 'fallback_cb' => 'dt_theme_default_navigation', 'walker' => new DTFrontEndMenuWalker())); ?>
</nav>
</div>
</div>
</div><?php
endif; ?>
</header>
</div>
<?php putRevSlider('slider1', 'homepage'); ?>
I turned off all the plugins and that appeared again.
If there is something to show it i will.
Thank you in advance.
You can try inspecting the message element from the Developer Tool of the web browser to see if there is any broken html code. Here is how to do that in Chrome https://developer.chrome.com/devtools
i wanna change a link in logo header in wordpress, but i don't know how to change that, i've try to change header.php , unfortunately, that's not working
header.php
<?php
<head>
<meta charset="<?php bloginfo('charset'); ?>" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="body-content-wrapper">
<header id="header-main-fixed">
<div id="header-content-wrapper">
<div id="header-top">
<div id="weglot_here"></div>
<? //php fart_display_social_sites(); ?>
</div>
<div class="clear"></div>
<div id="header-logo">
<?php fart_show_website_logo_image_and_title(); ?>
</div><!-- #header-logo -->
<nav id="navmain">
<?php wp_nav_menu( array( 'theme_location' => 'primary',
'fallback_cb' => 'wp_page_menu',
) ); ?>
</nav><!-- #navmain -->
<div class="clear">
</div><!-- .clear -->
</div><!-- #header-content-wrapper -->
</header><!-- #header-main-fixed -->
<div id="header-spacer">
</div><!-- #header-spacer -->
anyone can help me?
Locate the fart_show_website_logo_image_and_title() function inside functions.php and change the href attribute in the line below to the one you want:
echo '<a href="' . esc_url( home_url('/') ) . '" title="' . esc_attr( get_bloginfo('name') ) . '">';
I'm trying to modify the twentyfifteen theme to have the basic lay-out like in the picture here:
With the top bar with the logo and image at the top and the menu on the side below the top bar. My attempt was to add a div straight at the opening of the body tag in the header to see if the placement would work. It is visible but it doesn't "push down" the side menu like I want it to be (like in the picture.
This is my header.php:
<!DOCTYPE html>
<html <?php language_attributes(); ?> class="no-js">
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<!--[if lt IE 9]>
<script src="<?php echo esc_url( get_template_directory_uri() ); ?>/js/html5.js"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div style="background-color: black; width: 100%; height: 100px;"></div>
<div id="page" class="hfeed site">
<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'twentyfifteen' ); ?></a>
<div id="sidebar" class="sidebar">
<header id="masthead" class="site-header" role="banner">
<div class="site-branding">
<?php
twentyfifteen_the_custom_logo();
if ( is_front_page() && is_home() ) : ?>
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<?php else : ?>
<p class="site-title"><?php bloginfo( 'name' ); ?></p>
<?php endif;
$description = get_bloginfo( 'description', 'display' );
if ( $description || is_customize_preview() ) : ?>
<p class="site-description"><?php echo $description; ?></p>
<?php endif;
?>
<button class="secondary-toggle"><?php _e( 'Menu and widgets', 'twentyfifteen' ); ?></button>
</div><!-- .site-branding -->
</header><!-- .site-header -->
<?php get_sidebar(); ?>
</div><!-- .sidebar -->
<div id="content" class="site-content">
In case it is relevant I also attached the theme's stylesheet here.
With my modifications this is how the div shows up:
The black bar should be above the menu on the left and push it down.
It is because you insert it into the sidebar div and not outside of it, create another div before "sidebar"
I am new in WordPress and I have problem with creating WordPress theme.
I've created a simple template (my first template), in the tutorial I read that I should cut all the header content and paste it in the header.php file.
I did this, and pasted all the header from <!Doctype html> to </head> in header.php and when I include header using get_header() WordPress add a link inside a <div id="header" role="banner"> in body and show that to me.
I don't need that link and div, How to get the rid of that?
This is my code:
index.php:
<?php
get_header();
?>
<div id="extra-content">
<div id="extra-left-div">
<h3>Posts</h3>
<?php if(have_posts()): ?>
<?php while ( have_posts() ):the_post(); ?>
<?php the_title(); ?>
<?php endwhile; ?>
<?php endif; ?>
</div>
<div id="extra-tag-div">
<h3>Tags</h3>
<?php the_tags('',''); ?>
</div>
<div id="extra-category-div">
<h3>Categories</h3>
<?php wp_list_categories('title_li=&hierarchical=0&depth=1&title_li=');?>
</div>
</div>
<div id="full-div">
<div id="logo">
<h1><?php bloginfo('name'); ?></h1>
</div>
<?php if ( have_posts() ) : ?>
<ul id="main-content">
<?php while ( have_posts() ) : the_post(); ?>
<li class="post" id="post-<?php the_ID(); ?>">
<h2 class="post-title"><?php the_title(); ?></h2>
<div class="summery-d"><?php the_excerpt(); ?></div>
<div class="post-meta">
<time> <?php the_date(); ?></time>
</div>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<?php
get_footer();
?>
header.php
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/first.js"></script>
<title><?php
global $page, $paged;
wp_title( '|', true, 'right' );
bloginfo( 'name' );
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
echo " | $site_description";
if ( $paged >= 2 || $page >= 2 )
echo ' | ' . sprintf( __( 'Page %s', 'mytheme' ), max( $paged, $page ) );
?></title>
<meta name="description" content="<?php bloginfo('description'); ?>">
<link rel="stylesheet" media="screen" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" />
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
<link rel="alternate" type="appliction/rss+xml" href="<?php bloginfo('rss2_url'); ?>" title="<?php printf(__( 'آخرین مطالب %s', 'mytheme' ), wp_specialchars( get_bloginfo('name'), 1 ) ); ?>" />
<link rel="alternate" type="appliction/rss+xml" href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php printf(__( 'آخرین نظرات %s', 'mytheme' ), wp_specialchars( get_bloginfo('name'), 1 ) ); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
</head>
<body <?php body_class(); ?>>
<div class="behind" id="b-1">
</div>
<div class="behind" id="b-2">
</div>
<div class="behind" id="b-3">
</div>
<div class="behind" id="b-4">
</div>
<div class="behind" id="b-5">
</div>
<div class="behind" id="b-6">
</div>
<div class="behind" id="b-7">
</div>
<a id="menu-a" href="javascript:void(0);">
</a>
divs with .behind class and #menu-a and some other elements are not in the source (just press ctrl+u), and a link added that I don't need it
<div id="header" role="banner">
<div id="headerimg">
<h1>Mohammad Kermani</h1>
<div class="description"></div>
</div>
</div>
<hr />
I am working on this website
I found the answer
There is not problem, I was named the header.php as headr.php
I just post this answer because maybe one other person has same problem...
I am trying to make my own website based on WordPress and i found really nice theme (FANWOOD LIGHT BY DEVPRESS) but i need to move "Navigation" or Menu below the header. When i did it my body just moved to right and i dont know what happned.
There is the webpage on free webhosting: http://stbrezenecka.wz.cz/ (It's in Czech language)
There is my header.php:
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="main">
*
* #package Fanwood Light
* #since Fanwood Light 1.0
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width" />
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php do_action( 'before' ); ?>
<header id="masthead" class="site-header" role="banner">
<hgroup>
<?php
$header_image = get_header_image();
if ( ! empty( $header_image ) ) { ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
<img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />
</a>
<?php } ?>
<div class="header">
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</div>
</hgroup>
</header><!-- #masthead .site-header -->
<div id="main-navigation">
<nav id="site-navigation" class="navigation-main" role="navigation">
<h1 class="menu-toggle"><?php _e( 'Menu', 'fanwood_light' ); ?></h1>
<div class="assistive-text skip-link"><?php _e( 'Skip to content', 'fanwood_light' ); ?></div>
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav><!-- .site-navigation .main-navigation -->
</div>
<div id="page" class="hfeed site">
<div id="main" class="site-main">
Threre is screenshot:
http://i.stack.imgur.com/CtAT8.png
You have <?php do_action( 'before' ); ?> which creates a <div>, so after </header> add </div>
Yeah I did it! Only thing what I did I just removed navigation from header.php and moved in to index.php and it worked.