doraemon0769 2015-02-25 19:28
浏览 116

如何自定义Wordpress主题标题以更改布局?

I am using the latest version of the Avada theme. I would like to place full-width content (a simple shortcode) in the header area of a page that has sidebars enabled. However, I have found that the theme does not allow you to have full-width content (aside from built-in options like the slide, menu, artwork, etc.), with a page that has sidebars enabled.

A moderator on their user forum wrote this in regards to this limitation:

Going by your screenshot you will have to create a custom solution for that. (referring to the full width section above the page and sidebar content, based on your screenshot) – that would mean creating a std page in WP and then in the header file using PHP to call that page and it's content into position:

    <?php if ( is_front_page() ) { $subPageHeader = new WP_Query("page_id=25″); >while($subPageHeader->have_posts()) : $subPageHeader->the_post(); ?>

This is just a head start.

Here is the screenshot he's referring to: http://i.stack.imgur.com/jHRdn.jpg

The four content items: Our Issues, Our Contract, Opportunities, Q&A is what I'm trying to add.

Unfortunately I only got a partial explanation and am humbly asking for the community's help on achieving this. Thanks in advance.

  • 写回答

1条回答 默认 最新

  • douxi4114 2015-02-25 23:04
    关注

    As the moderator said you can make other page and design it as you want and call it into your header.php . It's so simple just make your page by .php format witch it start with:

    <?php
    

    and ends with:

    ?>
    

    then call it like this:

    <?php get_template_directory_uri(); ?>
    

    or

    <?php echo get_template_directory_uri(); ?>
    

    or even you can call it by functions.php like this:

    <?php
    function my_scripts_method() {
        wp_enqueue_script(
            'custom_script',
            get_template_directory_uri() . '/js/custom_script.js',
            array('jquery')
        );
    }
    add_action('wp_enqueue_scripts', 'my_scripts_method');
    ?>
    

    Just remember to do not call header and footer into your page cause you no want double header into each other.

    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)