Support » Plugins » Help Needed for Plugin Development

  • Resolved nadimtheadmin


    I needed the category name to be displayed on the top of the sidebar so i tried creating a widget:

    Plugin Name: DisplayCategoryName
    Description: Category Name
    Author: Nadim Lahoud
    Version: 0.001
    Author URI: none
    function get_cat_name($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; ?>

    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?


Viewing 10 replies - 1 through 10 (of 10 total)
  • I would not have thought a plugin would be needed for that.

    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.

    You need to edit the widget parameters in functions.php (for the theme).

    ok this is the theme’s functions.php:
    if ( function_exists(‘register_sidebar’) )
    ‘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.



    Forum Janitor

    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.

    There are some good examples in the Codex. You are right on track.

    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…

    Thanks, removed the comma but I dont think it was doing anything wrong. It was just unnecessary.

    I may have misunderstood the question.

    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?

    Found it!

    I just added <p><h3> -<?php single_cat_title(); ?></h3></p> before The Loop in my theme’s index.php.


Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Help Needed for Plugin Development’ is closed to new replies.