• Resolved BJ

    (@kossahl)


    Ahoi there,

    I don’t understand if it is possible to use article categories and post categories at the same time.
    I have the problem, that your plugin will override the category widget from wordpress. If I use article categories (meaning i don’t! tick “Use Default WordPress Category and Tag Taxonomies” in the issuem plugin settings) the standard category wordpress widget will turn into a article-categories widget showing article categories instead of post categories.
    I want to use both, having an issue based part at my site (using article-categories) and a blog part (using post categories) with widgets displaying the correct categories (either article or post categories).

    How would I be able to realize that, without having to construct a custom menu widget which i would have to update every time i add a category.

    Hope you can point me in the right direction.
    Thanks in advance.
    BJ

    https://www.ads-software.com/plugins/issuem/

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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?

    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)

    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)

    solved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Post categories vs. article categories’ is closed to new replies.