Last active
          April 21, 2017 00:47 
        
      - 
      
- 
        Save mzalewski/32c8fff473192a0e42ac3c422a760a91 to your computer and use it in GitHub Desktop. 
    Code Snippet showing Score in post content
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | add_filter( 'the_content', 'add_review_score_content' ); | |
| function add_review_score_content( $content ) { | |
| global $post; | |
| if ( ! is_singular() || $post->post_type !== 'reviews' ) | |
| { | |
| // It's not a single Review so just return standard content | |
| return $content; | |
| } | |
| $score_value = esc_html( get_field( 'score' ) ); | |
| $score = '<hr /><h3>Our Score: <span class="score" style="float:right;font-weight:bold">' . $score_value . ' / 100</span></h3>'; | |
| return $content . $score; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment