Title: Help Needed for Plugin Development
Last modified: August 18, 2016

---

# Help Needed for Plugin Development

 *  Resolved [nadimtheadmin](https://wordpress.org/support/users/nadimtheadmin/)
 * (@nadimtheadmin)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/help-needed-for-plugin-development/)
 * I needed the category name to be displayed on the top of the sidebar so i tried
   creating a widget:
 *     ```
       <?php
       /*
       Plugin Name: DisplayCategoryName
       Description: Category Name
       Author: Nadim Lahoud
       Version: 0.001
       Author URI: none
       */
       function get_cat_name($args) {
           extract($args);
       ?>
               <?php echo $before_widget; ?>
                  <?php /* If this is a category archive */ } elseif (is_category()) { ?>
       			<h3><p><?php single_cat_title(''); ?></p></h3>
               <?php echo $after_widget; ?>
       <?php
       }
       register_sidebar_widget('GetCateName',
           'widget_getcatname');
       ```
   
 * It says error on line 13.
 * I know this is very specific but this is my first widget/plugin and help would
   be greatly appreciated.
    What’s wrong with line 13? Are there any other mistakes
   I made? Is there an easier way to achieve the desired result?
 * Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)

 *  [Root](https://wordpress.org/support/users/root/)
 * (@root)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/help-needed-for-plugin-development/#post-608983)
 * I would not have thought a plugin would be needed for that.
 *  Thread Starter [nadimtheadmin](https://wordpress.org/support/users/nadimtheadmin/)
 * (@nadimtheadmin)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/help-needed-for-plugin-development/#post-609041)
 * The thing is that when I widgetised my Contempt theme it stopped displaying the
   name of the category pages on the top of the sidebar.
    When I looked into the
   theme’s old sidebar.php file I found part of the code you see above and tried
   to implement it into a widget for my new customisable sidebar. But I just cant
   seem to get it right without any help.
 *  [Root](https://wordpress.org/support/users/root/)
 * (@root)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/help-needed-for-plugin-development/#post-609068)
 * You need to edit the widget parameters in functions.php (for the theme).
 *  Thread Starter [nadimtheadmin](https://wordpress.org/support/users/nadimtheadmin/)
 * (@nadimtheadmin)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/help-needed-for-plugin-development/#post-609074)
 * ok this is the theme’s functions.php:
    `<?php if ( function_exists(‘register_sidebar’))
   register_sidebar(array( ‘before_widget’ => ‘<li id=”%1$s” class=”widget %2$s”
   >’, ‘after_widget’ => ‘ ‘, ‘before_title’ => ”, ‘after_title’ => ”, ));
 * ?>
    `
 * Can you help me edit it? (I don’t really know what to do :))
 * Thanks a million.
 *  [mrmist](https://wordpress.org/support/users/mrmist/)
 * (@mrmist)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/help-needed-for-plugin-development/#post-609075)
 * I could be wrong, but this doesn’t looke right to me
 * ‘after_title’ => ”,
    ));
 * I doubt you’d have a comma before a closing bracket. You either need somthing
   after that comma, or to remove it.
 *  [Root](https://wordpress.org/support/users/root/)
 * (@root)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/help-needed-for-plugin-development/#post-609076)
 * There are some good examples in the Codex. You are right on track.
 *  Thread Starter [nadimtheadmin](https://wordpress.org/support/users/nadimtheadmin/)
 * (@nadimtheadmin)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/help-needed-for-plugin-development/#post-609080)
 * [@root](https://wordpress.org/support/users/root/)
    hey i didn’t write this! 
   This is how it came! (After the widgetizing) This works perfectly but I really
   need to have the Title of the category either first thing on the page or in the
   sidebar (as it was before). I’m a complete newbie when it comes to php and I 
   somehow managed to get a few things done but this is over my head…
 * [@mrmist](https://wordpress.org/support/users/mrmist/)
    Thanks, removed the comma
   but I dont think it was doing anything wrong. It was just unnecessary.
 *  [Root](https://wordpress.org/support/users/root/)
 * (@root)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/help-needed-for-plugin-development/#post-609085)
 * I may have misunderstood the question.
 *  Thread Starter [nadimtheadmin](https://wordpress.org/support/users/nadimtheadmin/)
 * (@nadimtheadmin)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/help-needed-for-plugin-development/#post-609089)
 * OK, no prob I’ll explain again. I’m using this them called Contempt. The theme
   used to display the name of the category first thing in the sidebar when you 
   were in a category page. When I widgetized the theme, the new sidebar didn’t 
   have this function. So I thought that the quickest way to add it would be by 
   creating a widget and place it at the top of the sidebar.
 * Maybe there’s a better way?
 *  Thread Starter [nadimtheadmin](https://wordpress.org/support/users/nadimtheadmin/)
 * (@nadimtheadmin)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/help-needed-for-plugin-development/#post-609124)
 * Found it!
 * I just added `<p><h3> -<?php single_cat_title(); ?></h3></p>` before The Loop
   in my theme’s index.php.
 * Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Help Needed for Plugin Development’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [title](https://wordpress.org/support/topic-tag/title/)

 * 10 replies
 * 3 participants
 * Last reply from: [nadimtheadmin](https://wordpress.org/support/users/nadimtheadmin/)
 * Last activity: [18 years, 10 months ago](https://wordpress.org/support/topic/help-needed-for-plugin-development/#post-609124)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
