Looking for help in getting my wordpress theme to display header image on all pages and not just the home page as it currently does. All pages use get_header php command and the header.php contains the following code:
<?php
/**
* The header for our theme
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* #link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* #package Superb_Landingpage
*/
?>
<!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">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<div class="navigation-wrapper">
<div class="site grid-container">
<header id="masthead" class="site-header grid-x grid-padding-x">
<div class="site-branding large-4 medium-10 small-9 cell">
<?php
the_custom_logo();
if ( is_front_page() && is_home() && is_page() ) :
?>
<div class="logo-container">
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<?php
else :
?>
<div class="logo-container">
<h2 class="site-title"><?php bloginfo( 'name' ); ?></h2>
<?php
endif;
$superb_landingpage_description = get_bloginfo( 'description', 'display' );
if ( $superb_landingpage_description || is_customize_preview() ) :
?>
<p class="site-description"><?php echo $superb_landingpage_description; /* WPCS: xss ok. */ ?></p>
<?php endif; ?>
</div>
</div><!-- .site-branding -->
<nav id="site-navigation" class="main-navigation large-8 medium-2 small-3 cell">
<?php
wp_nav_menu( array(
'theme_location' => 'menu-1',
'menu_id' => 'primary-menu',
) );
?>
</nav><!-- #site-navigation -->
</header><!-- #masthead -->
</div>
</div>
<?php if ( get_header_image() ) : ?>
<?php if ( is_front_page() ) : ?>
<div class="content-wrap">
<div class="bottom-header-wrapper">
<img src="<?php echo esc_url(( get_header_image()) ); ?>" alt="<?php echo esc_attr(( get_bloginfo( 'title' )) ); ?>" />
</div>
</div>
<?php endif; ?>
<?php endif; ?>
<div id="page" class="site grid-container start-container-head">
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'superb-landingpage' ); ?></a>
<div id="content" class="site-content grid-x grid-padding-x">
What do I add/remove to simply have the header display on all pages?
I've tried removing the if/else conditions in the header.php but wordpress keeps rolling back the edit claiming errors. Any help is greatly appreciated! Thank you.
Try it
<?php
if ( is_home() ) {
// This is a homepage
} else {
// This is not a homepage
}
?>
<?php
if ( is_front_page() && is_home() ) {
// This is a homepage
} else {
// This is not a homepage
}
?>
If this does not work try this
<?php
if ( is_front_page() ) {
// This is a homepage
} else {
// This is not a homepage
}
?>
Related
I've downloaded the MetaSlider plugin for WordPress, and am able to insert the generated code into my theme's header.php files so that the slider displays in the correct location. However, the site logo and description disappear when I do this (they should be overlaying the header image). Here's the code for the header.php file:
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<!-- Preloader -->
<?php get_template_part( 'templates/header/preloader' ); ?>
<!-- Page Wrapper -->
<div id="page-wrap">
<!-- Boxed Wrapper -->
<div id="page-header" <?php echo esc_attr(ashe_options( 'general_header_width' )) === 'boxed' ? 'class="boxed-wrapper"': ''; ?>>
<?php
// Top Bar
get_template_part( 'templates/header/top', 'bar' );
// Page Header
get_template_part( 'templates/header/page', 'header' );
// Main Navigation
get_template_part( 'templates/header/main', 'navigation' );
?>
</div><!-- .boxed-wrapper -->
<!-- Page Content -->
<div id="page-content">
<?php get_template_part( 'templates/sidebars/sidebar', 'alt' ); // Sidebar Alt ?>
To get the slider into the correct location I need to replace the code underneath //Page Header with the code that Meta Slider provides. The Problem, I think, is that it's replacing the Header Template. So, I've looked at the php for the header template as well, but I'm not sure what, if anything, I might do in there to fix the issue. Here's the header template code:
<div class="entry-header">
<div class="cv-outer">
<div class="cv-inner">
<div class="header-logo">
<?php
if ( has_custom_logo() ) :
$custom_logo_id = get_theme_mod( 'custom_logo' );
$custom_logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php esc_attr( bloginfo('name') ); ?>" class="logo-img">
<img src="<?php echo esc_url( $custom_logo[0] ); ?>" alt="<?php esc_attr( bloginfo('name') ); ?>">
</a>
<?php else : ?>
<?php echo bloginfo( 'title' ); ?>
<?php endif; ?>
<br>
<p class="site-description"><?php echo bloginfo( 'description' ); ?></p>
</div>
</div>
</div>
</div>
Any ideas as to how I might go about fixing this would be much appreciated!!
Have you try to give position:relative; z-index:9999;//z-index number depends to your logo and description?
My page is bewitcheryinc.com
I am trying to re-arrange my home page. I need to switch the promotional area (section with 3 rectangles) with the text below it. I need to have the text displayed first and then the promotional area (section with 3 rectangles). I have contacted theme support, and they told me that the content is dynamic and the only solution to try is to replace header.php with the following code.
<?php
/**
* Displays the header content
*
* #package Theme Freesia
* #subpackage Edge
* #since Edge 1.0
*/
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<?php
$edge_settings = edge_get_theme_options(); ?>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="page" class="hfeed site">
<!-- Masthead ============================================= -->
<header id="masthead" class="site-header">
<?php if ( function_exists( 'the_custom_header_markup' ) ) {
if ( is_header_video_active() && ( has_header_video() || is_customize_preview() ) ) {
echo '<div class="custom-header">
<div class="custom-header-media">';
the_custom_header_markup();
echo '</div>
</div>';
}else{
if ( has_header_image() ) {?>
<img src="<?php header_image(); ?>" class="header-image" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="<?php echo esc_attr(get_bloginfo('name', 'display'));?>" />
<?php }
}
} else { ?>
<img src="<?php header_image(); ?>" class="header-image" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="<?php echo esc_attr(get_bloginfo('name', 'display'));?>" />
<?php } ?>
<div class="top-header">
<div class="container clearfix">
<?php
if( is_active_sidebar( 'edge_header_info' )) {
dynamic_sidebar( 'edge_header_info' );
}
if($edge_settings['edge_top_social_icons'] == 0):
echo '<div class="header-social-block">';
do_action('social_links');
echo '</div>'.'<!-- end .header-social-block -->';
endif;
do_action('edge_site_branding'); ?>
</div> <!-- end .container -->
</div> <!-- end .top-header -->
<!-- Main Header============================================= -->
<div id="sticky_header">
<div class="container clearfix">
<h3 class="nav-site-title">
<?php bloginfo('name');?>
</h3>
<!-- end .nav-site-title -->
<!-- Main Nav ============================================= -->
<?php
if (has_nav_menu('primary')) { ?>
<?php $args = array(
'theme_location' => 'primary',
'container' => '',
'items_wrap' => '<ul id="primary-menu" class="menu nav-menu">%3$s</ul>',
); ?>
<nav id="site-navigation" class="main-navigation clearfix">
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false">
<span class="line-one"></span>
<span class="line-two"></span>
<span class="line-three"></span>
</button>
<!-- end .menu-toggle -->
<?php wp_nav_menu($args);//extract the content from apperance-> nav menu ?>
</nav> <!-- end #site-navigation -->
<?php } else {// extract the content from page menu only ?>
<nav id="site-navigation" class="main-navigation clearfix">
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false">
<span class="line-one"></span>
<span class="line-two"></span>
<span class="line-three"></span>
</button>
<!-- end .menu-toggle -->
<?php wp_page_menu(array('menu_class' => 'menu', 'items_wrap' => '<ul id="primary-menu" class="menu nav-menu">%3$s</ul>')); ?>
</nav> <!-- end #site-navigation -->
<?php }
$search_form = $edge_settings['edge_search_custom_header'];
if (1 != $search_form) { ?>
<div id="search-toggle" class="header-search"></div>
<div id="search-box" class="clearfix">
<?php get_search_form();?>
</div> <!-- end #search-box -->
<?php }
echo '</div> <!-- end .container -->
</div> <!-- end #sticky_header -->';
$enable_slider = $edge_settings['edge_enable_slider'];
edge_slider_value();
if ($enable_slider=='frontpage'|| $enable_slider=='enitresite'){
if(is_front_page() && ($enable_slider=='frontpage') ) {
if($edge_settings['edge_slider_type'] == 'default_slider') {
edge_page_sliders();
}else{
if(class_exists('Edge_Plus_Features')):
edge_image_sliders();
endif;
}
}
if($enable_slider=='enitresite'){
if($edge_settings['edge_slider_type'] == 'default_slider') {
edge_page_sliders();
}else{
if(class_exists('Edge_Plus_Features')):
edge_image_sliders();
endif;
}
}
} ?>
</header> <!-- end #masthead -->
<!-- Main Page Start ============================================= -->
<div id="content">
<div class="container clearfix">
<?php
if(is_front_page()){
if( have_posts() ) {
while( have_posts() ) {
the_post();
get_template_part( 'content', get_post_format() );
}
} else { ?>
<h2 class="entry-title"> <?php esc_html_e( 'No Posts Found.', 'edge' ); ?> </h2>
<?php }
do_action('edge_display_frontpage_features');
}
if(!is_home()){?>
<div class="page-header">
<h1 class="page-title"><?php echo edge_header_title(); ?></h1>
<!-- .page-title -->
<?php edge_breadcrumb(); ?>
<!-- .breadcrumb -->
</div>
<!-- .page-header -->
<?php }
After I replace headr.php, I have to add the following css:
.home .entry-header, .home .entry-meta, section#post-417, .home .entry-footer {
display:none;
}
When I follow these instructions, the home page displays my original page text as a blog post with "read more" tags, along with the meta tags. The read more link links back to the home page. I simply want the front page to display my page title, some text, and then the promotional picture boxes.
If it is helpful, I beleive that when promotional area is turned on, the theme uses front-page-feature.php template instead of an index page. It is bellow.
<?php
function edge_frontpage_features(){
$edge_settings = edge_get_theme_options();
if($edge_settings['edge_disable_features'] != 1){
$edge_features = '';
$edge_total_page_no = 0;
$edge_list_page = array();
for( $i = 1; $i <= $edge_settings['edge_total_features']; $i++ ){
if( isset ( $edge_settings['edge_frontpage_features_' . $i] ) && $edge_settings['edge_frontpage_features_' . $i] > 0 ){
$edge_total_page_no++;
$edge_list_page = array_merge( $edge_list_page, array( $edge_settings['edge_frontpage_features_' . $i] ) );
}
}
if ( !empty( $edge_list_page ) && $edge_total_page_no > 0 ) {
echo '<!-- Promotional Area ============================================= -->';
$edge_features .= '<div class="promonational-area">';
$get_featured_posts = new WP_Query(array(
'posts_per_page' => $edge_settings['edge_total_features'],
'post_type' => array('page'),
'post__in' => $edge_list_page,
'orderby' => 'post__in',
));
$edge_features .= '<div class="column clearfix">';
$j = 1;
while ($get_featured_posts->have_posts()):$get_featured_posts->the_post();
$attachment_id = get_post_thumbnail_id();
$image_attributes = wp_get_attachment_image_src($attachment_id,'pixgraphy_promotional_image');
$excerpt = get_the_excerpt();
$edge_features .= '<div class="three-column">';
if ($image_attributes) {
$edge_features .= '<div class="promonational-img" title="'.the_title('', '', false).'"' .' style="background-image:url(' ."'" .esc_url($image_attributes[0])."'" .')"> <a class="promonational-link" href="'.get_the_permalink().'"></a> ';
$edge_features .= '<div class="promonational-overlay">
<h4>'.get_the_title().'</h4></div></div>';
}
$edge_features .='</div><!-- end .three-column -->';
$j++;
endwhile;
$edge_features .='</div><!-- .end column-->';
$edge_features .='</div><!-- end .promonational-area -->';
}
echo $edge_features;
}
wp_reset_postdata();
}
add_action('edge_display_frontpage_features','edge_frontpage_features');
Can anyone help? I am not proficient obviously in PHP/WordPress at all. Thank you!
I think this would work:
In index.php move the
if(is_front_page()){
do_action('edge_display_frontpage_features');
}
right before
get_template_part( 'pagination', 'none' );
in header.php.
This would put the front-page feature after the 'main' content in the primary section of the post. Now you need to figure out how to put the right post content for the text. Currently it seems like it's not fetching the correct post type. It's probably the sample post in the post post type.
But is the text supposed to be static or changes with your recently posted content? If its supposed to static, you should go in Settings->Reading in the admin dashboard and set the front-page to a static page and then you can put in the text into that page content.
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 5 years ago.
I'm new here and I'm not sure how to properly ask this question.My goal is to change href for my logo in wordpress, there's no easy setting within wordpress so I decided to change code itself. error that I got is "Parse error: syntax error, unexpected '<' in /home/gtacontr/public_html/mississaugacardetailing.ca/blog/wp-content/themes/publisherly/header.php on line 38". Below is my code, can someone please tell me why I got this error and how can I fix it
<?php
/**
* The header for our theme
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* #link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* #package Publisherly
*/
?><!DOCTYPE html>
<html class="no-js" <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'publisherly' ); ?></a> <!-- add this reference in code -->
<header id="masthead" class="site-header" role="banner">
<div class="header-wrapper">
<div class="site-branding">
<a href="http://www.mississaugacardetailing.ca">
//<?php
// Display the Custom Logo
<img width="2000" height="666" src="http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo.png" class="custom-logo" alt="" itemprop="logo" srcset="http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo.png 2000w, http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo-300x100.png 300w, http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo-768x256.png 768w, http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo-1024x341.png 1024w" sizes="(max-width: 2000px) 100vw, 2000px"></a>
/* if ( has_custom_logo() ) {
the_custom_logo();
} else {
if ( is_front_page() && is_home() ) : ?>
</a>
<h1 class="site-title"> rel="home"><?php bloginfo( 'name' ); ?></h1>
<?php else : ?>
<p class="site-title"> rel="home"><?php bloginfo( 'name' ); ?></p>
<?php endif;
}
?> */
</div><!-- .site-branding -->
<?php if ( has_nav_menu( 'primary' ) ) : ?>
<a id="menu-toggle" class="menu-toggle" href="#"><!-- <i class="fa fa-bars"></i>--> <?php _e( 'Menu', 'publisherly' ); ?></a>
<div id="site-header-menu" class="site-header-menu">
<?php if ( has_nav_menu( 'primary' ) ) : ?>
<nav id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Primary Menu', 'publisherly' ); ?>">
<?php
wp_nav_menu( array(
'theme_location' => 'primary',
'menu_class' => 'primary-menu',
) );
?>
</nav><!-- .main-navigation -->
<?php endif; ?>
</div><!-- .site-header-menu -->
<?php endif; ?>
</div><!-- /header-wrapper -->
</header><!-- .site-header -->
You should comment it this way
<!--?php // Display the Custom Logo -->
<img width="2000" height="666" src="..." sizes="(max-width: 2000px) 100vw, 2000px"></a>
<!-- if ( has_custom_logo() ) {
the_custom_logo();
} else {
if ( is_front_page() && is_home() ) : ?>
</a>
<h1 class="site-title"> rel="home"><?php bloginfo( 'name' ); ?></h1>
<!--?php else : ?>
<p class="site-title"> rel="home"><?php bloginfo( 'name' ); ?></p>
<?php endif;
}
?-->
If you notice I just changed the tags so <?php becomes <!--?php and ?> becomes ?-->. This is just a personal prefrenace because it helps me remember where things are, if you left the PHP tags intact they would work as PHP but the output would be inside a comment. I do the same with HTML such as:
<!-- form id="myfrom" action="" >
</form -->
NOTE That said if this is a live site, I might just leave the PHP alone, as you don't want that code displaced in the source for the page.
Here is a sand box that shows what you have wrong sandbox
Cheers.
You need to change near to "" tag inside anchor() tag and make sure you need to comment it or you need to remove this tag if not need. and also remove anchor tag after image tag. please see below code.
<a href="http://www.mississaugacardetailing.ca">
<!--?php
// Display the Custom Logo
?-->
<img width="2000" height="666" src="http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo.png" class="custom-logo" alt="" itemprop="logo" srcset="http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo.png 2000w, http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo-300x100.png 300w, http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo-768x256.png 768w, http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo-1024x341.png 1024w" sizes="(max-width: 2000px) 100vw, 2000px">
<!--?php /* if ( has_custom_logo() ) {
the_custom_logo();
} else {
if ( is_front_page() && is_home() ) : ?-->
</a>
So, I'm working on my website, in Wordpress. To say on the beggining, I'm no php coder, I just stambled on this thing working on my wordpress website. I bought a theme and installed Simple Language Switcher plugin. It works but I don't know how to place it where I want. I tried it everywhere in my header.php file but no luck. You can see in the image below where it is right now and where I want it (right, where I wrote HERE). And the link for the plugin:
http://www.mendoweb.be/blog/wordpress-plugin-simple-language-switcher/
This is the code for my language bar:
<?php if( function_exists( 'simple_language_switcher' ) ) { ?>
<div id="simple-language-switcher"><?php simple_language_switcher(); ?></div>
<?php } ?>
Here's my header.php file right now:
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <main id="main">
*
* #package Terrifico
*/
?><!DOCTYPE html>
<!--[if IE 7]>
<html class="ie ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 7) | !(IE 8) ]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<?php global $data; ?>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php if ($data['enable_favicon'] == 1 ) { ?>
<link rel="shortcut icon" href="<?php echo $data['favicon']; ?>" type="image/x-icon" />
<?php } ?>
<?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php terrifico_custom_styling(); ?>
<?php wp_head(); ?>
<?php if ($data['custom_css'] <> "") { ?>
<style type="text/css">
<?php echo $data['custom_css']; ?>
</style>
<?php } ?>
</head>
<body <?php body_class(); ?>>
<div id="grid-container">
<?php if ( $data['top_panel_enable'] == 1 ) { get_template_part( 'top-panel' ); }; ?>
<?php if( function_exists( 'simple_language_switcher' ) ) { ?>
<div id="simple-language-switcher"><?php simple_language_switcher(); ?></div>
<?php } ?>
<div class="clear"></div>
<div id="branding" class="<?php echo $data['layout']; ?>">
<header id="header">
<div id="logo">
<?php if ( $data['text_logo_enable'] != 1 ) { ?>
<img src="<?php echo $data['logo']; ?>" alt="<?php echo $data['logo_alt_text']; ?>"/>
<?php } else { ?>
<?php echo $data['logo_alt_text']; ?>
<?php } ?>
</div>
<?php if ( $data['menu_separated'] != 1 ) { ?>
<div id="nav-holder">
<nav id="site-navigation-in" class="main-navigation" role="navigation">
<?php wp_nav_menu(array('theme_location' => 'main_navigation', 'container' => false,'menu_id'=>'menu-main-navigation','menu_class' => 'sf-menu sf-js-enabled sf-shadow', 'fallback_cb'=> 'terrifico_selectmenu', )); ?>
</nav><!--site-navigation-->
</div>
<?php } ?>
<script type="text/javascript">
var sf=jQuery.noConflict();
sf(window).load(function(){
// superFish
sf('ul.sf-menu').supersubs({
minWidth: 16, // minimum width of sub-menus in em units
maxWidth: 40, // maximum width of sub-menus in em units
extraWidth: 1 // extra width can ensure lines don't sometimes turn over
})
.superfish(); // call supersubs first, then superfish
});
</script>
</div><!--branding-->
<?php if ( $data['menu_separated'] == 1 ) { ?>
<div id="nav-holder" class="<?php echo $data['layout']; ?>">
<nav id="site-navigation" class="main-navigation" role="navigation">
<?php wp_nav_menu(array('theme_location' => 'main_navigation', 'container' => false,'menu_id'=>'menu-main-navigation','menu_class' => 'sf-menu sf-js-enabled sf-shadow', 'fallback_cb'=> 'terrifico_selectmenu', )); ?>
</nav><!--site-navigation-->
</div>
<?php } ?>
<?php if ( $data['front_page_blog_index'] == 1 ) {?>
<?php if (! is_home()) { ?>
<?php if ( $data['page_header_on'] == 1 ) { ?>
<?php get_template_part( 'page-header' ); ?>
<?php } ?>
<?php } ?>
<?php } else { ?>
<?php if ( $data['page_header_on'] == 1 ) { ?>
<?php get_template_part( 'page-header' ); ?>
<?php } ?>
<?php } ?>
The file you need to edit is top-panel.php, in the same directory as header.php. It contains the expanded PHP code for that part of the header in your theme. You can see where it's referenced in header.php here, just above where you currently have the language bar code:
<?php if ( $data['top_panel_enable'] == 1 ) { get_template_part( 'top-panel' ); }; ?>
It's increasingly common for WordPress themes, when their designers want to keep everything tidy, to have usual theme parts like header.php, footer.php, etc. divided even further into sub-files. In other words, top-panel.php is to header.php, like header.php is to index.php.
First, back up any files you edit, then carefully insert the language bar code in top-panel.php so the file looks something like this:
<?php
/**
* #package Terrifico
*/
global $data; ?>
<div id="top-panel" class="<?php echo $data['layout']; ?>">
<div id="info-box">
<?php if ( $data['top_contact_enable'] == 1 ) { get_template_part( 'contact-bar' ); }; ?>
<?php if(class_exists('Woocommerce')) { ?>
<?php if ( $data['header_social_enable'] == 1 && $data['shopping_cart_enable'] == 0 ) { get_template_part( 'social-bar' ); }; ?>
<?php if ( $data['shopping_cart_enable'] == 1 ) { get_template_part( 'shopping-cart' ); } ;?>
<?php } else { ?>
<?php if ( $data['header_social_enable'] == 1 ) { get_template_part( 'social-bar' ); }; ?>
<?php } ?>
/* INSERT LANGUAGE BAR CODE */
<?php if( function_exists( 'simple_language_switcher' ) ) { ?>
<div id="simple-language-switcher"><?php simple_language_switcher(); ?></div>
<?php } ?>
/* END LANGUAGE BAR CODE */
</div><!-- #info-box -->
</div><!-- #top-panel -->
Basically, you want the language bar code to be inside the top-panel <div>. That's the div that contains the other divs for "Have any questions?", social icons, etc.
I don't actually have the theme installed to experiment with right now, but you'll probably have to play a little with the CSS or the code above to get it positioned perfectly. Hope I explained it clearly enough and that this helps.
so I am building a custom wordpress theme for a client (I am a freelancer, pretty new to wordpress) and I have built the main theme that works 100% on the home page, but when I go into a post, archive, etc, the image path breaks, the sidebar breaks. I have attached photos for you to see:
And this is what the post looks like:
======== code edit =======
header.php:
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>" />
<?php if (is_search()) { ?>
<meta name="robots" content="noindex, nofollow" />
<?php } ?>
<title>
<?php
if (function_exists('is_tag') && is_tag()) {
single_tag_title("Tag Archive for ""); echo '" - '; }
elseif (is_archive()) {
wp_title(''); echo ' Archive - '; }
elseif (is_search()) {
echo 'Search for "'.wp_specialchars($s).'" - '; }
elseif (!(is_404()) && (is_single()) || (is_page())) {
wp_title(''); echo ' - '; }
elseif (is_404()) {
echo 'Not Found - '; }
if (is_home()) {
bloginfo('name'); echo ' - '; bloginfo('description'); }
else {
bloginfo('name'); }
if ($paged>1) {
echo ' - page '. $paged; }
?>
</title>
<link rel="shortcut icon" href="/favicon.ico">
<link rel="stylesheet" type="text/css" href="wp- content/themes/custom1/css/reset.css" />
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
<!-- HTML 5 shiv -->
<!--[if lt IE 9]>
<script src="dist/html5shiv.js"></script>
<![endif]-->
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>">
<?php if ( is_singular() ) wp_enqueue_script('comment-reply'); ?>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="page-wrap">
<section id="header">
<div id="logo"></div>
<div id="nav">
<div class="wrapper">
<nav>
<ul>
<!-- <li>Home</li>
<li>About Us</li>
<li>FAQ's</li>
<li>Contact Us</li> -->
<?php wp_nav_menu(array('menu' => 'Main Nav Menu')); ?>
</ul>
</nav>
<div class="clear"></div>
</div>
</div>
</section> <!-- end of Header -->
<section id="page">
<div class="wrapper">
index.php:
<?php get_header(); ?>
<section id="main_content">
<article>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?> </h2>
<?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
<div class="entry">
<?php the_content(); ?>
</div>
<div class="postmetadata">
<?php the_tags('Tags: ', ', ', '<br />'); ?>
Posted in <?php the_category(', ') ?> |
<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
</div>
</div>
<?php endwhile; ?>
<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
<?php else : ?>
<h2>Not Found</h2>
<?php endif; ?>
</article>
</section>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
and page.php (the buggy one):
<?php get_header(); ?>
<section id="main_content">
<article>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
<div class="entry">
<?php the_content(); ?>
<?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
</div>
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
</div>
<?php // comments_template(); ?>
<?php endwhile; endif; ?>
</article>
</section>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
sorry for the long post :)
So I found the answer after alot of searching in a random blog post (I forgot where, sorry).
What I was doing: the image only worked on the homepage and no other page if I put the link to the image as: wp-content/themes/[mytheme]/images/image.jpg
and it worked on all other pages but not the home page when I put the following: ../wp-content/themes/[mytheme]/images/image.jpg
<?php bloginfo('template_directory'); ?>/images/image1.jpg
So thank you to Nicholas King, George Marques, Domdev and Scott Simpson for putting me on the right track.
Thanks,
Josh