• elisa_latveria

    (@elisa_latveria)


    Hi!
    Is it possible to add a pdf icon near the link download?

    I just set the hidden form, that appears when the user click on the files available to be downloaded.
    I would like to add a small pdf icon near the link that appeared after click the submit botton; I’ve already set the icon as backgroud image for the div identifies with the class I assigned to link in the plugin setup (for me is .linkdown), but the icon appears just for the first file and not for others (The user should be able to download multiple file and I have already set multiple checkboxes)

    Any solution?
    Thanx

    Elisa

    https://www.ads-software.com/plugins/email-before-download/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Elisa,

    Unfortunately Contact Form 7 doesn’t use the Label tag on input fields, so there’s really no way to use CSS tricks to create custom checkboxes, which could contain your PDF icon.

    But… if you want to do code modification, then you can make the following changes to email-before-download.php (V3.2.7)

    Add the following code right before line 194:

    $ckboximg = ‘<img src=”https://www.yourdomain.com/wp-content/uploads/2013/11/youricon.png&#8221; width=”16″ height=”16″ />’;

    Obviously change the URL to point to your PDF icon.

    Then change the original line 194 and 195 to the following:

    $chekboxes .= ‘
    ‘ . $d->title. ‘ <input type=”‘.$checkbox.'” ‘.$checked_state_html.’ name=”ebd_downloads[]” value=”‘. $dl_id . ‘”/>’ . $cboximg;

    $chekboxesL .= ‘
    ‘ . $ckboximg. ‘ <input type=”‘.$checkbox.'” ‘.$checked_state_html.’ name=”ebd_downloads[]” value=”‘. $dl_id . ‘”/> ‘. $d->title;

    This should add your icon before each checkbox (line 195 for left justified checkboxes) or right after each checkbox (line 194 for right justified checkboxes). If you want to move the icon to the other side of the checkbox then just mod the statements accordingly.

    You can change the “width” and “height” in the <img> statement to fit your desired look and feel.

    This solution puts the image right next to the check box, so if you want a little space between the two you can either modify your icon to have some “white space” on the right or left side, or you can use some CSS to create a margin for the checkbox. Something like this (for line 195 above as an example.

    .ebdrk input[type=checkbox] {

    margin-left: 12px;
    }

    Hopefully this will work!

    PS: Again, just a reminder. Making mods to the code can cause upgrade problems. So if you do make the changes, keep a separate records of them so you can go back an re-apply after upgrading!

    Thread Starter elisa_latveria

    (@elisa_latveria)

    Thank you very much for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add pdf icon near link download’ is closed to new replies.