Support » Plugin: EG-Attachments » [Plugin: EG-Attachments] Plugin shows header and footer when no attachments are shown

  • Resolved Mike

    (@mobius5150)


    Hello,

    I noticed this behaviour upon using EG-Attachments a couple times.

    If for example, you set doctype=document but the post has only images attached to it, you will get a blank list of attachments showing up (ie the plugin creates content on the page, but is not actually showing anything other than its header and footer). This is a bit of an issue if you use a custom type to add a header to your list of attachments, then the header will show but no attachments.

    I created a simple diff patch that corrects the problem by counting the number of attachments that are actually being printed out (instead of just counting to ensure that the array length of attachments is > 0 (as the array contains all attachment types). If this number is set to 0 after the shortcode finishes looping through the attachments array, then it returns ”.

    You can find the diff here: http://michaelblouin.info/filebin/eg-attachments-no-attachments.patch

    Hope this helps and thank you for a great plugin!
    Michael Blouin

    http://wordpress.org/extend/plugins/eg-attachments/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Mike

    (@mobius5150)

    Actually… Come to think of it, not sure why I posted this here.. Anyways, creating a post in trac…

    Mike

    (@mobius5150)

    Hmm… Nevermind.. This plugin isn’t in Trac…

    Mike

    (@mobius5150)

    I made one more update to the diff patch. I changed it so that when it checks if $attachment_count == 0 it also checks if $output == '', and if either is true it returns ''.

    I then removed several if statements that were checking if $output == '' to optimize the code a little.

    This diff is available here: eg-attachments-no-attachments-optimize.patch

    Mike

    Plugin Author emmanuelg

    (@emmanuelg)

    Thanks for the suggestion.
    The version 1.8 is now published, and takes your comment into account.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: EG-Attachments] Plugin shows header and footer when no attachments are shown’ is closed to new replies.