WordPress Page Template Remove Sidebar - php

Using a child theme version of Ambition. For some reason the sidebar is displaying at the bottom. How do I edit the child theme or page template to make the sidebar not display.
Here is the link to the live example: http://businessblessed.com/specialoffers/sales-pages/
Here is the page template code:
<?php
/*
Template Name: SQ w Img 2step
*/
?>
<?php
/**
* This file displays page with no sidebar.
*
* #package Theme Horse
* #subpackage Ambition
* #since Ambition 1.0
*/
?>
<!DOCTYPE html>
<!--[if IE 7 ]> <html lang="cs" class="ie7 no-js"> <![endif]-->
<!--[if IE 8 ]> <html lang="cs" class="ie8 no-js"> <![endif]-->
<!--[if IE 9 ]> <html lang="cs" class="ie9 no-js"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="cs" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]-->
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; minimum-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<title>GiveAway</title>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,400italic,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://businessblessed.com/wp-content/themes/virtue-child/squeeze-page-w-prodImage-2step-optin/css/style.css?v=1" media="screen, projection" />
<link rel="stylesheet" href="http://businessblessed.com/wp-content/themes/virtue-child/squeeze-page-w-prodImage-2step-optin/css/print.css?v=1" media="print" />
<link rel="shortcut icon" href="./favicon.ico" />
<script>document.documentElement.className = document.documentElement.className.replace('no-js', 'js');</script>
</head>
<body class="page-subpage">
<div id="main">
<div class="row-main">
<div class="col col-book">
<img src="http://businessblessed.com/wp-content/themes/virtue-child/squeeze-page-w-prodImage-2step-optin/img/book.png" alt="book" />
</div>
<div class="col col-content">
<div class="in">
<p class="read-this"><?php single_post_title(); ?></p>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php the_content( ); ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>​
</div>
</form>
<p class="secure">Your Information is 100% Secure And Will Never Be Shared With Anyone.</p>
<p class="legal">Legal Information</p>
</div>
</div>
</div>
</div>
<!--[if lte IE 8 ]>
<img src="http://businessblessed.com/wp-content/themes/virtue-child/squeeze-page-w-prodImage-2step-optin/img/bg.jpg" alt="" class="bg-ie" />
<![endif]-->
<script src="http://businessblessed.com/wp-content/themes/virtue-child/squeeze-page-w-prodImage-2step-optin/js/jquery.js?v=1"></script>
<script src="http://businessblessed.com/wp-content/themes/virtue-child/squeeze-page-w-prodImage-2step-optin/js/app.js?v=1"></script>
<script>
App.run({})
</script>
</body>
</html>
I also found a "no sidebar" template inside the parent theme, but I am not sure if it can be applied.
<?php
/**
* This file displays page with no sidebar.
*
* #package Theme Horse
* #subpackage Ambition
* #since Ambition 1.0
*/
?>
<?php
/**
* ambition_before_loop_content
*
* HOOKED_FUNCTION_NAME PRIORITY
*
* ambition_loop_before 10
*/
do_action( 'ambition_before_loop_content' );
/**
* ambition_loop_content
*
* HOOKED_FUNCTION_NAME PRIORITY
*
* ambition_theloop 10
*/
do_action( 'ambition_loop_content' );
/**
* ambition_after_loop_content
*
* HOOKED_FUNCTION_NAME PRIORITY
*
* ambition_next_previous 5
* ambition_loop_after 10
*/
do_action( 'ambition_after_loop_content' );
?>

Debug the_content()
var_dump(the_content()); and check for sidebar data,
Also You are doing wrong, Only the data after the body you have to write in template file.

Every WordPress theme provides page template with sidebar as well as no sidebar.
Here you can easily use the page template with no sidebar by copying it in your sidebar for your purpose and this will be the right way.
Normally WordPress uses get_sidebar() function to display sidebar so check and remove it from your template or can work with hooks like:
If added to a child theme's functions.php file, this will remove the footer sidebars registered by the TwentyTen theme.
function remove_some_widgets(){
// Unregister some of the TwentyTen sidebars
unregister_sidebar( 'first-footer-widget-area' );
unregister_sidebar( 'second-footer-widget-area' );
}
add_action( 'widgets_init', 'remove_some_widgets', 11 );
If this doesn't work then you can simply hide the sidebar using css by taking the body class within so that the sidebar will be hidden for only specific page for example:
.sales_page aside {
display : none;
}
But surely this should be the last option.

Related

Why does my WordPress site title have a "-" in front of it?

I'm trying to update my site title to say "Welcome to Etheric City". I did this just simply in the wordpress site identity tab and it worked but I have a random dash ("-") in front of it now like the image here -->
The code in the header.php file doesn't show any dashes so was wondering what I'm missing? I entered in the site title manually and didn't copy and paste from anywhere. Header.php code below:
<?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 Signify
*/
?>
<!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 do_action( 'wp_body_open' ); ?>
<div id="page" class="site">
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'signify-music-dark' ); ?></a>
<header id="masthead" class="site-header">
<div class="site-header-main">
<div class="wrapper">
<?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
<?php get_template_part( 'template-parts/navigation/navigation', 'primary' ); ?>
</div><!-- .wrapper -->
</div><!-- .site-header-main -->
</header><!-- #masthead -->
<?php signify_sections(); ?>
<div id="content" class="site-content">
<div class="wrapper">
Any help is greatly appreciated!
Its display inside head or document section. You can remove using filter hook.
Reference : https://developer.wordpress.org/reference/hooks/document_title_separator/
/**
* Remove title whitespace.
*/
function modify_document_title_separator( $separator ) {
return "";
}
add_filter( 'document_title_separator', 'modify_document_title_separator', 10, 1 );

How do I change – (endash) to | (vertical bar) in my browser?

In the browser tab info of my site I want to replace the dash with a vertical line.
So instead of Site Name - Site Tagline it would be Site Name | Site Tagline. It would also be like that on category pages, for example right now it is Site Name - Site Category but I would like Site Name | Site Category. I am using the Goodlife theme but I have added the header.php below. Does anyone know how I could change this?
header.php
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_site_icon(); ?>
<?php
$header_style = ot_get_option('header_style', 'style1');
$general_boxed = (ot_get_option('general_boxed') == 'on' ? 'boxed' : '');
?>
<?php
/* Always have wp_head() just before the closing </head>
* tag of your theme, or you will break many plugins, which
* generally use this hook to add elements to <head> such
* as styles, scripts, and meta tags.
*/
wp_head();
?>
</head>
<body <?php body_class(); ?>>
<div id="wrapper" class="open">
<!-- Start Mobile Menu -->
<?php do_action( 'thb_mobile_menu' ); ?>
<!-- End Mobile Menu -->
<!-- Start Content Container -->
<section id="content-container">
<!-- Start Content Click Capture -->
<div class="click-capture"></div>
<!-- End Content Click Capture -->
<?php
get_template_part( 'inc/header/fixed' );
get_template_part( 'inc/header/subheader' );
get_template_part( 'inc/header/'.$header_style );
get_template_part( 'inc/header/pageskin' );
?>
<div role="main" class="<?php echo esc_attr($general_boxed); ?>">
According to this article, you need to add the following code inside functions.php:
function wploop_change_separator()
{
return '|';
}
add_filter('document_title_separator', 'wploop_change_separator');

How to align my social media button to the top right

I want to align the DISPLAY_ULTIMATE_PLUS social media buttons on the upper right corner. I tried several alignments methods but it won't seem to work. Here is the code.
<?php
/**
* The template for displaying the header
*
* Displays all of the head element and everything up until the
"site- content" div.
*
* #package WordPress
* #subpackage Twenty_Sixteen
* #since Twenty Sixteen 1.0
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?> class="no-js">
<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 if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php endif; ?>
<?php wp_head(); ?>
</head>
<?php echo DISPLAY_ULTIMATE_PLUS(); ?>
<?php echo do_shortcode("[huge_it_slider id='2']"); ?>
<div class='mailmunch-forms-widget-295732'></div>
Apply :
position: absolute;
top: 0;
right: 0;
on the media button, and position: relative; on a parent <div> relatively to which it will be aligned.
or
Apply:
position: fixed;
top: 0;
right: 0;
on the media button.
You can style your html inline, using style="".

wordpress custom text in header.php as page of edit field

I been creating a template from scratch in wordpress and now I have a template header with a image in it a text/ subheader text. And below that all some info text. What I want is that I can change that info text like a page or custom field in the backhand of wordpress.
This text as example I want to edit in the backhand : CUSTOM HEADER TEXT
see the code below:
<!doctype html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="nl" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="nl" > <!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><?php echo wp_title(' | ', false, 'right') . get_bloginfo(); ?></title>
<?php wp_head(); ?>
</head>
<body>
<header>
<div class="row">
<div class="large-12 columns">
<div class="large-12 columns">
<h1><?php bloginfo('name'); ?> <span class="description">| <?php bloginfo('description'); ?></span></h1>
</div>
<p>CUSTOM HEADER TEXT</p>
</div>
</div>
</div>
</header>
Just go to admin => Appearance => Widgets, Drag a text widget in any of your sidebar and put the text "CUSTOM HEADER TEXT" in the text widget and save it.
After that just go to your header file where you want to show this text and put this code snippet : <?php dynamic_sidebar( 'sidebar-1' ); ?> //here 1 is the id of your sidebar
Just check in front end, you will find the text but layout is a little different. To do this pixel perfect, go to your function.php file and search for your sidebar like "sidebar-1" and remove the extra divs from there.
Follow the above steps, you'll get what you want.

Parent pages not display on Wordpress site

I have made three pages on the back end of Wordpress (Work, Studio, CTHM+) but they don't seem to appear on the front end of the site:
http://www.cthm.co.uk/work/
The header.php file has been edited but I'm not sure if I am missing something vital.
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="main">
*
* #package WordPress
* #subpackage Twenty_Twelve
* #since Twenty Twelve 1.0
*/
?><!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>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?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 wp_head(); ?>
<script type="text/javascript" src="http://www.cthm.co.uk/wp-content/themes/child/scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="http://www.cthm.co.uk/wp-content/themes/child/scripts/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="http://www.cthm.co.uk/wp-content/themes/child/scripts/jquery.coda-slider-2.0.js"></script>
<script type="text/javascript">
$().ready(function() {
$(".slider1").codaSlider({dynamicArrows: false, dynamicTabs: false} );
$(".slider1 .coda-nav-right-wrapper").mouseover(function(){ $(".nav1").css("display", "block"); });
$(".slider1 .coda-nav-right-wrapper").mouseout(function(){ $(".nav1").css("display", "none"); });
$("#coda-nav-right-1 > a > .coda-nav-right-wrapper")
});
</script>
</head>
<body>
<div id="header">
<h1>
<a href="http://www.cthm.co.uk/work">
<img src="http://www.cthm.co.uk/wp-content/uploads/2013/02/logo2.png" alt="CTHM Logo" id="logo" width="140" height="44" />
</a>
<div id="contact-details">
26 Queen Anne Road, <br />
London, E9 7AH<br />
hello#cthm.co.uk
</div>
</h1>
</div>
<div id="content">
Your header is showing but your code is wrong. You need to add your script inside of a no conflict wrapper for it to work properly. And if you are going to add any type of javascript I would consider adding it to the functions.php section so that it enqueue's appropriately.
Reference: http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Link_a_Theme_Script_Which_Depends_on_jQuery
How to enqueue script: http://codex.wordpress.org/Function_Reference/wp_enqueue_script
Also if you plan to make a ton of changes to the twenty twelve theme, I would also consider understanding how to create a child theme based on the twenty twelve theme
http://codex.wordpress.org/Child_Themes

Categories