Support » Plugin: WP Publication Archive » [Plugin: WP Publication Archive] Category filter is not working and shows all files

  • Resolved sanjeevsajjan

    (@sanjeevsajjan)


    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/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Eric Mann

    (@ericmann)

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

    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

    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.

    Plugin Author Eric Mann

    (@ericmann)

    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.

    Thanks for the info Eric. And the useful plugin.

    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?

    Plugin Author Eric Mann

    (@ericmann)

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

    Yes, it will be fixed in the next version.

    Plugin Author Eric Mann

    (@ericmann)

    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.

    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/

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

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

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

    My Apologies

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Plugin: WP Publication Archive] Category filter is not working and shows all files’ is closed to new replies.