drphfy1198 2015-03-23 18:38
浏览 30
已采纳

Genesis Framework - 如何切换主钩子和侧边栏钩子顺序

I recently started using Genesis Framework and am still getting accustomed to the hooks used to create the layout.

The page I am designing uses the left sidebar as main navigation. It works great until it collapses on smaller screens; the sidebar goes to the bottom, below the main content.

I tried searching for a solution since it seems it may be something common, but no success.

The process that I think would solve it is to use remove_action to remove sidebar and main content to then bring them back with add_action in a different order. For this I need to know the exact name of the hooks and the order number (if specified).

Please let me know what you think would solve this and, if I am in the right track, how would you change the order.

  • 写回答

2条回答 默认 最新

  • doumou1864 2015-03-26 00:55
    关注

    Just in case you need, here's the answer to your question.

    This is how you remove the page content.

    remove_action( 'genesis_loop', 'genesis_do_loop' );
    

    This is how you remove the sidebar in a page.

    remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
    

    And this is the hooks before content and sidebar.

    genesis_before_content
    

    In your case let's use this codes in functions.php

    remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
    add_action( 'genesis_before_content', function(){
        echo '<aside class="sidebar sidebar-primary widget-area" role="complementary" itemscope="itemscope" itemtype="http://schema.org/WPSideBar">';
        echo genesis_do_sidebar();
        echo '</aside>';
    }, 2 );
    

    Hope this can help you in the future.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么