为WordPress的论文主题添加压缩页面,并为论文1.8添加自定义过滤器,使其具有不同的侧面
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了为WordPress的论文主题添加压缩页面,并为论文1.8添加自定义过滤器,使其具有不同的侧面相关的知识,希望对你有一定的参考价值。
The following code for a landing page — without header, original sidebars and footer and with new sidebars added — goes in custom_functions.php. This code does the following to pages with a custom field named “landing-pageâ€.adds a body class of “landing-pageâ€
removes the header, sidebars, and footer
registers 2 new sidebars called Landing Page 1 and Lading Page 2
builds the code for the new sidebars (note that an extra and are added because there’s no hook in between the end of #content and the end of #content_box)
then implements all of the above before Thesis loads. If you want a sidebar | content | sidebar arrangement, you’ll need different markup.
function custom_body_classes($classes) { $classes[] = "landing-page"; return $classes; } function custom_remove_defaults($content) { return false; } register_sidebars(2, array( 'name' => 'Landing Page %d', 'id' => 'landing-page-$i', 'before_widget' => '<li class="widget %2$s" id="%1$s">', 'after_widget' => '</li>', 'before_title' => '<h3>', 'after_title' => '</h3>' ) ); function landing_page_sidebar() { ?> </div> <!-- custom end #content --> <div id="sidebars"> <div id="sidebar_1" class="sidebar"> <ul class="sidebar_list"> <?php thesis_default_widget('landing-page-1'); ?> </ul> </div> <div id="sidebar_2" class="sidebar"> <ul class="sidebar_list"> <?php thesis_default_widget('landing-page-2'); ?> </ul> </div> </div> <div> <!-- balance out #content divs --> <?php } function apply_custom_filters() { global $wp_query; $landing = get_post_meta($wp_query->post->ID, 'landing-page', true); if ($landing) { // remove unwanted sections add_filter('thesis_show_header', 'custom_remove_defaults'); add_filter('thesis_show_sidebars', 'custom_remove_defaults'); add_filter('thesis_show_footer', 'custom_remove_defaults'); //add custom body class add_filter('thesis_body_classes','custom_body_classes'); // add new sidebars add_action('thesis_hook_after_content','landing_page_sidebar'); } } add_action('template_redirect','apply_custom_filters'); /* Remove this for one sidebar only <div id="sidebar_2" class="sidebar"> <ul class="sidebar_list"> <?php thesis_default_widget('landing-page-2'); ?> </ul> </div> */
以上是关于为WordPress的论文主题添加压缩页面,并为论文1.8添加自定义过滤器,使其具有不同的侧面的主要内容,如果未能解决你的问题,请参考以下文章
为WordPress的论文主题添加压缩页面,并使用论文1.8的自定义过滤器
为WordPress的论文主题添加多个压缩页面,并使用论文1.8的自定义过滤器