PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.0.6
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.0.6
3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 All 194 releases
convertkit / includes / class-convertkit-output-broadcasts.php

class-convertkit-output-broadcasts.php in Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages 3.0.6, at includes/class-convertkit-output-broadcasts.php

56 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * ConvertKit Output Broadcasts class.
4 *
5 * @package ConvertKit
6 * @author ConvertKit
7 */
8
9 /**
10 * Applies a body CSS class to Posts, Pages and Custom Posts
11 * that were imported from Kit's Broadcasts, to allow
12 * CSS to target common themes that may override some
13 * broadcast styling.
14 *
15 * @since 2.7.4
16 */
17 class ConvertKit_Output_Broadcasts {
18
19 /**
20 * Constructor.
21 *
22 * @since 2.7.4
23 */
24 public function __construct() {
25
26 add_filter( 'body_class', array( $this, 'maybe_add_body_class' ) );
27
28 }
29
30 /**
31 * Adds a .convertkit-broadcast CSS class to Posts, Pages and Custom Posts
32 * <body> tag where the content was imported from a Kit Broadcast.
33 *
34 * @since 2.7.4
35 *
36 * @param array $css_classes CSS classes for body tag.
37 * @return array
38 */
39 public function maybe_add_body_class( $css_classes ) {
40
41 // Don't add a CSS class if the request isn't for an imported Broadcast.
42 if ( ! is_singular() ) {
43 return $css_classes;
44 }
45
46 if ( empty( get_post_meta( get_the_ID(), '_convertkit_broadcast_id', true ) ) ) {
47 return $css_classes;
48 }
49
50 $css_classes[] = 'convertkit-broadcast';
51 return $css_classes;
52
53 }
54
55 }
56