Support » Plugin: WP Document Revisions » [Plugin: WP Document Revisions] More output on the documents shortcode

  • Resolved Elger



    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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Ben Balter


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

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WP Document Revisions] More output on the documents shortcode’ is closed to new replies.