简体   繁体   中英

Customize my wordpress plugin in home page

I am using this plugin http://wordpress.org/extend/plugins/simple-rss-feeds-widget/ This works fine for me. i am using WordPress 3.3.1. Now i want my plugin to be there in the centre of my home page and not in the side widget. How can i achieve this.? I mean, my plugin is there in the widget list,and i can drag my plugin to the sidebar of my template in back-end and it reflects in the front-end at right corner. How can i get my plugin in home page at centre of the page? Hope someone wil help me. In other words, how can i call my customized plugin in my template file? Thanks Haan

You need to register a new widget position in your functions.php file and then add the code to render out the contents of that widget in the relevant template file.

So as an example. In functions.php you would find the section fo code that is registering your existing widget positions (look for if (function_exists('register_sidebar')) { ) and register a new position below it;

    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>'
    ));

And then in the template file you are using for your homepage;

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM