在主页中自定义我的wordpress插件


Customize my wordpress plugin in home page

我正在使用这个插件 http://wordpress.org/extend/plugins/simple-rss-feeds-widget/这对我来说很好用。我正在使用WordPress 3.3.1。现在我希望我的插件位于主页的中心,而不是侧面小部件。我怎样才能做到这一点。?我的意思是,我的插件在小部件列表中,我可以将我的插件拖到后端模板的侧边栏它反映在右上角的前端。如何在主页的页面中心获取我的插件?希望有人能帮助我。换句话说,如何在模板文件中调用我的自定义插件?谢谢哈恩

您需要

在函数.php文件中注册一个新的小部件位置,然后添加代码以在相关模板文件中呈现该小部件的内容。

举个例子。在函数中.php您会找到注册现有小部件位置的代码部分(查找if (function_exists('register_sidebar')) { ),并在其下方注册一个新位置;

    register_sidebar(array(
        'name' => 'Home Widget Container',
        'id'   => 'home-widget',
        'description'   => 'These are widgets for the home position.',
        'before_widget' => '',
        'after_widget'  => '',
        'before_title'  => '<div class="home-widget-header"><h2>',
        'after_title'   => '</h2></div>'
    ));

然后在您用于主页的模板文件中;

    <?php
        if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Home Widget Container')) :
            // This will include your widgets.
        endif; 
    ?>