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.

    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?