WordPress.org

Ready to get started?Download WordPress

Forums

jQuery Archive List Widget
[resolved] Custom post type categories not shown in the category list? (6 posts)

  1. vijaykumarvemula
    Member
    Posted 5 months ago #

    Hi, i am using this plugin. Can anyone help me custom post type categories are not showing in category list.

    https://wordpress.org/plugins/jquery-archive-list-widget/

  2. Miguel Useche
    Member
    Plugin Author

    Posted 4 months ago #

    Could you give more info? currently i doesn't show custom categories by default, but you can change it to show posts from other types, by changing this SQL setence post_type='post' to post_type='YOUR_CUSTOM_TYPE' along the source code.

  3. vijaykumarvemula
    Member
    Posted 4 months ago #

    Thank You for your replay. where can i change this code?

  4. seansean11
    Member
    Posted 4 months ago #

    That does not fix the buildHtml function, where the links are still being set for regular posts. I'm going to dig around and see if I can get this part to also work.

    You can change the code in the jquery-archive-list-widget.php inside the plugin. You should find various instances where you can change the sql query to post_type='YOUR_CUSTOM_TYPE'.

  5. seansean11
    Member
    Posted 4 months ago #

    Sorry for hijacking the response on this post, but it might be helpful for @vijaykumarvemula to hear how I was able to get the plugin to work with my CPT's.

    After I changed the sql queries to use my custom post type, I also went and changed the excluded cat line to also include just the taxonomies from my new CPT

    $cats = get_categories(array('child_of' => 0, 'hide_empty' => 1, 'hierarchical' => 1, 'taxonomy' => 'YOUR_CUSTOM_TAXONOMY'));

    You will also need to set up the date archive rewrites for your CPT (http://stackoverflow.com/questions/14486792/custom-post-type-yearly-monthly-archive) because WordPress does not include this functionality out of the box.

    The plugin also utilizes the get_the_month and get_the_year functions, which do not support CPT's. You can find these in the buildHtml function. You will need to change these functions to something like this http://ericholmes.ca/custom-post-type-date-archive-links-in-wordpress/. Just make sure the function loads before it gets called in the plugin. That's how I was able to make the plugin work for my CPT's.

  6. seansean11
    Member
    Posted 4 months ago #

    Excluded categories weren't working when I tested my result, and I realized that I needed to add my custom taxonomy here too:

    {$wpdb->term_taxonomy}.taxonomy = 'YOUR_CUSTOM_TAXONOMY'

    You'll find this in a couple different parts of the plugin.

Reply

You must log in to post.

About this Plugin

About this Topic