Donor wall – Company name
-
i’d like to display a custom Donation Company Name in a donors wall. Now i’m using $donation[‘_give_donation_company’] but this give me the company name about “the donation secition” that isn’t editable from backend. I want display the company name about “the donor section” that is editable from backend.
-
This topic was modified 6 years, 7 months ago by
aballerini.
The page I need help with: [log in to see the link]
-
This topic was modified 6 years, 7 months ago by
-
Hi there,
The information you’re searching for is located in the Donor Meta and not in the Donation Meta.
The meta key that you’ll be on the lookout for is “_give_donor_company”.
This value is the value that is editable from the backend and can change. The information on the donation itself can’t be changed. This is done to protect the integrity of the information associated with individual donations.
Thanks, and have a great rest of your day!
Hi, thanks for your support. Unfortunately I try to display $donation[‘_give_donor_company’] the result is empty.
Hi there,
The next step would be to confirm there is a value present in the database as well.
If there is a value present, then this may be an issue with the code snippet you’re using.
While providing custom development is outside what we can do here through support. Feel free to attach the code, and I’ll see if I can point you in the right direction.
Thanks!
i think i’m doing a mistake when simply replace “_give_donation_company” with “_give_donor_company” using the same variable $donation declared at the beginning of the file (give/templates/shortcode-donor-wall.php). Should I use another variable? How should I declare it?
Hi there,
If you would like to include the full code snippet, I’ll be happy to take a look.
But to answer your question, you’ll be wanting to look in the donor meta and not the donation meta.
Thanks!
<?php /** * This template is used to display the donation grid with [give_donor_wall] */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** @var $donor Give_Donor */ $donation = $args[0]; //Inizio modifiche Alessio cambio stile css switch ($donation['_give_payment_total']) { case "90.000000": $style='style="background-color: saddlebrown;"'; $color_font='style="color: #fff !important; font-weight: 500!important; font-size:1em !important"'; break; case "250.000000": $style='style="background-color: silver; font-weight: 600!important; font-size:1.2em !important"'; break; case "1500.000000": $style='style="background-color: goldenrod; font-weight: 700!important; font-size:1.5em !important"'; break; } //Fine modifiche Alessio $give_settings = $args[1]; // Give settings. $atts = $args[2]; // Shortcode attributes. ?> <div class="give-grid__item"> <div class="give-donor give-card" <?php echo $style; ?> > <div class="give-donor__header"> <?php if( true === $atts['show_avatar'] ) { // Get anonymous donor image. $anonymous_donor_img = sprintf( '<img src="%1$s" alt="%2$s">', esc_url( GIVE_PLUGIN_URL . 'assets/dist/images/anonymous-user.svg' ), esc_attr__( 'Anonymous User', 'give' ) ); // Get donor avatar image based on donation parameter. $donor_avatar = ! empty( $donation['_give_anonymous_donation'] ) ? $anonymous_donor_img : $donation['name_initial']; // Validate donor gravatar. $validate_gravatar = ! empty( $donation['_give_anonymous_donation'] ) ? 0 : give_validate_gravatar( $donation['_give_payment_donor_email'] ); // Maybe display the Avatar. echo sprintf( '<div class="give-donor__image" data-donor_email="%1$s" data-has-valid-gravatar="%2$s">%3$s</div>', md5( strtolower( trim( $donation['_give_payment_donor _email'] ) ) ), absint( $validate_gravatar ), $donor_avatar ); } ?> <div class="give-donor__details"> <?php if ( true === $atts['show_name'] ) : ?> <h3 class="give-donor__name" <?php echo $color_font; ?> > <?php // Get Company Name. $donor_name = ! empty( $donation['_give_anonymous_donation'] ) ? __( '', 'give' ) : trim( $donation['_give_donation_company'] ); ?> <?php esc_html_e( $donor_name ); ?> </h3> <?php endif; ?> <?php if ( true === $atts['show_time'] ) : ?> <span class="give-donor__timestamp" <?php echo $color_font; ?> > <?php echo esc_html( give_get_formatted_date( $donation[ 'donation_date' ], give_date_format(), 'Y-m-d H:i:s' ) ); ?> </span> <?php endif; ?> </div> </div> <?php if ( true === $atts['show_comments'] && absint( $atts['comment_length'] ) && ! empty( $donation['donor_comment'] ) && ! $donation['_give_anonymous_donation'] ) : ?> <div class="give-donor__content"> <?php $comment = trim( $donation['donor_comment'] ); $total_chars = strlen( $comment ); $max_chars = $atts['comment_length']; // A truncated excerpt is displayed if the comment is too long. if ( $max_chars < $total_chars ) { $excerpt = ''; $offset = -( $total_chars - $max_chars ); $last_space = strrpos( $comment, ' ', $offset ); if ( $last_space ) { // Truncate excerpt at last space before limit. $excerpt = substr( $comment, 0, $last_space ); } else { // There are no spaces, so truncate excerpt at limit. $excerpt = substr( $comment, 0, $max_chars ); } $excerpt = trim( $excerpt, '.!,:;' ); echo sprintf( '<p class="give-donor__excerpt">%s…<span> <a class="give-donor__read-more">%s</a></span></p>', nl2br( esc_html( $excerpt ) ), esc_html( $atts['readmore_text'] ) ); } echo sprintf( '<p class="give-donor__comment">%s</p>', nl2br( esc_html( $comment ) ) ); ?> </div> <?php endif; ?> </div> </div>
The topic ‘Donor wall – Company name’ is closed to new replies.