WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Featured images in Achievement page

[Resolved] Featured images in Achievement page

  • hey all, thanks for fantastic plugin. I want to ask, have we a posibility to show achievement picture (as featured image) in “achievement name” cell at table (My achievements, single achievement page, Achievements)? how I can do it? Maybe it has a shortcode like <?php the_post_thumnail(‘thumbnail’); ?>? Thank you!

    http://wordpress.org/extend/plugins/achievements/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Oh, I found it. 🙂 Can use a code from achievement-unlocked.php for featured image. Thanks!

    Plugin Author Paul Gibbs
    BuddyPress Lead Developer

    @djpaul

    Cool, glad you figured it.

    What exactly did you do to get it working? I wanted to implement this into my own site, but my PHP skills are… novice at best

    For those who have the same problem and want to show badges under the name of the achievement, I figured it out:

    Put this line of code into the loop-single-achievement.php file located under wp-content/plugins/achievements/templates/achievements/achievements. You should see this on line 21:
    <a href="<?php dpa_achievement_permalink(); ?>"><?php dpa_achievement_title(); ?></a>
    Underneath that, put this:

    <br />
    		<?php
    				if ( has_post_thumbnail( $notification->ID ) )
    					echo '<a href="' . esc_url( $url ) . '">' . get_the_post_thumbnail( $notification->ID, 'medium', array( 'class' => 'attachment-medium dpa-achievement-unlocked-thumbnail' ) ) . '</a>';
    				?>

    That puts the featured image from that achievement underneath. Hope this helps somebody!

    Plugin Author Paul Gibbs
    BuddyPress Lead Developer

    @djpaul

    Never ever ever modify core WordPress files or files that come with plugins. Just don’t; you loose all your changes when you upgrade to a future version of Achievements, and re-applying the change manually is time-consuming (at best).

    Suggest you copy the modified loop-single-achievement.php into:
    /themes/YOUR_THEME/achievements/loop-single-achievement.php

    I think this will override the template from the version in your theme. Let me know. If it doesn’t, I’ll double-check that I have the directory correct.

    This seems to work for me, thanks for the help! Should help me with other plugins as well =)

    Plugin Author Paul Gibbs
    BuddyPress Lead Developer

    @djpaul

    Neat!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Featured images in Achievement page’ is closed to new replies.