Forum Replies Created

Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter BJ

    (@kossahl)

    solved.

    Thread Starter BJ

    (@kossahl)

    As I didn’t really like that solution i went another way.

    In my theme (e.g. in the functions.php) I added both the original class WP_Widget_Categories and the issuem class IssueM_Article_Categories from the respective source.
    I changed the class names and of course the title for the constructor (see my second post) and registered these two new widgets thus reoverriding the issuem widget and at the same time have the issuem article categories widget.

    Allthough i might still need to manually update my theme if either of the widgets classes change I still thought I’d prefer this way for not having the necessity for a new plugin whilst not having to add any new content to my page.

    Still suggestions for other solutions are welcome.

    Thread Starter BJ

    (@kossahl)

    If people stumble across that like i did, this was the anwser i got from the issuem plugin support:

    You are absolutely correct that Issuem overrides the category widget. To use both article categories and post categories and avoid the manual updating you can:

    1. Install a widget such as PHP Text Widget which allows the Text widget to run PHP code

    2. Drag the Text widget to your sidebar, add a title and then paste this code in the body:

    <?php
    $args = array(
    		'orderby' => 'name',
    		'order' => 'ASC',
    		'show_count' => 0,
    		'hierarchical' => 1,
    		'title_li' =>'',
    		'taxonomy' => 'category'
    	);
    wp_list_categories( $args );
    ?>

    3. Click on Save and refresh your site. You should now see a list of post categories – it will need a bit of styling. The wp_list_categories function has quite a list of potential arguments, so be sure to checkout the function’s page on the Codex.

    Regards,Chris

    Thread Starter BJ

    (@kossahl)

    Ok, so far i figured that the default wordpress widget is overwritten by

    class IssueM_Article_Categories extends WP_Widget {
    
    	function __construct() {
    		$widget_ops = array( 'classname' => 'issuem_widget_categories', 'description' => __( 'A list or dropdown of Article categories', 'issuem' ) );
    		parent::__construct('categories', __( 'Article Categories', 'issuem' ), $widget_ops);
    	}

    Because in the parent construct call parent::__construct('categories', ... the same widget name ‘categories’ as for the standard widget is chosen.

    Is this on purpose? If yes are there any important reasons for it?
    And how can I use both widgets without having to alter your plugin directly thus having the risk of loosing my changes when an update comes?

Viewing 4 replies - 16 through 19 (of 19 total)