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

图片转代码服务由CSDN问答提供 功能建议

在我的Wordpress网站上使用Genesis框架和杂志专业主题我试图在顶部添加一个小部件 内容中的主页,因此它不在侧边栏上方。 我尝试过以下方法:

  add_action('genesis_before_content','before_home_top'); 
   
 
 

给出

 &lt; div class =“content-sidebar-wrap”&gt; 
&lt; div class =“before-home-top”&gt; 
&lt; / div&gt; \  n&lt; main class =“content”&gt; 
&lt; / main&gt; 
&lt; aside class =“sidebar”&gt; 
&lt; / aside&gt; 
&lt; / div&gt; 
   \  n 
 

哪个不起作用,因为它超出了内容和边栏按下侧边栏。

  add_action('genesis_after_content','before_home_top')  ; 
   
 
 

给出

 &lt; div class =“content-sidebar-wrap”&gt; 
&lt;  main class =“content”&gt; 
&lt; / main&gt; 
&lt; aside class =“sidebar”&gt; 
&lt; / aside&gt; 
&lt; div class =“before-home-top”&gt; 
&lt; /  div&gt; 
&lt; / div&gt; 
   
 
 

基本上从这张图片中我想要第二个小部件区域而不是第一个全宽小部件区域。 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!

    点赞 打赏 评论

相关推荐 更多相似问题