john0865
Forum Replies Created
-
Please add this feature in the next update, till then it is unresolved!
OR PLEASE ADD THE SNIPPET TO YOUR CODE SNIPPETS SECTION AS SOON AS POSSIBLE! PLEASE!!!
He told me to put the function in a plugin or in theme’s functions.php, so I tried it in functions.php and also in single-achievement.php. So, can you please JUST TELL ME HOW TO USE IT AND WHERE TO PUT IT? PLEASE HELP!!!
I also asked a developer on StackExchange, but he says that the function should work and I used it as he said.
Hi, I asked on StackExchange and they are saying that the function should work.
As it is not working, it is not a customization request, but the function is taken from the plugin file itself, from this file: templates/points.php.
And the function is from this file: includes/functions/points.php.
So, this is the support request, because the function should return the thumbnail.
And, as I am using the BuddyBoss Theme and Platform Pro, I used functions.php of the child theme for the code snippet.
Your Demo is also using the same theme, I guess, so it should not cause any conflicts!
So, PLEASE HELP!!!
Why is the function not working?
Still, it returns no thumbnail, and it only returns just a blank label.
I also used this code:<?php // User Points Image if( $a['thumbnail'] === 'yes' ) : ?> <div class="gamipress-user-points-image gamipress-user-points-<?php echo esc_attr( $points_type ); ?>-image"> <?php echo gamipress_get_points_type_thumbnail( $points_type ); ?> </div><!-- .gamipress-user-points-image -->Please Help, as the function is not returning the thumbnail!
Hi!
The function you provided, I used it like this:function points_amount_label_gems( $label, $amount, $points_type, $force_return ) { $points_type = gamipress_get_points_type( $points_type ); if ( $points_type ) { // Use the points type featured image function recommended by // GamiPress support. return gamipress_get_points_type_thumbnail( $points_type ); } return $label; } add_filter( 'gamipress_get_points_amount_label', 'points_amount_label_gems', 10, 4 );But it returns a blank label.
Here is the Screenshot: Screenshot
Can you please tell me that what should be changed in my code snippet? Because, when I change something, I get a critical error on my website.
Hi!
I came up with this function, please have a look:function points_amount_label_gems( $label, $amount, $points_type, $force_return ) { $points_type = gamipress_get_points_type( $points_type ); $post_id = $points_types[$points_type]['ID']; $image_size = 'gamipress-points'; $class = 'gamipress-points-thumbnail'; if ( $points_type ) { return get_the_post_thumbnail( $post_id, $image_size, array( 'class' => $class ) ); } return $label; } add_filter( 'gamipress_get_points_amount_label', 'points_amount_label_gems', 10, 4 );But the main problem is to return the thumbnail of the points_type, but this function returns the featured image of the achievement card.
Here is the frontend demo: Achievement Card Frontend
So, How can I get the points_type thumbnail, instead of the featured image of the achievement card?
Thanks!!!
Hi!
Where should I put the snippet?
This means when I put it in the place of <i></i>, it gives a critical error on my staging website.
I also tried this:
return get_the_post_thumbnail( $points_type );in the place of,
return '<i class="fa fa-diamond" aria-hidden="true"></i>';.The FontAwesome icon appears correctly.
But it does not seem to fetch the image of the points.
The snippet only returns the number of points, like :
If the points are set to 20 Gems, it returns only 20, without the later part, in this case, ‘Gems’.
So, is there any mistake and how can I fetch the image/thumbnail of the points type?
Thanks!
Hi!
I want to fetch the Image of the $points_type, instead of the icon
function points_amount_label_gems( $label, $amount, $points_type, $force_return ) { $points_type = gamipress_get_points_type( $points_type ); if ( $points_type ) { // Needs more logic here // Work out which gem to show based on properties of $points_type and return that // e.g. you probably want to set up CSS icons for them and return that here return '<i class="fa fa-diamond" aria-hidden="true"></i>'; } return $label; } add_filter( 'gamipress_get_points_amount_label', 'points_amount_label_gems', 10, 4 );Please, is there a way to return the featured thumbnail image of the respective Points type?
I can’t figure out the src URL of the
tag dynamically in PHP
Thanks!!!
Hi!
Please, as you are mainly focusing on your plugin, you can add this feature to Gamipress, to let users select what they want, like the text (Points), or the Thumbnail (featured Image of the points type post), after the number of points.
This will additionally increase the accessibility of the plugin!
So, Please look into it, in the next update!
Thanks!
Please, I only need a Code Snippet!
I tried this, but the image src is showing unknown, what could have gone wrong?
<?php echo esc_html($args['achievement']['points']); ?> <!-- TEXT STICKER IMAGE --> <img class="text-sticker-image" src="<?php echo esc_url($args['achievement']['points_type']['image_url']); ?>" alt="<?php echo esc_attr($args['achievement']['points_type']['slug']); ?>"> <!-- /TEXT STICKER IMAGE --> <?php endif; ?>- This reply was modified 4 years, 11 months ago by john0865.
But please tell me that where should I put the code!