• Resolved dadadmin

    (@dadadmin)


    I want to add a bit of formatting to the text on my donation levels while using the multilevel donation options.

    If you add any html to the text box it just strips the html.

    I was thinking it could be done by one of the following, I just don’t know where to start

    • Hook into the text field to stop stripping html
    • Convert the text field to a wysiwyg editor field
    • Add a new field under the “text” field that allows for html

    I am referencing the “Text” box on each donation level, see the second graphic
    on this page

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Matt Cromwell

    (@webdevmattcrom)

    This custom snippet should help you to implement that:
    https://github.com/WordImpress/Give-Snippet-Library/blob/master/form-customizations/add-html-after-multilevel.php

    Just make sure that if you want it applied to ONLY one form, to insert the form ID correctly, otherwise, make sure to remove the $form_id == 5798 && part.

    If you need guidance implementing custom PHP functions on your website, we have this guide here: https://givewp.com/documentation/resources/adding-custom-functions-to-your-wordpress-website/

    Please note that this code snippet is provided as an example of how you can extend Give with code. It’s up to you to implement and customize to your liking. We cannot provide support for custom code on your website, only the code that we create and distribute.

    Thread Starter dadadmin

    (@dadadmin)

    I have 7 different donation levels on my form, would I have to replicate this function 7 times?

    This is my page

    I want the name of the package and the price to be on one line, and then I want to be able to list everything it includes, one item on each line which is why allowing html in the text field would be easiest.

    For example:
    Platinum – $3,000
    Golf for Four at Ramblewood CC
    Prominent Listing in all Advertising
    Dinner/Cocktail Hour Sponsorship
    Entry for Four to Dinner/Cocktail Hour
    A Special Thank You Gift

    If I manually enter bold spans or line breaks after each item, it just strips them out upon save

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    No, you would add a new IF statement for each level. Here’s an example:

    function prefix_customize_give_buttons( $level_text, $form_id, $price ) {
    
    	if ( $level_text == 'Small' ) {
    		
    		return $level_text . '<br /><span class="available">Your Small Text</span>';
    	}
     
    	if ( $level_text == 'Medium' ) {
    		
    		return $level_text . '<br /><span class="available">Your medium text</span>';
    	}
    
    	// Return all Level Texts
    	return $level_text;
    }
    add_filter( 'give_form_level_text', 'prefix_customize_give_buttons', 10, 3 );
    Thread Starter dadadmin

    (@dadadmin)

    THANK YOU!!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add html to Donation Level Text’ is closed to new replies.