Skip to content

Instantly share code, notes, and snippets.

@max-kk
Last active June 5, 2019 15:04
Show Gist options
  • Save max-kk/3de86d6911425525f4958fce19b56cc6 to your computer and use it in GitHub Desktop.
Save max-kk/3de86d6911425525f4958fce19b56cc6 to your computer and use it in GitHub Desktop.
<?php
// Copy after
add_shortcode('fv_prize_pool', function($atts){
global $contest_id;
if ( empty($contest_id) ) {
if ( !empty($atts['contest_id'])) {
$contest_id = absint($atts['contest_id']);
} else {
return "No contest ID";
}
}
$count = ModelCompetitors::query()
->where("contest_id", $contest_id)
->where("status", ST_PUBLISHED)
->find(true);
return $count*2;
});
// Usage
// Prize pool: [fv_prize_pool]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment