WordPress.org

Ready to get started?Download WordPress

Forums

WP Document Revisions
[resolved] Filtering with documents shortcode seems to be broken (13 posts)

  1. lspilcher
    Member
    Posted 2 years ago #

    The short code [documents] correctly displays all available documents but I have been unable to filter these documents in any way. The simple example given in the documentation doesn't appear to work [documents numposts="2"]. I would expect to see only 2 documents listed but all documents are listed. In particular I was trying to display only the documents with Workflow State of Final.

    http://wordpress.org/extend/plugins/wp-document-revisions/

  2. Ben Balter
    Member
    Plugin Author

    Posted 2 years ago #

    As for number of posts, the argument is actually numberposts. It comes from WP's get_posts function. I'll update the documentation.

    As for the taxonomy, I just discover the bug myself and have a fix in the works. Look for an update very, very soon.

  3. Ben Balter
    Member
    Plugin Author

    Posted 2 years ago #

    I'm going to give it a bit of testing still before I push it to the stable version, but I believe the below linked version should solve your problem:

    https://github.com/benbalter/WP-Document-Revisions/zipball/develop

    - Ben

  4. lspilcher
    Member
    Posted 2 years ago #

    Works like a champ thanks much - as an aside I've made edits to your code to allow for document type (for a town website so things like minutes, policy, ordinance etc) and added it to look and operate exactly like Workflow State - so in terms of style and keeping out of the way of updates to your plugin - how would you recommend keeping those 'extensions' separate. The custom taxonomy comes out easily but not the changes required in admin.php to display additional column, drop down meta box, saving the document type etc.

  5. Ben Balter
    Member
    Plugin Author

    Posted 2 years ago #

    In theory, you shouldn't have to update the plugin files at all. Most if not all of what the plugin does is hooking into the existing WordPress Plugin API, and then a handful of functions I've actually created additional API endpoints (for example, the action document_edit fires when WP loads the edit document screen).

    I'd make each bit of functionality a separate, stand-alone plugin. The custom taxonomies can come from the custom taxonomy generator, and just set the post type to document. I've done that on a handful of sites.

    If you properly add the custom taxonomies, you can add the custom columns using admin columns or just google and there's some good tutorials out there for how to do it manually.

  6. lspilcher
    Member
    Posted 2 years ago #

    got it - thanks

  7. lspilcher
    Member
    Posted 2 years ago #

    I have not been able to make the [documents] shortcode filter by author or author_name. Do you have any ideas/suggestions?

  8. lspilcher
    Member
    Posted 2 years ago #

    sorry bit of a newbie on wordpress - added 'author_name'=>null,
    to documents_shortcode default array and everything is great. I'll end up creating my own local plugin and shortcode to extend wp_document_revisions with these changes - thanks again for you help

  9. Ben Balter
    Member
    Plugin Author

    Posted 2 years ago #

    So even on that one, for example, you'll notice there's a document_shortcode_atts filter right below that that you can hook into prior to the shotcode being processed.

    Either way, rewrote the way the shortcode handles arguments. The link to the dev version above should now work with author_name.

    Specifically the shortcode should now accept: author, author_name, cat, category__and, category_name, day, hour, meta_compare, meta_key, meta_value, meta_value_num, minute, monthnum, name, numberposts, order, orderby, p, post_parent, post_status, second, tag, tag_id, {tax}, w, and year.

  10. Ben Balter
    Member
    Plugin Author

    Posted 2 years ago #

    Also, feel free to fork the version on github... if you find any bugs, more than glad to accept a pull request.

  11. bmcgama
    Member
    Posted 2 years ago #

    Hello, I'm a newbie on WordPress and I'm having a hard time listing documents under a particular workflow state in my site.

    How can I filter my documents so that a particular page will show only documents of a particular workflow state? I tried using shortcode like [documents w="6"] (does "w" stands for "workflow state"?), but no documents is shown! :-(

    PS: I'm using version 1.2.2, if it helps...

    Thanks in advance!

  12. Ben Balter
    Member
    Plugin Author

    Posted 2 years ago #

    replace "w" with workflow_state and that should work. You may need to refer to the state by it slug, rather than ID, so "under-review" rather than "6".

  13. ccoolen
    Member
    Posted 1 year ago #

    (sorry, wrong entry - deleted)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic