Advertisement
arie_cristianD

add premium post class in module

May 14th, 2024
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. function jnews_post_class( $class = '', $post_id = null ) {
  2.     $post_type = get_post_type( $post_id );
  3.     // Post Format.
  4.     if ( $post_type && post_type_supports( $post_type, 'post-formats' ) ) {
  5.         $post_format = get_post_format( $post_id );
  6.  
  7.         if ( $post_format && ! is_wp_error( $post_format ) ) {
  8.             $class .= ' format-' . sanitize_html_class( $post_format );
  9.         } else {
  10.             $class .= ' format-standard';
  11.         }
  12.     }
  13.  
  14.     if ( jeg_metabox( 'jnews_paywall_metabox.enable_premium_post', false, $post_id ) ) {
  15.         $class .= ' premium-post';
  16.     }
  17.  
  18.     return 'class="' . $class . '"';
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement