Php WordPress页面模板删除侧栏
使用儿童主题版本的野心。由于某种原因,侧边栏显示在底部。如何编辑子主题或页面模板以使侧边栏不显示 以下是指向实时示例的链接: 以下是页面模板代码:Php WordPress页面模板删除侧栏,php,css,wordpress,wordpress-theming,Php,Css,Wordpress,Wordpress Theming,使用儿童主题版本的野心。由于某种原因,侧边栏显示在底部。如何编辑子主题或页面模板以使侧边栏不显示 以下是指向实时示例的链接: 以下是页面模板代码: <?php /* Template Name: SQ w Img 2step */ ?> <?php /** * This file displays page with no sidebar. * * @package Theme Horse * @subpackage Ambition * @since Ambitio
<?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">
<a href="#"><img src="http://businessblessed.com/wp-content/themes/virtue-child/squeeze-page-w-prodImage-2step-optin/img/book.png" alt="book" /></a>
</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"><a href="#">Legal Information</a></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>
赠品
document.documentElement.className=document.documentElement.className.replace('no-js','js');
您的信息是100%安全的,永远不会与任何人共享
App.run({})
我还在父主题中发现了一个“无侧边栏”模板,但我不确定它是否可以应用
<?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' );
?>
调试内容()
var_dump(内容())编码>并检查侧栏数据
而且你也做错了,只有正文后的数据你才必须写在模板文件中。每个WordPress主题都提供了带有侧边栏的页面模板,也没有侧边栏
在这里,您可以很容易地使用没有侧栏的页面模板,只需将其复制到侧栏中即可,这将是正确的方法
通常WordPress使用get_sidebar()函数来显示侧边栏,因此请检查并将其从模板中删除,或者可以使用如下挂钩:
如果添加到子主题的functions.php文件中,这将删除TwentyTen主题注册的页脚侧栏
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 );
如果这不起作用,那么您可以简单地使用css隐藏侧边栏,方法是在中使用body类,这样侧边栏将仅对特定页面隐藏,例如:
.sales_page aside {
display : none;
}
但这肯定是最后一个选项。“调试_content()变量_dump(the_content());并检查侧栏数据,”我不知道这意味着什么。我不会说PHP。