: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
exit; // Exit if accessed directly
* Module Name: Related Posts
* Description: Display related posts by category/tag in single post templates
class TB_Related_Posts_Module extends Themify_Builder_Component_Module {
parent::__construct(array(
'name' => __('Related Posts', 'tbp'),
'slug' => 'related-posts',
'category' => array('single')
add_filter( 'builder_get_public_post_types', array( __CLASS__, 'get_current_post_type' ) );
public function get_icon(){
public function get_options() {
$post_meta = Tbp_Utils::get_module_settings('post-meta','options');
foreach($post_meta as $k=>$v){
unset($post_meta[$k]['label']);
if($v['type']==='tbp_custom_css'){
$post_title = Tbp_Utils::get_module_settings('post-title','options');
foreach($post_title as $k=>$v){
if($v['type']==='tbp_custom_css'){
$post_image = Tbp_Utils::get_module_settings('featured-image','options');
foreach($post_image as $k=>$v){
if($v['type']==='tbp_custom_css'){
$post_content = Tbp_Utils::get_module_settings('post-content','options');
foreach($post_content as $k=>$v){
if($v['type']==='tbp_custom_css'){
unset($post_content[$k]);
'label' => __('Heading', 'tbp')
'id' => 'term_type_select',
'label' => __('Show related posts by', 'tbp'),
'wrap_class' => 'tb_hide_just_current'
'label' => __('Layout', 'tbp'),
'classSelector'=>'.tbp_posts_wrap'
array('img' => 'list_post', 'value' => 'list_post', 'label' => __('List Post', 'tbp')),
array('img' => 'grid2', 'value' => 'grid2', 'label' => __('Grid 2', 'tbp')),
array('img' => 'grid3', 'value' => 'grid3', 'label' => __('Grid 3', 'tbp')),
array('img' => 'grid4', 'value' => 'grid4', 'label' => __('Grid 4', 'tbp')),
array('img' => 'grid5', 'value' => 'grid5', 'label' => __('Grid 5', 'tbp')),
array('img' => 'grid6', 'value' => 'grid6', 'label' => __('Grid 6', 'tbp'))
'label' => __('Number of entries', 'tbp'),
'id' => 'tab_content_archive_posts',
'type' => 'toggleable_fields',
'label' => __( 'Featured Image', 'tbp'),
'label' => __('Title', 'tbp'),
'label' => __( 'Post Date', 'tbp'),
'label' => __('Date Format', 'tbp'),
'F j, Y' => __( 'August 18, 2019 (F j, Y)', 'tbp'),
'Y-m-d' => __( '2019-08-18 (Y-m-d)', 'tbp'),
'm/d/Y' => __( '08/18/2019 (m/d/Y)', 'tbp'),
'd/m/Y' => __('18/08/2019 (d/m/Y)', 'tbp'),
'def' => __('Default', 'tbp'),
'custom' => __('Custom Format', 'tbp')
'custom' => array( 'show' => 'custom'),
'F j, Y' => array( 'hide' => 'custom' ),
'Y-m-d' => array( 'hide' => 'custom' ),
'm/d/Y' => array( 'hide' => 'custom' ),
'd/m/Y' => array( 'hide' => 'custom' ),
'def' => array( 'hide' =>'custom')
'label' => __( 'Custom Format', 'tbp'),
'help' => __( 'Enter date format in these letters: l D d j S F m M n Y y', 'tbp')
'label' => __('Icon', 'tbp')
'label' => __('Before Text', 'tbp')
'label' => __('After Text', 'tbp')
'label' => __( 'Post Meta', 'tbp'),
'label' => __( 'Content', 'tbp'),
'options' => $post_content
'label' => __( 'More Link', 'tbp'),
'label' => __('Link', 'tbp'),
array( 'name' => __( 'Permalink', 'tbp'), 'value' => 'permalink' ),
array( 'name' => __( 'None', 'tbp'), 'value' => 'none' )
'label' => __('More Text', 'tbp')
array('type' => 'tbp_custom_css')
public function get_styling() {
self::get_expand('bg', array(
self::get_image('', 'b_c_g', 'bg_c', 'background-color')
self::get_image(':hover', 'b_c_g_h', 'bg_c_h', 'background-color', 'h')
self::get_expand('f', array(
self::get_font_family('', 'f_f_g'),
self::get_color_type(array(' span', ' p', ' .tbp_post_date', '.module .tbp_title', '.module .tbp_title a')),
self::get_font_size('', 'f_s_g'),
self::get_line_height('', 'l_h_g'),
self::get_letter_spacing(' .post', 'l_s_g'),
self::get_text_align(' .post', 't_a_g'),
self::get_text_transform('', 't_t_g'),
self::get_font_style('', 'f_g', 'f_b'),
self::get_text_shadow('', 't_sh'),
self::get_font_family('', 'f_f_g', 'h'),
self::get_color_type(array(' span', ' p', ' .tbp_post_date', '.module .tbp_title', '.module .tbp_title a'), 'h'),
self::get_font_size('', 'f_s_g', '', 'h'),
self::get_line_height('', 'l_h_g', 'h'),
self::get_letter_spacing(' .post', 'l_s_g', 'h'),
self::get_text_align(' .post', 't_a_g', 'h'),
self::get_text_transform('', 't_t_g', 'h'),
self::get_font_style('', 'f_g', 'f_b', 'h'),
self::get_text_shadow('','t_sh','h'),
self::get_expand( 'l', array(
self::get_color( ' a:not(.post-edit-link)', 'l_c_gl' ),
self::get_text_decoration( 'a:not(.post-edit-link)', 't_d_gl' )
self::get_color( ' .post a:not(.post-edit-link):hover', 'l_c_gl_h', null, null, '' ),
self::get_text_decoration( ' .post a:not(.post-edit-link):hover', 't_d_gl_h', '' )
self::get_expand('p', array(
self::get_padding('', 'g_p')
self::get_padding('', 'g_p', 'h')
self::get_expand('m', array(
self::get_margin('', 'g_m')
self::get_margin('', 'g_m', 'h')
self::get_expand('b', array(
self::get_border('', 'g_b')
self::get_border('', 'g_b', 'h')
'options' => count($a = self::get_blend(' .loops-wrapper .post'))>2 ? array($a) : $a
'options' => count($a = self::get_blend(' .loops-wrapper .post','bl_m_h','h'))>2 ? array($a + array('ishover'=>true)) : $a
self::get_expand('w', array(
self::get_width('', 'w', 'h')
! method_exists( $this, 'get_max_height' ) ? array() :
self::get_expand('ht', array(
self::get_expand('r_c', array(
self::get_border_radius('', 'r_c')
self::get_border_radius('', 'r_c', 'h')
self::get_expand('sh', array(
self::get_box_shadow('', 'g_sh')
self::get_box_shadow('', 'g_sh', 'h')
self::get_expand('disp', self::get_display())
$archive_post_container = array(
self::get_expand('bg', array(
self::get_color(' .post', 'b_c_a_p_cn', 'bg_c', 'background-color')
self::get_color(' .post', 'b_c_a_p_cn', 'bg_c', 'background-color', 'h')
self::get_expand('p', array(
self::get_padding(' .post', 'p_cn')
self::get_padding(' .post', 'p_cn', 'h')
self::get_expand('m', array(
self::get_heading_margin_multi_field(' .post', '', 'top', 'article'),
self::get_heading_margin_multi_field(' .post', '', 'bottom', 'article')
self::get_heading_margin_multi_field(' .post', '', 'top', 'article', 'h'),
self::get_heading_margin_multi_field(' .post', '', 'bottom', 'article', 'h')
self::get_expand('b', array(
self::get_border(' .post', 'b_cn')
self::get_border(' .post', 'b_cn', 'h')
self::get_expand('r_c', array(
self::get_border_radius(' .post', 'r_c_cn')
self::get_border_radius(' .post', 'r_c_cn', 'h')
self::get_expand('sh', array(
self::get_box_shadow(' .post', 'sh_cn')
self::get_box_shadow(' .post', 'sh_cn', 'h')
$archive_post_title = array(
self::get_expand('bg', array(
self::get_color('.module .tbp_title', 'b_c_a_p_t', 'bg_c', 'background-color')
self::get_color('.module .tbp_title', 'b_c_a_p_t', 'bg_c', 'background-color', 'h')
self::get_expand('f', array(
self::get_font_family('.module .tbp_title', 'f_f_a_p_t'),
self::get_color(array('.module .tbp_title', ' .tbp_title a'), 'f_c_a_p_t'),
self::get_font_size('.module .tbp_title', 'f_s_a_p_t'),
self::get_line_height('.module .tbp_title', 'l_h_a_p_t'),
self::get_letter_spacing('.module .tbp_title', 'l_s_a_p_t'),
self::get_text_transform('.module .tbp_title', 't_t_a_p_t'),
self::get_font_style('.module .tbp_title', 'f_sy_a_p_t', 'f_w_a_p_t'),
self::get_text_decoration('.module .tbp_title', 't_d_a_p_t'),
self::get_text_shadow('.module .tbp_title', 't_sh_a_p_t'),
self::get_font_family('.module .tbp_title', 'f_f_a_p_t', 'h'),
self::get_color(array('.module .tbp_title', ' .tbp_title a'), 'f_c_a_p_t', null, null, 'hover'),
self::get_font_size('.module .tbp_title', 'f_s_a_p_t', '', 'h'),
self::get_line_height('.module .tbp_title', 'l_h_a_p_t', 'h'),
self::get_letter_spacing('.module .tbp_title', 'l_s_a_p_t', 'h'),