最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

filters - Override admin selected page layout

programmeradmin0浏览0评论

I'm using a Genesis child theme and I've set up a filter to force the full width layout when the sidebar is empty.

add_filter( 'genesis_pre_get_option_site_layout', 'crc_remove_empty_sidebar' );

function crc_remove_empty_sidebar( $opt ) {
if ( ! is_active_sidebar( 'primary-sidebar' ) ) {
    $opt = 'full-width-content'; 
    return $opt;
    } 
}

And that's working great except for if the admin manually selects a layout option when creating the post. When a layout option is manually selected, it takes precedent on Single pages.

Is there any way to make the filter I have override everything else, so that no matter what layout option is manually selected the filter forces the full width layout anyway?

I've been searching and trying different things but surprisingly I haven't been able to find much of anything.

发布评论

评论列表(0)

  1. 暂无评论