Widget Option is Missing

时间:2013-09-27 作者:Jeremi Liwanag

仪表板区域中缺少我的小部件选项。我怎样才能让它出现?我从Chris Coyiers下载了这个空白主题site.

侧栏。php

<?php
/**
 * @package WordPress
 * @subpackage HTML5-Reset-WordPress-Theme
 * @since HTML5 Reset 2.0
 */
?>

<div class="sidebar">
  <?php if (!function_exists(\'dynamic_sidebar\') && !dynamic_sidebar(\'Sidebar Widgets\')) : else : ?>

  <!-- All this stuff in here only shows up if you DON\'T have any widgets active in this zone -->

  <?php get_search_form(); ?>
  <h3>
    <?php _e(\'Archives\',\'html5reset\'); ?>
  </h3>
  <ul>
    <?php wp_get_archives(\'type=monthly\'); ?>
  </ul>
  <h3>
    <?php _e(\'Meta\',\'html5reset\'); ?>
  </h3>
  <ul>
    <?php wp_register(); ?>
    <li>
      <?php wp_loginout(); ?>
    </li>
    <li><a href="http://wordpress.org/" title="<?php _e(\'Powered by WordPress, state-of-the-art semantic personal publishing platform.\',\'html5reset\'); ?>">
      <?php _e(\'WordPress\',\'html5reset\'); ?>
      </a></li>
    <?php wp_meta(); ?>
  </ul>
  <h3>
    <?php _e(\'Subscribe\',\'html5reset\'); ?>
  </h3>
  <ul>
    <li><a href="<?php bloginfo(\'rss2_url\'); ?>">
      <?php _e(\'Entries (RSS)\',\'html5reset\'); ?>
      </a></li>
    <li><a href="<?php bloginfo(\'comments_rss2_url\'); ?>">
      <?php _e(\'Comments (RSS)\',\'html5reset\'); ?>
      </a></li>
  </ul>
  <?php endif; ?>
</div>
我的函数中的小部件代码。php

// Widgets
if ( !function_exists(\'register_sidebar\' )) {
    function html5reset_widgets_init() {
        register_sidebar( array(
            \'name\'          => __( \'Sidebar Widgets\', \'html5reset\' ),
            \'id\'            => \'sidebar-primary\',
            \'before_widget\' => \'<aside id="%1$s" class="widget %2$s">\',
            \'after_widget\'  => \'</aside>\',
            \'before_title\'  => \'<h2 class="widget-title">\',
            \'after_title\'   => \'</h2>\',
        ) );
    }
    add_action( \'widgets_init\', \'html5reset_widgets_init\' );
}

2 个回复
SO网友:Owais Alam

将这几行代码放入函数中。php

if (function_exists("register_sidebar")) {
register_sidebar();
}
把这个放到侧边栏。php

<?php if ( !function_exists(\'dynamic_sidebar\') || !dynamic_sidebar() ) : ?>
<?php $image = new WP_query (\'showposts=1\');
if(have_posts()) : while($image->have_posts()) : $image->the_post; ?>

  <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to 
 <?php  the_title_attribute(); ?>"><?php postimage(); ?></a>

 <?php endwhile; endif; rewind_posts; ?>

SO网友:Jeremi Liwanag

我换了这个

// Widgets
if ( !function_exists(\'register_sidebar\' )) {
function html5reset_widgets_init() {
    register_sidebar( array(
        \'name\'          => __( \'Sidebar Widgets\', \'html5reset\' ),
        \'id\'            => \'sidebar-primary\',
        \'before_widget\' => \'<aside id="%1$s" class="widget %2$s">\',
        \'after_widget\'  => \'</aside>\',
        \'before_title\'  => \'<h2 class="widget-title">\',
        \'after_title\'   => \'</h2>\',
    ) );
}
add_action( \'widgets_init\', \'html5reset_widgets_init\' );
}

进入这个。。

// Widgets
if (function_exists(\'register_sidebar\')) {
    register_sidebar(array(
        \'name\' => \'Sidebar Widgets\',
        \'id\'   => \'sidebar-widgets\',
        \'description\'   => \'These are widgets for the sidebar.\',
        \'before_widget\' => \'<aside id="%1$s" class="widget %2$s">\',
        \'after_widget\'  => \'</aside>\',
        \'before_title\'  => \'<h2>\',
        \'after_title\'   => \'</h2>\'
    ));
}
然后,小部件选项出现了。。

结束

相关推荐

来自WooThemes的快照主题-空的‘alt’属性

我正在使用WooThemes的快照主题。调整大小(宽度、高度和大小,以kb为单位)并显示图像(一个“a”标记,包装一个“img”标记)的代码如下:<?php if ( get_option(\'woo_resize\') ) { woo_get_image(\'image\',\'210\',\'280\');?> 问题是:我在发帖时设置了“alt”文本,当试图查看帖子图片源代码时,“alt”属性显示为空。以前有人通过过这个吗?有什么建议吗?我希望具有“alt”属性的帖子是第一行第