Viewing 8 replies - 16 through 23 (of 23 total)
  • Thread Starter alexisfrsh

    (@alexisfrsh)

    Ok, I’ve taken the site off maintenance mode for now. Do you mind having a look?

    Again, I really appreciate your efforts here.

    Thread Starter alexisfrsh

    (@alexisfrsh)

    It helps if I include a link.

    Plugin Contributor Tracy Levesque

    (@liljimmi)

    ?????? YIKES, Inc. Co-Owner

    Ok, I see what you are saying.

    You can use this instead to put an image before the form and not have it depend on the description:

    .yikes-easy-mc-form yikes-easy-mc-form-1:before {
      content: url(image.jpg);
    }
    Thread Starter alexisfrsh

    (@alexisfrsh)

    That removes the image entirely, leaving only the description.

    Plugin Author Evan Herman

    (@eherman24)

    Hi Alex,

    To make things a bit easier on you moving forward, you can use the filter that we have included in the plugin to alter the form description however you see fit.

    The following is a snippet that I have written (and tested), that will append an image before your form description, for all of the forms on your site.

    You’ll want to add the following function to the bottom of your functions.php file, ideally you’re using a child theme – so you’ll want to add it there.

    If you are not using a child theme, on each update this snippet will be erased and you’ll have to re-add it.

    If you are not using a child theme, or just are not comfortable editing functions.php file, you can use an additional third party plugin to add the code to your theme.

    The following plugin is one that we recommend frequently to our users:
    My Custom Functions

    Now for the code:

    /**
     * Append a custom image to the description for all forms
     * @param  string $description The form description that is set.
     * @param  int 		$form_id     The form ID.
     * @return string              The new form description to use.
     */
    function custom_yikes_mailchimp_image( $description, $form_id ) {
    	$image = wp_get_attachment_image( 7, 'full', false, array(
    		'class' => 'mailchimp-form-image',
    	) );
    	return $image . '<br />' . $description;
    }
    add_filter( 'yikes-mailchimp-form-description', 'custom_yikes_mailchimp_image', 10, 2 );

    You will notice that we have a function wp_get_attachment_image() which is retrieving an image that you have uploaded to your media library. The number is the ID of the media in your library.

    You can easily get the ID of your attachment by going to ‘Media > Library‘ and clicking on the media one time. When the pop up appears, you may notice that the URL also changes (?item=#). The new query string appended to the URL is the ID of the attachment you clicked.

    See the following example for an illustration of what I am referring to:
    Attachment ID Example

    Once you have your attachment ID you can swap it out for the number that we have included in the function. When you swap out the attachment ID, you can save the function and check your form again. You should now see the image appearing before your form.

    Let us know if that helps out at all. If you need some additional help, please post here and I will do my best to walk you through anything you may be stuck on.

    Thanks!
    Evan

    Thread Starter alexisfrsh

    (@alexisfrsh)

    Thank you so much! I’ll test this out tonight and report back.

    Thread Starter alexisfrsh

    (@alexisfrsh)

    Tested it out – this is perfect, thank you SO much for helping me with this issue. You and Tracy really went above and beyond.

    Plugin Author Evan Herman

    (@eherman24)

    Hey Alex,

    Glad to hear, and more than happy to help! Glad we could get that issue squared away for you.

    If you continue to use the plugin and find it useful, we would love it if you could leave us a positive review here in the repository:
    https://www.ads-software.com/support/view/plugin-reviews/yikes-inc-easy-mailchimp-extender

    Thanks again and have a great night!
    Evan

Viewing 8 replies - 16 through 23 (of 23 total)
  • The topic ‘image as form description’ is closed to new replies.