Опитвам се да добавя две нови странични ленти на моя уебсайт WordPress тук, едната отляво, а другата на вдясно, основното съдържание тогава ще бъде в средата. Оформяне на оформлението от три колони.
ИзползвамReady! За да бъде Темата сГотов! Плъгин за електронна търговияНаправих и детето, където направих повечето промени.
Проблемът е, че страничната лента не се показва на самия уебсайт. И когато преглеждате областта Widgets под менюто Appearance, зоната widget, която добавих, не се появява дори след като я регистрирах.
Това е кодът, който вмъкнах в front-page.php:
<?php get_sidebar('left'); ?>
<?php get_sidebar('right'); ?>
След това продължих да създавам два файла sidebar.php, а именно
sidebar-left.php, който има следния код
<?php
/**
* The Sidebar containing the main widget areas.
*
* @package Ready_ecommerce
* @since Ready_ecommerce 0.1
*/
?>
<div id="secondary" class="widget-area sidebar" role="complementary">
<?php do_action( 'before_sidebar' ); ?>
<?php if ( ! dynamic_sidebar( 'sidebar-6' ) ) : ?>
<aside id="search" class="widget widget_search">
<?php get_search_form(); ?>
</aside>
<aside id="archives" class="widget">
<h1 class="widget-title"><?php _e( 'Archives', 'ready_ecommerce' ); ?></h1>
<ul>
<?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
</ul>
</aside>
<aside id="meta" class="widget">
<h1 class="widget-title"><?php _e( 'Meta', 'ready_ecommerce' ); ?></h1>
<ul>
<?php wp_register(); ?>
<aside><?php wp_loginout(); ?></aside>
<?php wp_meta(); ?>
</ul>
</aside>
<?php endif; // end sidebar widget area ?>
</div><!-- #secondary .widget-area -->
<style type="text/css">
#content {
float: left;
}
</style>
sidebar-right.php с кода:
<?php
/**
* The Sidebar containing the main widget areas.
*
* @package Ready_ecommerce
* @since Ready_ecommerce 0.1
*/
?>
<div id="secondary-2" class="widget-area sidebar" role="complementary">
<?php do_action( 'before_sidebar' ); ?>
<?php if ( ! dynamic_sidebar( 'sidebar-5' ) ) : ?>
<aside id="search" class="widget widget_search">
<?php get_search_form(); ?>
</aside>
<aside id="archives" class="widget">
<h1 class="widget-title"><?php _e( 'Archives', 'ready_ecommerce' ); ?></h1>
<ul>
<?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
</ul>
</aside>
<aside id="meta" class="widget">
<h1 class="widget-title"><?php _e( 'Meta', 'ready_ecommerce' ); ?></h1>
<ul>
<?php wp_register(); ?>
<aside><?php wp_loginout(); ?></aside>
<?php wp_meta(); ?>
</ul>
</aside>
<?php endif; // end sidebar widget area ?>
</div><!-- #secondary .widget-area -->
<style type="text/css">
#content {
float: right;
width: 759px;
}
</style>
И последно, добавих следните редове към functions.php
register_sidebar( array(
'name' => __( 'Content Pages Right', 'ready_ecommerce' ),
'id' => 'sidebar-5',
'description' => __( 'Right sidebar area for content pages only. Not availabe at products or catalogue pages', 'ready_ecommerce' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
register_sidebar( array(
'name' => __( 'Content Pages Left', 'ready_ecommerce' ),
'id' => 'sidebar-6',
'description' => __( 'Left sidebar area for content pages only. Not availabe at products or catalogue pages', 'ready_ecommerce' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );