WordPress.org

Ready to get started?Download WordPress

Forums

WP Publication Archive
[resolved] Category filter is not working and shows all files (12 posts)

  1. sanjeevsajjan
    Member
    Posted 2 years ago #

    I am giving the following shortcode for category having slug "cat1":
    [wp-publication-archive categories="cat1"]

    However, all the publications under cat1 and cat2 are showing. Same thing is happening for this also :
    [wp-publication-archive categories="cat2"]

    At both the pages, all publications are showing up and filter is not working.

    Please let me know if I am doing something wrong or problem lies somewhere else.

    Thanks.

    http://wordpress.org/extend/plugins/wp-publication-archive/

  2. Eric Mann
    Member
    Plugin Author

    Posted 2 years ago #

    The shortcode you're using looks fine, but without actually seeing your site and the publications I can't provide any further help.

  3. pheriche
    Member
    Posted 2 years ago #

    I am having exactly the same problem .
    I have created some categories and uploaded some PDF files and assigned them to categories.
    Using the shortcode like
    [wp-publication-archive categories="newreleases"] however gives a list of all files in all categories.
    The author filter works as expected but I cannot get the categories filter to work .
    I cannot provide a URL as I am testing this on localhost

  4. pheriche
    Member
    Posted 2 years ago #

    I have solved this... nearly.
    If I make the category name exactly the same as the slug then the category filter works.
    What alerted me to this was when I echo the mysql queries to the page by setting
    define( 'SAVEQUERIES', true );

    I looked through the queries for the name of the slug I was using in the shortcode and found this query .
    SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = 'category' AND t.name = 'new-releases' LIMIT 1
    This was returning no rows because the query is searching the name field of wp-terms and not the slug field.

    I have not yet tracked down which part of the plug-in code generates this query but I guess a workaround is to use the category name in the shortcode filter rather than the slug.

  5. Eric Mann
    Member
    Plugin Author

    Posted 2 years ago #

    The processing for this is in /lb/class.wp-publication-archive.php around line 233. The plugin takes the category names passed in and queries the database to get their IDs. This list of IDs is then passed in a larger query to retrieve publications mapped to those categories.

    It's using the core get_cat_ID() function, which takes a category name rather than a category slug. If there was any confusion in my documentation, it's entirely my fault and will be fixed in the future.

  6. pheriche
    Member
    Posted 2 years ago #

    Thanks for the info Eric. And the useful plugin.

  7. evster
    Member
    Posted 1 year ago #

    Just wanted to update this thread to say that I too was experiencing the same issue.

    When I try to use the category slug in my short-code I get a list of all files rather than only the files from my desired category.

    However when I use the category name in my short-code (even if the category name has spaces in it), then the category filter works just fine.

    Is this something that will be fixed in future versions of this plugin?

  8. Eric Mann
    Member
    Plugin Author

    Posted 1 year ago #

    Is this something that will be fixed in future versions of this plugin?

    Yes, it will be fixed in the next version.

  9. Eric Mann
    Member
    Plugin Author

    Posted 1 year ago #

    Just to clear things up, I did a quick patch on the readme for version 2.3.3, updating the documentation to reflect you use category names rather than slugs. Nothing else in the plugin has changed yet, so there's no update required.

  10. 4BWebDesign
    Member
    Posted 1 year ago #

    Eric

    I'm currently developing a new website and using this plugin for the first time. I have adjusted per the string above yet I'm still getting all publications in both categories. Also when I click on a publication in a category I'm getting page not found.
    http://www.roysecitycdc.org/test/inside-cdc/archive/

  11. @4BWebDesign Please start your own topic, this one has been marked resolved already.

    http://wordpress.org/support/plugin/wp-publication-archive#postform

  12. 4BWebDesign
    Member
    Posted 1 year ago #

    My Apologies

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic