Display ONLY attachments with value higher than X in caption field (2 posts)

  1. Jerome
    Posted 3 years ago #

    I would like to use the plugin EG-Attachments to display a list of attachments , where the caption value exceeds X and then orderby=caption DESC,

    I currently have EG-Attachments set to display 3 attachments per post that is looped on category.php, and I have the orderby set to caption DESC , so my attachments will display on screen in order below (each new line is the caption from an attachment)


    Now, I want to display ONLY captions that are greater than, say, 2010. This would mean that from the results I showed you above, I would now display


    Can someone make this possible? I have all of my options configured on the EG-Attachments options page in the admin panel and I call the EG-Attachments inside a loop on category.php using this code:

    <?php echo do_shortcode('[attachments size=custom orderby="caption DESC" force_saveas=false]'); ?>

  2. emmanuelg
    Plugin Author

    Posted 3 years ago #


    A possible solution can be use orderby="caption DESC" and limit=2 (or 3).

    Another solution is hacking the plugin:

    In file eg-attachments-config.inc.php, add 'caption_filter' => '' in the definition of $EG_ATTACHMENT_SHORTCODE_DEFAULTS (near line 83)

    in file eg-attachments-public.inc.php, replace the conditions in lines 365 to 367, with

    if ( ($doctype == 'all' ||
    ($doctype == 'image' && $mime_type == 'image') ||
    ($doctype == 'document' && $mime_type != 'image') ) &&
    ($caption_filter=='' || ($caption_filter!='' && strcmp($attachment->post_excerpt,$caption_filter)>0)) ) {

    Of course, no help, no support on this...

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • EG-Attachments
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic