impress-org / givewp-snippet-library

A collection of code snippets to enhance or expand on the free Give WordPress Donation Plugin.
https://givewp.com
140 stars 90 forks source link

Button Form with pre-selected donation options #64

Closed AndreaBarghigiani closed 6 years ago

AndreaBarghigiani commented 6 years ago

Issue overview

Use the [give_form] shortcode with Button display in order to select a Donation Options from the modal window.

Use case

I would like to create a page where I display the different Donation Option and also a description of what this kind of donation will be useful for. This is a simple Gif to show what I mean:

give-sample-button2

Proposed solution(s)

It could be as simple as add a new attribute in the [give_form] shortcode in order to create single button to open the modal window with selected Donation Options, for example: [give_form id="8" donation_option="2"].

It could be possible to build a new shortcode [button] that let us open a new modal with the pre-selected option, for example [give_button form_id="8" donation_option="0"].

I would like to create or edit this shortcode, can you help me up? I've read the code but I do not understand how to create and edit the modal window and reading the Create Give Shortcode article did't help me.

Thank you in advance and congrats about the project!

mathetos commented 6 years ago

You could do something similar to this snippet, but instead of triggering it based on the URL, you trigger this on click of the button of your choice: https://github.com/WordImpress/Give-Snippet-Library/blob/master/form-customizations/populate-amount-from-url.php

AndreaBarghigiani commented 6 years ago

@mathetos thanks to show me the right path, I think for the time beign could be the right solution but I would really love to learn how to create a proper button shortcode.