WordPress.org

Forums

Achievements for WordPress
[resolved] Featured images in Achievement page (8 posts)

  1. Darkooo
    Member
    Posted 2 years ago #

    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/

  2. Darkooo
    Member
    Posted 2 years ago #

    Oh, I found it. :) Can use a code from achievement-unlocked.php for featured image. Thanks!

  3. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 2 years ago #

    Cool, glad you figured it.

  4. Atoro
    Member
    Posted 2 years ago #

    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

  5. Atoro
    Member
    Posted 2 years ago #

    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!

  6. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 2 years ago #

    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.

  7. Atoro
    Member
    Posted 2 years ago #

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

  8. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 2 years ago #

    Neat!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Achievements for WordPress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic