: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
<input type="hidden" name="setting-feed_custom_post" value="' . esc_attr( $feed_custom_post ) . '" />
* Outputs Image Script module in theme settings.
function themify_img_settings( $data = array() ) {
$feature_sizes = themify_get_image_sizes_list();
$imaging_library = wp_image_editor_supports();
$imaging_library_error = '';
if ( ! $imaging_library || themify_is_image_script_disabled() ) {
$checked_use = "checked='checked'";
if ( ! $imaging_library ) {
$disable = ' style="pointer-events: none;"';
$imaging_library_error = '<div class="pushlabel themify_warning note">' . sprintf( __( 'This feature requires an <a href="%s">image processing library</a> to be installed on the server. Please contact your hosting provider to enable this.', 'themify' ), 'https://www.php.net/manual/en/refs.utilspec.image.php' ) . '</div>';
$size = themify_get( 'setting-img_php_base_size', 'large',true );
$global = themify_get( 'setting-global_feature_size','',true );
<div class="themify-info-link">' . sprintf( __( 'The image script is used to generate featured images dynamically in any dimension. If your images are cropped manually, disable it for faster performance. For more info about the image script, refer to the <a href="%s">Image Script</a> documentation.', 'themify' ), 'https://themify.me/docs/image-script' ) . '
<div class="label">' . __( 'Disable', 'themify' ) .themify_help(__( 'Default WordPress image sizes or original images will be used.', 'themify' )) . '</div>
<label for="setting-img_settings_use"' . $disable . '><input type="checkbox" id="setting-img_settings_use" name="setting-img_settings_use" class="disable_img_php" ' . $checked_use . '/> ' . __( 'Disable image script globally', 'themify' ) . '</label>
' . $imaging_library_error . '
<div class="show_if_enabled_img_php">
<div class="label">' . __('Base Image Size', 'themify') .themify_help(__( 'Select the image size that image script will resize thumbnails from. If you\'re not sure, leave it as "Large". Note that this does not affect images already generated.', 'themify' )) . '</div>
<select name="setting-img_php_base_size">';
foreach ( $feature_sizes as $option ) {
$selected = $option['value'] === $size?' selected="selected"':'';
$output .= '<option'.$selected.' value="' . esc_attr( $option['value'] ) . '">' . $option['name'] . '</option>';
<div class="show_if_disabled_img_php">
<div class="label">' . __('Default Featured Image Size', 'themify') . '</div>
<div class="show_if_disabled_img_php row">
<select name="setting-global_feature_size">';
foreach ( $feature_sizes as $option ) {
$selected = $option['value'] === $global?' selected="selected"':'';
$output .= '<option'. $selected.' value="' . esc_attr( $option['value'] ) . '">' . $option['name'] . '</option>';
* Outputs module for user to select whether to use a lightbox or not. The lightbox choices can be filtered using the 'themify_lightbox_module_options' filter in a custom-functions.php file.
function themify_gallery_plugins( $data = array() ) {
$display_options = apply_filters('themify_lightbox_module_options', array(
__( 'Enable', 'themify' ) => 'lightbox',
__( 'Disable', 'themify' ) => 'none'
$gallery_lightbox = themify_get( 'setting-gallery_lightbox',null,true );
<span class="label">' . __( 'WordPress Gallery', 'themify' ) . ' </span>
<select class="gallery_lightbox_type" name="setting-gallery_lightbox">';
foreach ( $display_options as $option => $value ) {
$out .= '<option value="' . $value . '" '.selected( $value, $gallery_lightbox, false ).'>' . esc_html( $option ) . '</option>';
<span class="pushlabel"><label for="setting-lightbox_disable_share">
<input type="checkbox" id="setting-lightbox_disable_share" name="setting-lightbox_disable_share" '. checked( themify_get( 'setting-lightbox_disable_share',false,true ), 'on', false ) .'/> ' . __('Hide social share buttons on lightbox', 'themify') . '</label>
<span class="pushlabel"><label for="setting-lightbox_content_images">
<input type="checkbox" id="setting-lightbox_content_images" name="setting-lightbox_content_images" '. checked( themify_get( 'setting-lightbox_content_images',false,true ), 'on', false ) .'/> ' . __('Apply lightbox to image links automatically', 'themify') . '</label>
<small class="pushlabel">'. __( 'All links to jpg, png, and gif will open in lightbox.', 'themify' ) .'</small>
* Template to display a link in Links module, also used when creating a link.
function themify_add_link_template( $fid, $data = array(), $ajax = false, $type = 'image-icon' ) {
$type_name = $pre.'type_'.$fid;
$type_val = isset($data[$type_name])? $data[$type_name] : 'image-icon';
$title_name = $pre.'title_'.$fid;
$title_val = isset($data[$title_name])? esc_attr(trim($data[$title_name])): '';
$link_name = $pre.'link_'.$fid;
$link_val = isset($data[$link_name])? esc_attr(trim($data[$link_name])) : '';
$img_name = $pre.'img_'.$fid;
$img_val = ! isset( $data[$img_name] ) || '' == $data[$img_name]? '' : esc_attr($data[$img_name]);
$ficon_name = $pre.'ficon_'.$fid;
$ficon_val = trim( isset($data[$ficon_name])? esc_attr($data[$ficon_name]) : '' );
$ficolor_name = $pre.'ficolor_'.$fid;
$ficolor_val = isset($data[$ficolor_name])? esc_attr($data[$ficolor_name]) : '';
$fibgcolor_name = $pre.'fibgcolor_'.$fid;
$fibgcolor_val = isset($data[$fibgcolor_name])? esc_attr($data[$fibgcolor_name]) : '';
* TODO: Add appearance checkboxes
$out = '<li id="' . $fid . '" class="social-link-item ' . $type_val . '">';
$out .= '<div class="social-drag">' . esc_html__('Drag to Sort', 'themify') . '<i class="ti-arrows-vertical"></i></div>';
$out .= '<input type="hidden" name="' . $type_name . '" value="' . trim( $type_val ) . '">';
$out .= '<div class="row">
<span class="label">' . __( 'Title', 'themify' ) . '</span> <input type="text" name="' . $title_name. '" class="width6" value="' . $title_val . '">
$out .= '<div class="row">
<span class="label">' . __( 'Link', 'themify' ) . '</span> <input type="text" name="' . $link_name . '" class="width10" value="' . $link_val . '">
if ( 'font-icon' === $type_val ) {
$out .= '<div class="row">
<span class="label">' . __( 'Icon', 'themify' ) . '</span>';
$out .= sprintf('<input type="text" id="%s" name="%s" value="%s" size="55" class="themify_input_field themify_fa %s" /> <a class="button button-secondary hide-if-no-js themify_fa_toggle" href="#" data-target="#%s">%s</a>',
$ficon_name, $ficon_name, $ficon_val, 'small', $ficon_name, __( 'Insert Icon', 'themify' ) );
$out .= '<div class="icon-preview font-icon-preview">
<i>'.themify_get_icon( $ficon_val ).'</i>
$out .= '<div class="themify_field_row">
<span class="label">' . __('Icon Color', 'themify') . '</span>
<div class="themify_field-color">
<input type="text" data-format="rgba" class="colorSelectInput width4" value="' . $ficolor_val. '" name="' . $ficolor_name . '" />
$out .= '<div class="themify_field_row">
<span class="label">' . __('Background', 'themify') . '</span>
<div class="themify_field-color">
<input type="text" data-format="rgba" class="colorSelectInput width4" value="' . $fibgcolor_val . '" name="' . $fibgcolor_name . '" />
$out .= '<div class="row">
<span class="label">' . __( 'Image', 'themify' ) . '</span>
<div class="uploader-fields image">
<input type="text" id="' . $img_name . '" name="' . $img_name. '" class="width10" value="' . $img_val. '">
<div class="clear image">' . themify_get_uploader( $img_name, array( 'tomedia' => true, 'preview' => true ) ) . '</div>
$out .= '<div class="icon-preview">
<img id="' . $img_name . '-preview" src="' . $img_val . '" loading="lazy" decoding="async" />
$out .= '<a href="#" class="remove-item" data-removelink="' . $fid . '"><span class="tf_close"></span></a>
<!-- /social-links-item -->';
* Outputs module to manage links to be shown using the corresponding widget
function themify_manage_links( $data = array() ) {
$data = themify_get_data();
$field_hash = !empty( $data[$pre.'field_hash'] )? (int)$data[$pre.'field_hash'] : 8;
for ( $i=0; $i < $field_hash; ++$i ) {
$start['themify-link-'.$i] = 'themify-link-'.$i;
//$data[$pre.'field_ids'] = json_encode($start);
$field_ids=themify_get( $pre.'field_ids',false,true );
$field_ids=json_decode( $field_ids, true );
if ( ! is_array( $field_ids ) ) {
$data[$pre.'type_themify-link-0'] = 'image-icon';
$data[$pre.'type_themify-link-1'] = 'image-icon';
$data[$pre.'type_themify-link-2'] = 'image-icon';
$data[$pre.'type_themify-link-3'] = 'image-icon';
$data[$pre.'title_themify-link-0'] = 'Twitter';
$data[$pre.'title_themify-link-1'] = 'Facebook';
$data[$pre.'title_themify-link-2'] = 'YouTube';
$data[$pre.'title_themify-link-3'] = 'Pinterest';
$data[$pre.'link_themify-link-0'] = '';
$data[$pre.'link_themify-link-1'] = '';
$data[$pre.'link_themify-link-2'] = '';
$data[$pre.'link_themify-link-3'] = '';
$data[$pre.'img_themify-link-0'] = THEMIFY_URI . '/img/social/twitter.png';
$data[$pre.'img_themify-link-1'] = THEMIFY_URI . '/img/social/facebook.png';
$data[$pre.'img_themify-link-2'] = THEMIFY_URI . '/img/social/youtube.png';
$data[$pre.'img_themify-link-3'] = THEMIFY_URI . '/img/social/pinterest.png';
$data[$pre.'type_themify-link-4'] = 'font-icon';
$data[$pre.'type_themify-link-5'] = 'font-icon';
$data[$pre.'type_themify-link-6'] = 'font-icon';
$data[$pre.'type_themify-link-7'] = 'font-icon';
$data[$pre.'title_themify-link-4'] = 'Twitter';
$data[$pre.'title_themify-link-5'] = 'Facebook';
$data[$pre.'title_themify-link-6'] = 'YouTube';
$data[$pre.'title_themify-link-7'] = 'Pinterest';
$data[$pre.'link_themify-link-4'] = '';
$data[$pre.'link_themify-link-5'] = '';
$data[$pre.'link_themify-link-6'] = '';
$data[$pre.'link_themify-link-7'] = '';
$data[$pre.'ficon_themify-link-4'] = 'fa-twitter';
$data[$pre.'ficon_themify-link-5'] = 'fa-facebook';
$data[$pre.'ficon_themify-link-6'] = 'fa-youtube';
$data[$pre.'ficon_themify-link-7'] = 'fa-pinterest';
$data[$pre.'ficolor_themify-link-4'] = '';
$data[$pre.'ficolor_themify-link-5'] = '';
$data[$pre.'ficolor_themify-link-6'] = '';
$data[$pre.'ficolor_themify-link-7'] = '';
$data[$pre.'fibgcolor_themify-link-4'] = '';
$data[$pre.'fibgcolor_themify-link-5'] = '';
$data[$pre.'fibgcolor_themify-link-6'] = '';
$data[$pre.'fibgcolor_themify-link-7'] = '';
$data = apply_filters('themify_default_social_links', $data);
$out = '<div class="themify-info-link">' . sprintf( __( 'To display the links: go to Appearance > <a href="%s">Widgets</a> and drop a Themify - Social Links widget in a widget area (<a href="%s" target="_blank" rel="noopener">learn more</a>)', 'themify' ), admin_url('widgets.php'), 'https://themify.me/docs/social-media-links') . '</div>';
$out .= '<div id="social-link-type">';
$out .= '<label for="' . $pre . 'font_icon">';
$out .= '<input ' . checked( isset( $data[$pre.'icon_type'] )? $data[$pre.'icon_type'] : 'font-icon', 'font-icon', false) . ' type="radio" id="' . $pre . 'font_icon" name="' . $pre . 'icon_type" value="font-icon" data-hide="image-icon" /> ';
$out .= __( 'Icon Font', 'themify' ) . '</label>';
$out .= '<label for="' . $pre . 'image_icon">';
$out .= '<input ' . checked( isset( $data[$pre.'icon_type'] )? $data[$pre.'icon_type'] : '', 'image-icon', false ) . ' type="radio" id="' . $pre . 'image_icon" name="' . $pre . 'icon_type" value="image-icon" data-hide="font-icon" /> ';
$out .= __( 'Image', 'themify' ) . '</label>';
$out .= '<ul id="social-links-wrapper">';
foreach ( $field_ids as $fid ) {
$out .= themify_add_link_template( $fid, $data );
$out .= '<p class="add-link add-social-link"><a href="#">' . __('Add Link', 'themify') . '</a></p>';
$out .= '<input type="hidden" id="' . $pre . 'field_ids" name="' . $pre . 'field_ids" value=\'' . json_encode( $field_ids ) . '\'/>';
$out .= '<input type="hidden" id="' . $pre . 'field_hash" name="' . $pre . 'field_hash" value="' . esc_attr( $field_hash ) . '"/>';
//$out .= '<p>Fields: '.json_encode($field_ids).'</p><p>Hash: '.$field_hash.'</p>';
* Outputs post meta options
* @param string $pmkey Key used to get data from theme settings array
* @param array $data Theme settings data
* @param array $metas Optional array stating the metas available.
* @return string $out Markup for options
function themify_post_meta_options( $pmkey, $data, $metas = array(), $states = array(), $group_label = false ) {
'' => __( 'Hide All', 'themify' ),
'author' => __( 'Author', 'themify' ),
'category' => __( 'Category', 'themify' ),
'comment' => __( 'Comment', 'themify' ),
'tag' => __( 'Tag', 'themify' )
if ( empty( $states ) ) {
'name' => __( 'Hide', 'themify' ),
'icon' => THEMIFY_URI . '/img/ddbtn-cross.svg',
'title' => __( 'Hide this meta', 'themify' )
'name' => __( 'Show', 'themify' ),
'icon' => THEMIFY_URI . '/img/ddbtn-check.svg',
'title' => __( 'Show this meta', 'themify' )
$group_label = __( 'Post Meta', 'themify' );
'name' => __( 'Theme', 'themify' ),
'icon' => THEMIFY_URI . '/img/ddbtn-blank.png',
'title' => esc_attr(__( 'Use theme settings', 'themify' ))
$out = '<div class="themify_field_row dropdownbutton-group"><span class="label">' . esc_html( $group_label ) . '</span>';
foreach ( $metas as $meta => $name ) {
$meta_class = 'ddbtn-all';
$metakey = $pmkey.'_'.$meta;
$meta_class = 'ddbtn-sub ddbtn-'.$meta;
$out .= '<div id="' . $metakey. '" class="dropdownbutton-list" data-name="' . $name . '" data-def-icon="' . $default['icon']. '">';
<div class="first-ddbtn">
<a href="#" data-val="' . $default['value'] . '" data-name="' . $default['name'] . '" title="' . $default['title'] . '">
<img src="' . $default['icon'] . '" title="' . $default['title'] . '" loading="lazy" decoding="async" />
<span class="ddbtn-name">' . $name . '</span>
foreach ( $states as $state ) {
$title=esc_attr($state['title']);
if ( isset( $state['value'] ) && isset( $data[$metakey] ) && $state['value'] === $data[$metakey] ) {
$first = '<div class="first-ddbtn">
<a href="#" data-val="' . $state['value'] . '" data-name="' . $state['name'] . '" title="' . $title. '">
<img src="' . $state['icon']. '" title="' . $title . '" loading="lazy" decoding="async" />
<span class="ddbtn-name">' . $name . '</span>
<a href="#" data-sel="' . $selected. '" data-val="' . $state['value'] . '" data-name="' . $state['name'] . '" title="' . $title . '">
<img src="' . $state['icon'] . '" title="' . $title. '" loading="lazy" decoding="async" />
<span class="ddbtn-label">' . esc_html( $state['name'] ) . '</span>
$out .= $first . '<div class="dropdownbutton">' . $others . '</div>';
$out .= '<input type="hidden" value="' . esc_attr( themify_get( $metakey ) ) . '" class="' . $meta_class. '" id="' . $metakey . '" name="' . $metakey . '" />';
* Outputs post sorting options
* @param string $key Key used to get data from theme settings array
* @param array $data Theme settings data
* @return string $out Markup for options
if ( ! function_exists( 'themify_post_sorting_options' ) ) {
function themify_post_sorting_options( $key = 'setting-index_order', $data = array() ) {
$orderby = themify_get( $key . 'by','');
$orderby_options = apply_filters( 'themify_index_orderby_options', array(
__( 'Date (default)', 'themify' ) => 'date',
__( 'Random', 'themify' ) => 'rand',
__( 'Author', 'themify' ) => 'author',
__( 'Post Title', 'themify' ) => 'title',
__( 'Comments Number', 'themify' ) => 'comment_count',
__( 'Modified Date', 'themify' ) => 'modified',
__( 'Post Slug', 'themify' ) => 'name',
__( 'Post ID', 'themify' ) => 'ID',
__( 'Custom Field String', 'themify' ) => 'meta_value',
__( 'Custom Field Numeric', 'themify' ) => 'meta_value_num' ) );
$order = themify_get( $key,'');
__( 'Descending (default)', 'themify' ) => 'DESC',
__( 'Ascending', 'themify' ) => 'ASC' );
$order_meta_key = 'setting-index_meta_key';
$out = '<p><span class="label">' . __( 'Order By', 'themify' ) . ' </span>
<select name="' .$key . 'by">';
foreach ( $orderby_options as $option => $value ) {
$out .= '<option value="' . esc_attr( $value ) . '" '.selected( $value, $orderby, false ).'>' . esc_html( $option ) . '</option>';
<p data-show-if-element="[name=' . $key . 'by]" data-show-if-value=\'["meta_value", "meta_value_num"]\'>
<span class="label">' . __( 'Custom Field Key', 'themify' ) . ' </span>
<input type="text" id="' . $order_meta_key . '" name="' . $order_meta_key . '" value="' . esc_attr( themify_get( $order_meta_key,'',true ) ) . '" />
<span class="label">' . __( 'Order', 'themify' ) . ' </span>
<select name="' . $key. '">';
foreach ( $order_options as $option => $value ) {
$out .= '<option value="' . esc_attr( $value ) . '" '.selected( $value, $order, false ).'>' . esc_html( $option ) . '</option>';
if ( ! function_exists( 'themify_homepage_welcome' ) ) {
* Homepage Welcome Function
* @return string Markup for welcome text control
function themify_homepage_welcome() {
return '<p><textarea class="widthfull" name="setting-homepage_welcome" rows="4">' . esc_textarea( themify_get( 'setting-homepage_welcome','',true ) ) . '</textarea></p>';
if ( ! function_exists( 'themify_exclude_rss' ) ) {
function themify_exclude_rss() {
return '<p><label for="setting-exclude_rss"><input type="checkbox" id="setting-exclude_rss" name="setting-exclude_rss" ' . checked( themify_get( 'setting-exclude_rss','',true ), 'on', false ) . '/> ' . __( 'Check here to exclude RSS icon/button in the header', 'themify' ) . '</label></p>';
if ( ! function_exists( 'themify_exclude_search_form' ) ) {
function themify_exclude_search_form() {
return '<p><label for="setting-exclude_search_form"><input type="checkbox" id="setting-exclude_search_form" name="setting-exclude_search_form" ' . checked( themify_get( 'setting-exclude_search_form','',true ), 'on', false ) . '/> ' . __( 'Check here to exclude search form in the header', 'themify' ) . '</label></p>';
if( ! function_exists( 'footer_text_settings' ) ) {