douyang5943 2019-07-19 18:07
浏览 31
已采纳

在内容中添加小部件

On my Wordpress site using the Genesis framework and magazine pro theme I'm trying to add a widget at the top of the homepage within the content so it's not above the sidebar. I've tried the following:

add_action( 'genesis_before_content', 'before_home_top' );

gives

<div class="content-sidebar-wrap">
<div class="before-home-top">
</div>
<main class="content">
</main>
<aside class="sidebar">
</aside>
</div>

Which doesn't work because it goes above both the content AND the sidebar pushing the sidebar down.

add_action( 'genesis_after_content', 'before_home_top' );

gives

<div class="content-sidebar-wrap">
<main class="content">
</main>
<aside class="sidebar">
</aside>
<div class="before-home-top">
</div>
</div>

Basically from this image I want the second widget area and not the first full width widget area. https://imgur.com/a/fl0OB5J

  • 写回答

1条回答 默认 最新

  • dongshi2141 2019-07-19 19:00
    关注

    I don't have access to the Genesis codebase to give you a direct answer, but according to this page you have some actions available.

    From that page:

    • genesis_before_content_sidebar_wrap
    • genesis_before_content
    • genesis_before_loop
    • genesis_loop
    • genesis_after_loop
    • genesis_after_content
    • genesis_after_content_sidebar_wrap

    Give those a try!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?