WP Document Revisions
[resolved] More output on the documents shortcode (3 posts)

  1. Elger
    Posted 3 years ago #


    The documents shortcode shows a list of documents. It does not show any other information, nor does it seem possible. I would like to show other info (such as latest revision date, author, description(?), latest annotation) amongst other things. On some pages i need this info, on some i don't.

    Can you help me out?


  2. Ben Balter
    Plugin Author

    Posted 3 years ago #

    Unfortunately, that functionality does not currently exist, but you could create it using the shortcode API and the functionget_documents() (coding required).

  3. mgreis
    Posted 3 years ago #

    I wanted to do something similar. I'm initially using the plugin to maintain and display a set of documents to site visitors. I'm using the documents shortcode to pull documents by category.

    Since the users are not familiar with the documents themselves, I wanted to add a short description to each document so that the user didn't have to open each one to figure out what it was. I wanted a single description for each document, so using the revision description didn't seem like the right idea. I didn't see a a general description field defined (I may have missed it), so I created a custom field with the key "Description" and the description as the value.

    Recklessly taking my life into my hands, and voiding my warranty for the plugin, I found the function documents_shortcode section defining the Documents shortcode in the plugin's wp-document-revisions/includes/front-end.php file.

    I added the following lines to the loop that displays the list of documents found:

    <br />
    <?php echo get_post_meta($document->ID,$cf_key,TRUE); ?>

    (I had previously defined $cf_key = "Description" above the loop.)

    Amazingly, it worked as intended and the shortcode now displays a list of documents, with each document link followed by the description.

    I presume I could have duplicated the entire shortcode code and given it a new name had I wanted to leave the original shortcode available.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Document Revisions
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic