0

我正在尝试添加自定义页面模板以仅显示特定页面的一个侧边栏。

我在论文文件夹中创建了一个模板页面,我把这些行

<?php echo thesis_header(); ?>
<?php echo thesis_nav_menu(); ?>
    <div id="custom-page">
        <div class="content-column">
            <?php echo thesis_content(); ?>
        </div>
        <div class="sidebars">
            <?php echo thesis_sidebar_1(); ?>
        </div>
    </div>
<?php echo thesis_footer_area(); ?>

我在教程中找到了这段代码,但是当我用这个模板打开任何页面时,页面没有正确显示。因为所有<head></head>部分都丢失了。thesis_header()函数不带 html 页面的部分。

我的问题; 如何像thesis_html_framework()一样添加所有这些部分?

谢谢..

4

2 回答 2

0

我找不到合理的方法,我决定用 jQuery 修改结构。这是仅显示一个侧边栏的自定义模板文件。我不知道完美的解决方案,但它挽救了一天。

    <?php
    /**
     * Template Name: Custom - One Sidebar Template
     *
     * A custom template for use with Thesis theme for creating pages that add a left sidebar.
     *  DO NOT EDIT THIS FILE. Instead, use the thesis_hook_custom_template() hook in custom/places_template_functions.php
     *
     * @package Thesis
     */
    add_action('thesis_hook_after_html', 'set_one_sidebar');

    thesis_html_framework();

    function set_one_sidebar(){
        ?>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
        <!--
        $(document).ready(function(){
            $('#sidebar_2').hide();
            $('#sidebars').css('width', '230px');
            $('#content').css('width', '718px');
            $('#content_box').css('background-position', '715px');
        });
        //-->
        </SCRIPT>
        <?php
    }
?>
于 2011-10-15T16:05:30.827 回答
0

你有没有找到更好的解决方案?我花了一两天的时间试图找出如何重建论文框架,这样我就可以为少数几个页面调整网站的宽度。在我尝试(成功)调用框架函数后覆盖 css 后,最终使用了您的修复程序。

就像是:

thesis_html_framework();
<style> css stuff </style> 

在身体的末端被扔掉,可能也不是一个好的解决方案。

于 2012-03-30T00:33:24.630 回答