WPSEO_Cornerstone_Field

Adds a checkbox to the focus keyword section.

Defined (1)

The class is defined in the following location(s).

/admin/class-cornerstone-field.php  
  1. class WPSEO_Cornerstone_Field { 
  2.  
  3. /** 
  4. * Returns a label with a checkbox in it. Make it possible to mark the page as cornerstone content. 
  5. * @param WP_POST $post The post object. 
  6. * @return string The HTML to show. 
  7. */ 
  8. public function get_html( $post ) { 
  9. $return = ''; 
  10. $return .= sprintf( 
  11. '<input id="%1$s" class="wpseo-cornerstone-checkbox" type="checkbox" value="1" name="%1$s" %2$s/>',  
  12. WPSEO_Cornerstone::META_NAME,  
  13. checked( $this->get_meta_value( $post->ID ), '1', false ) 
  14. ); 
  15.  
  16. $return .= sprintf( '<label for="%1$s">', WPSEO_Cornerstone::META_NAME ); 
  17.  
  18. /** translators: 1: link open tag; 2: link close tag. */ 
  19. $return .= sprintf( 
  20. __( 'This article is %1$scornerstone content%2$s', 'wordpress-seo' ),  
  21. '<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/metabox-help-cornerstone' ) . '" target="_blank">',  
  22. '</a>' 
  23. ); 
  24. $return .= '</label>'; 
  25.  
  26. return $return; 
  27.  
  28. /** 
  29. * Gets the meta value from the database. 
  30. * @param int $post_id The post id to get the meta value for. 
  31. * @return null|string The meta value from the database. 
  32. */ 
  33. protected function get_meta_value( $post_id ) { 
  34. return get_post_meta( $post_id, WPSEO_Cornerstone::META_NAME, true );