$headerPhonePreviewUrl, 'generateRelatedUrl' => $generateRelatedUrl, 'optimizeImagesUrl' => $optimizeImagesUrl, 'optimizeImagesStatuses' => array( 'error' => TT_IMG_RESIZE_STATUS_ERROR, 'not_started' => TT_IMG_RESIZE_STATUS_NOT_STARTED, 'started' => TT_IMG_RESIZE_STATUS_STARTED, 'finished' => TT_IMG_RESIZE_STATUS_FINISHED ), 'optimizeImagesTypes' => array( 'scale' => TT_IMG_RESIZE_TYPE_SCALE, 'scale_and_crop' => TT_IMG_RESIZE_TYPE_SCALE_AND_CROP, 'default' => TT_IMG_RESIZE_TYPE_DEFAULT ), 'optimizeImagesLabels' => array( 'in_progress' => __( "Thumbnails resizing in progress", 'thrive' ), 'paused' => __( "Click to resume the image optimization process", 'thrive' ), 'finished' => __( "Your images are optimized for the current theme", 'thrive' ), 'not_started' => __( "Click to start the image optimization process", 'thrive' ), 'set_wp_default' => __( "Click to use the default images", 'thrive' ), 'resized_msg' => __( "Image resized ", 'thrive' ) ), 'useDefaultWpSizesUrl' => $default_wp_sizes_url, 'noonce' => $wpnonce ); wp_localize_script( 'thrive-theme-options', 'ThriveThemeOptions', $js_params_array ); require( get_template_directory() . "/inc/templates/admin-theme-options.php" ); } /* * Validate the theme options */ function thrive_theme_options_validate( $input ) { $current_options = thrive_get_theme_options(); /* * Stop here if the input is not coming from one of our pages or if the user * doesn't have the permissions to modify the theme options * (if the favicons is not set it means that is not coming from the theme options * and if privacy_tpl_website is not set in the post it means that is not coming from * the page templates options */ if ( ! current_user_can( 'edit_theme_options' ) || ( ! isset( $input['logo_type'] ) && ! isset( $input['logo'] ) && ! isset( $input['privacy_tpl_website'] ) ) ) { return $current_options; } $defaults = thrive_get_default_theme_options(); $output = $current_options; if ( isset( $input['logo'] ) ) { $output['logo'] = $input['logo']; $logo_size = @getimagesize( $input['logo'] ); if ( $logo_size ) { list( $logo_width, $logo_height, $logo_type, $logo_attr ) = @getimagesize( $input['logo'] ); if ( $logo_height ) { $output['logo_height'] = $logo_height; } if ( $logo_width ) { $output['logo_width'] = $logo_width; } } } if ( isset( $input['favicon'] ) ) { $output['favicon'] = $input['favicon']; } if ( isset( $input['footer_copyright'] ) ) { $output['footer_copyright'] = $input['footer_copyright']; } if ( isset( $input['footer_copyright_links'] ) ) { $output['footer_copyright_links'] = $input['footer_copyright_links']; } if ( isset( $input['display_breadcrumbs'] ) ) { $output['display_breadcrumbs'] = $input['display_breadcrumbs']; } if ( isset( $input['comments_on_pages'] ) ) { $output['comments_on_pages'] = $input['comments_on_pages']; } if ( isset( $input['color_scheme'] ) ) { $output['color_scheme'] = $input['color_scheme']; } if ( isset( $input['sidebar_alignement'] ) ) { $output['sidebar_alignement'] = $input['sidebar_alignement']; } if ( isset( $input['extended_menu'] ) ) { $output['extended_menu'] = $input['extended_menu']; } if ( isset( $input['custom_css'] ) ) { $output['custom_css'] = $input['custom_css']; } if ( isset( $input['featured_image_style'] ) ) { $output['featured_image_style'] = $input['featured_image_style']; } if ( isset( $input['featured_image_single_post'] ) ) { $output['featured_image_single_post'] = $input['featured_image_single_post']; } if ( isset( $input['meta_author_name'] ) ) { $output['meta_author_name'] = $input['meta_author_name']; } if ( isset( $input['meta_post_date'] ) ) { $output['meta_post_date'] = $input['meta_post_date']; } if ( isset( $input['meta_post_category'] ) ) { $output['meta_post_category'] = $input['meta_post_category']; } if ( isset( $input['meta_post_tags'] ) ) { $output['meta_post_tags'] = $input['meta_post_tags']; } if ( isset( $input['meta_comment_count'] ) ) { $output['meta_comment_count'] = $input['meta_comment_count']; } if ( isset( $input['bottom_about_author'] ) ) { $output['bottom_about_author'] = $input['bottom_about_author']; } if ( isset( $input['bottom_previous_next'] ) ) { $output['bottom_previous_next'] = $input['bottom_previous_next']; } if ( isset( $input['related_posts_box'] ) ) { $output['related_posts_box'] = $input['related_posts_box']; } if ( isset( $input['related_posts_title'] ) ) { $output['related_posts_title'] = $input['related_posts_title']; } if ( isset( $input['related_posts_number'] ) ) { $output['related_posts_number'] = $input['related_posts_number']; } if ( isset( $input['related_posts_images'] ) ) { $output['related_posts_images'] = $input['related_posts_images']; } if ( isset( $input['other_read_more_type'] ) ) { $output['other_read_more_type'] = $input['other_read_more_type']; } if ( isset( $input['other_read_more_text'] ) ) { $output['other_read_more_text'] = $input['other_read_more_text']; } if ( isset( $input['hide_cats_from_blog'] ) ) { $output['hide_cats_from_blog'] = $input['hide_cats_from_blog']; } if ( isset( $input['analytics_header_script'] ) ) { $output['analytics_header_script'] = $input['analytics_header_script']; } if ( isset( $input['analytics_body_script'] ) ) { $output['analytics_body_script'] = $input['analytics_body_script']; } if ( isset( $input['analytics_body_script_top'] ) ) { $output['analytics_body_script_top'] = $input['analytics_body_script_top']; } if ( isset( $input['other_show_comment_date'] ) ) { $output['other_show_comment_date'] = $input['other_show_comment_date']; } if ( isset( $input['image_optimization_type'] ) ) { $output['image_optimization_type'] = $input['image_optimization_type']; } if ( isset( $input['relative_time'] ) ) { $output['relative_time'] = $input['relative_time']; } if ( isset( $input['highlight_author_comments'] ) ) { $output['highlight_author_comments'] = $input['highlight_author_comments']; } if ( isset( $input['comments_lazy'] ) ) { $output['comments_lazy'] = $input['comments_lazy']; } if ( isset( $input['enable_fb_comments'] ) ) { $output['enable_fb_comments'] = $input['enable_fb_comments']; } if ( isset( $input['fb_app_id'] ) ) { $output['fb_app_id'] = $input['fb_app_id']; } if ( isset( $input['fb_moderators'] ) ) { $output['fb_moderators'] = empty( $input['fb_moderators'] ) ? array() : array_filter( $input['fb_moderators'] ); $output['fb_moderators'] = array_values( $output['fb_moderators'] ); } if ( isset( $input['fb_no_comments'] ) ) { $output['fb_no_comments'] = $input['fb_no_comments']; } if ( isset( $input['fb_color_scheme'] ) ) { $output['fb_color_scheme'] = $input['fb_color_scheme']; } if ( isset( $input['privacy_tpl_website'] ) ) { $output['privacy_tpl_website'] = $input['privacy_tpl_website']; } if ( isset( $input['privacy_tpl_address'] ) ) { $output['privacy_tpl_address'] = $input['privacy_tpl_address']; } if ( isset( $input['privacy_tpl_company'] ) ) { $output['privacy_tpl_company'] = $input['privacy_tpl_company']; } if ( isset( $input['privacy_tpl_contact'] ) ) { $output['privacy_tpl_contact'] = $input['privacy_tpl_contact']; } if ( isset( $input['blog_layout'] ) ) { $output['blog_layout'] = $input['blog_layout']; } if ( isset( $input['color_scheme'] ) && $input['color_scheme'] != $current_options['color_scheme'] ) { thrive_set_default_customizer_options( $input['color_scheme'], true ); } if ( isset( $input['logo_type'] ) ) { $output['logo_type'] = $input['logo_type']; } if ( isset( $input['logo_text'] ) ) { $output['logo_text'] = $input['logo_text']; } if ( isset( $input['logo_color'] ) ) { $output['logo_color'] = $input['logo_color']; } if ( isset( $input['enable_social_buttons'] ) ) { $output['enable_social_buttons'] = $input['enable_social_buttons']; } if ( isset( $input['enable_floating_icons'] ) ) { $output['enable_floating_icons'] = intval( $input['enable_floating_icons'] ); } if ( isset( $input['enable_twitter_button'] ) ) { $output['enable_twitter_button'] = $input['enable_twitter_button']; } if ( isset( $input['social_twitter_username'] ) ) { $output['social_twitter_username'] = $input['social_twitter_username']; } // if ( isset( $input['enable_facebook_button'] ) ) { // $output['enable_facebook_button'] = $input['enable_facebook_button']; // } if ( isset( $input['enable_google_button'] ) ) { $output['enable_google_button'] = $input['enable_google_button']; } if ( isset( $input['enable_linkedin_button'] ) ) { $output['enable_linkedin_button'] = $input['enable_linkedin_button']; } if ( isset( $input['enable_pinterest_button'] ) ) { $output['enable_pinterest_button'] = $input['enable_pinterest_button']; } if ( isset( $input['social_display_location'] ) ) { $output['social_display_location'] = $input['social_display_location']; } if ( isset( $input['social_attention_grabber'] ) ) { $output['social_attention_grabber'] = $input['social_attention_grabber']; } if ( isset( $input['social_cta_text'] ) ) { $output['social_cta_text'] = $input['social_cta_text']; } if ( isset( $input['social_site_name'] ) ) { $output['social_site_name'] = $input['social_site_name']; } if ( isset( $input['social_site_title'] ) ) { $output['social_site_title'] = $input['social_site_title']; } if ( isset( $input['social_site_description'] ) ) { $output['social_site_description'] = $input['social_site_description']; } if ( isset( $input['social_site_image'] ) ) { $output['social_site_image'] = $input['social_site_image']; } if ( isset( $input['social_site_twitter_username'] ) ) { $output['social_site_twitter_username'] = $input['social_site_twitter_username']; } if ( isset( $input['social_add_like_btn'] ) ) { $output['social_add_like_btn'] = $input['social_add_like_btn']; } if ( isset( $input['other_show_excerpt'] ) ) { $output['other_show_excerpt'] = $input['other_show_excerpt']; } if ( isset( $input['logo_position'] ) ) { $output['logo_position'] = $input['logo_position']; } if ( isset( $input['navigation_type'] ) ) { $output['navigation_type'] = $input['navigation_type']; } if ( isset( $input['social_custom_posts'] ) ) { $output['social_custom_posts'] = $input['social_custom_posts']; } if ( isset( $input['header_phone_no'] ) ) { $output['header_phone_no'] = $input['header_phone_no']; } if ( isset( $input['header_phone_text'] ) ) { $output['header_phone_text'] = $input['header_phone_text']; } if ( isset( $input['header_phone'] ) ) { $output['header_phone'] = $input['header_phone']; } if ( isset( $input['header_phone_text_mobile'] ) ) { $output['header_phone_text_mobile'] = $input['header_phone_text_mobile']; } if ( isset( $input['header_phone_btn_color'] ) ) { $output['header_phone_btn_color'] = $input['header_phone_btn_color']; } if ( isset( $input['404_custom_text'] ) ) { $output['404_custom_text'] = $input['404_custom_text']; } if ( isset( $input['404_display_sitemap'] ) ) { $output['404_display_sitemap'] = $input['404_display_sitemap']; } if ( isset( $input['related_no_text'] ) ) { $output['related_no_text'] = $input['related_no_text']; } if ( isset( $input['related_ignore_cats'] ) ) { $output['related_ignore_cats'] = $input['related_ignore_cats']; } if ( isset( $input['related_ignore_tags'] ) ) { $output['related_ignore_tags'] = $input['related_ignore_tags']; } if ( isset( $input['related_number_posts'] ) ) { $output['related_number_posts'] = $input['related_number_posts']; } if ( isset( $input['related_posts_enabled'] ) ) { $output['related_posts_enabled'] = $input['related_posts_enabled']; } //apprentice stuff if ( isset( $input['appr_enable_feature'] ) ) { $output['appr_enable_feature'] = $input['appr_enable_feature']; } if ( isset( $input['appr_different_logo'] ) ) { $output['appr_different_logo'] = $input['appr_different_logo']; } if ( isset( $input['appr_logo'] ) ) { $output['appr_logo'] = $input['appr_logo']; } if ( isset( $input['appr_logo_type'] ) ) { $output['appr_logo_type'] = $input['appr_logo_type']; } if ( isset( $input['appr_logo_text'] ) ) { $output['appr_logo_text'] = $input['appr_logo_text']; } if ( isset( $input['appr_logo_color'] ) ) { $output['appr_logo_color'] = $input['appr_logo_color']; } if ( isset( $input['appr_logo_position'] ) ) { $output['appr_logo_position'] = $input['appr_logo_position']; } if ( isset( $input['appr_breadcrumbs'] ) ) { $output['appr_breadcrumbs'] = $input['appr_breadcrumbs']; } if ( isset( $input['appr_root_page'] ) ) { $output['appr_root_page'] = $input['appr_root_page']; } if ( isset( $input['appr_sidebar'] ) ) { $output['appr_sidebar'] = $input['appr_sidebar']; } if ( isset( $input['appr_page_comments'] ) ) { $output['appr_page_comments'] = $input['appr_page_comments']; } if ( isset( $input['appr_prev_next_link'] ) ) { $output['appr_prev_next_link'] = $input['appr_prev_next_link']; } if ( isset( $input['appr_media_bg_color'] ) ) { $output['appr_media_bg_color'] = $input['appr_media_bg_color']; } if ( isset( $input['appr_favorites'] ) ) { $output['appr_favorites'] = $input['appr_favorites']; } if ( isset( $input['appr_progress_track'] ) ) { $output['appr_progress_track'] = $input['appr_progress_track']; } if ( isset( $input['appr_completed_text'] ) ) { $output['appr_completed_text'] = $input['appr_completed_text']; } if ( isset( $input['appr_download_heading'] ) ) { $output['appr_download_heading'] = $input['appr_download_heading']; } if ( isset( $input['appr_replace_lesson'] ) ) { $output['appr_replace_lesson'] = $input['appr_replace_lesson']; } if ( isset( $input['appr_url_pages'] ) ) { $output['appr_url_pages'] = $input['appr_url_pages']; } if ( isset( $input['appr_url_lessons'] ) ) { $output['appr_url_lessons'] = $input['appr_url_lessons']; } if ( isset( $input['appr_url_categories'] ) ) { $output['appr_url_categories'] = $input['appr_url_categories']; } if ( isset( $input['appr_url_tags'] ) ) { $output['appr_url_tags'] = $input['appr_url_tags']; } if ( isset( $input['appr_meta_author_name'] ) ) { $output['appr_meta_author_name'] = $input['appr_meta_author_name']; } if ( isset( $input['appr_meta_post_date'] ) ) { $output['appr_meta_post_date'] = $input['appr_meta_post_date']; } if ( isset( $input['appr_meta_post_category'] ) ) { $output['appr_meta_post_category'] = $input['appr_meta_post_category']; } if ( isset( $input['appr_meta_post_tags'] ) ) { $output['appr_meta_post_tags'] = $input['appr_meta_post_tags']; } if ( isset( $input['appr_meta_comment_count'] ) ) { $output['appr_meta_comment_count'] = $input['appr_meta_comment_count']; } if ( isset( $input['appr_bottom_about_author'] ) ) { $output['appr_bottom_about_author'] = $input['appr_bottom_about_author']; } if ( isset( $input['appr_bottom_previous_next'] ) ) { $output['appr_bottom_previous_next'] = $input['appr_bottom_previous_next']; } if ( isset( $input['blog_post_layout'] ) ) { $output['blog_post_layout'] = $input['blog_post_layout']; } if ( isset( $input['social_site_meta_enable'] ) ) { $output['social_site_meta_enable'] = $input['social_site_meta_enable']; } // Trigger the flush of the rewrite rules if anything changed in the urls of the posts if ( isset( $input['appr_url_pages'] ) && isset( $input['appr_url_lessons'] ) && isset( $input['appr_enable_feature'] ) ) { if ( ( $current_options['appr_enable_feature'] == 0 && $input['appr_enable_feature'] == 1 ) || ( $current_options['appr_url_lessons'] != $input['appr_url_lessons'] ) || ( $current_options['appr_url_pages'] != $input['appr_url_pages'] ) || ( $current_options['appr_url_categories'] != $input['appr_url_categories'] ) || ( $current_options['appr_url_tags'] != $input['appr_url_tags'] ) ) { update_option( "thrive-flush-rewrite-required", 1 ); } } return apply_filters( 'thrive_theme_options_validate', $output, $input, $defaults ); } /* * Delete an image from the database and from the server * @param string $image_url The url of the image */ function delete_image( $image_url ) { global $wpdb; // We need to get the image's meta ID. $query = "SELECT ID FROM wp_posts where guid = '" . esc_url( $image_url ) . "' AND post_type = 'attachment'"; $results = $wpdb->get_results( $query ); // And delete it foreach ( $results as $row ) { wp_delete_attachment( $row->ID ); } } /* * Get the color scheme array */ //ASTA ERA INAINTE /* function _thrive_get_color_scheme_options() { return array('blue' => __('Blue', 'thrive'), 'green' => __('Green', 'thrive'), 'red' => __('Red', 'thrive'), 'purple' => __('Purple', 'thrive'), 'orange' => __('Orange', 'thrive')); } */ function _thrive_get_color_scheme_options( $section = "theme" ) { $colors = array(); switch ( $section ) { case 'theme': return array( 'blue' => __( 'Blue', 'thrive' ), 'dark' => __( 'Dark', 'thrive' ), 'green' => __( 'Green', 'thrive' ), 'light' => __( 'Light', 'thrive' ), 'orange' => __( 'Orange', 'thrive' ), 'purple' => __( 'Purple', 'thrive' ), 'red' => __( 'Red', 'thrive' ), 'teal' => __( 'Teal', 'thrive' ) ); break; case 'optin': return array( 'blue' => __( 'Blue', 'thrive' ), 'dark' => __( 'Dark', 'thrive' ), 'green' => __( 'Green', 'thrive' ), 'light' => __( 'Light', 'thrive' ), 'purple' => __( 'Purple', 'thrive' ), 'red' => __( 'Red', 'thrive' ), 'teal' => __( 'Teal', 'thrive' ), 'orange' => __( 'Orange', 'thrive' ) ); break; case 'focusareas': return array( 'blue' => __( 'Blue', 'thrive' ), 'dark' => __( 'Dark', 'thrive' ), 'light' => __( 'Light', 'thrive' ), 'green' => __( 'Green', 'thrive' ), 'red' => __( 'Red', 'thrive' ), 'purple' => __( 'Purple', 'thrive' ), 'teal' => __( 'Teal', 'thrive' ), 'orange' => __( 'Orange', 'thrive' ) ); break; case 'contentbox': return array( 'blue' => __( 'Blue', 'thrive' ), 'dark' => __( 'Dark', 'thrive' ), 'green' => __( 'Green', 'thrive' ), 'light' => __( 'Light', 'thrive' ), 'note' => __( 'Note', 'thrive' ), 'purple' => __( 'Purple', 'thrive' ), 'red' => __( 'Red', 'thrive' ), 'teal' => __( 'Teal', 'thrive' ), 'orange' => __( 'Orange', 'thrive' ) ); break; case 'buttons': return array( 'blue' => __( 'Blue', 'thrive' ), 'green' => __( 'Green', 'thrive' ), 'red' => __( 'Red', 'thrive' ), 'purple' => __( 'Purple', 'thrive' ), 'orange' => __( 'Orange', 'thrive' ), 'teal' => __( 'Teal', 'thrive' ), 'light' => __( 'Light', 'thrive' ), 'dark' => __( 'Dark', 'thrive' ) ); break; default: return array( 'blue' => __( 'Blue', 'thrive' ), 'green' => __( 'Green', 'thrive' ), 'red' => __( 'Red', 'thrive' ), 'purple' => __( 'Purple', 'thrive' ), 'orange' => __( 'Orange', 'thrive' ) ); break; } } function thrive_settings_field_logo( $options ) { echo "
"; echo ""; echo ""; } function thrive_settings_field_favicon( $options ) { echo "
"; echo ""; echo ""; } function thrive_settings_field_footer_copyright( $options ) { echo ""; } function thrive_settings_field_footer_copyright_links( $options ) { $checked_on = ( $options['footer_copyright_links'] == 1 ) ? "checked" : ""; $checked_off = ( $options['footer_copyright_links'] == 0 ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_display_breadcrumbs( $options ) { $checked_on = ( $options['display_breadcrumbs'] == 1 ) ? "checked" : ""; $checked_off = ( $options['display_breadcrumbs'] == 0 ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_comments_on_pages( $options ) { $checked_on = ( $options['comments_on_pages'] == 1 ) ? "checked" : ""; $checked_off = ( $options['comments_on_pages'] == 0 ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_relative_time( $options ) { if ( ! isset( $options['relative_time'] ) ) { $options['relative_time'] = 0; } $checked_on = ( $options['relative_time'] == 1 ) ? "checked" : ""; $checked_off = ( $options['relative_time'] == 0 ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_highlight_author_comments( $options ) { if ( ! isset( $options['highlight_author_comments'] ) ) { $options['highlight_author_comments'] = 1; } $checked_on = ( $options['highlight_author_comments'] == 1 ) ? "checked" : ""; $checked_off = ( $options['highlight_author_comments'] == 0 ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_color_scheme( $options ) { $colors = _thrive_get_color_scheme_options(); echo ""; } function thrive_settings_field_sidebar_alignement( $options ) { $checked_left = ( $options['sidebar_alignement'] == 'left' ) ? "checked" : ""; $checked_right = ( $options['sidebar_alignement'] == 'right' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_extended_menu( $options ) { $checked_on = ( $options['extended_menu'] == 'on' ) ? "checked" : ""; $checked_off = ( $options['extended_menu'] == 'off' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_custom_css( $options ) { echo ""; } function thrive_settings_field_featured_image_style( $options ) { $checked_1 = ( $options['featured_image_style'] == 'wide' ) ? "checked" : ""; $checked_2 = ( $options['featured_image_style'] == 'thumbnail' ) ? "checked" : ""; $checked_3 = ( $options['featured_image_style'] == 'no_image' ) ? "checked" : ""; $checked_4 = ( $options['featured_image_style'] == 'round' ) ? "checked" : ""; echo " " . __( 'Wide', 'thrive' ) . ""; echo " " . __( 'Thumbnail', 'thrive' ) . ""; echo " " . __( 'Round', 'thrive' ) . ""; echo " " . __( 'No Image', 'thrive' ) . ""; } function thrive_settings_field_featured_image_single_post( $options ) { $checked_on = ( $options['featured_image_single_post'] == '1' ) ? "checked" : ""; $checked_off = ( $options['featured_image_single_post'] == '0' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_meta_author_name( $options ) { $options = thrive_get_theme_options(); $checked_on = ( $options['meta_author_name'] == '1' ) ? "checked" : ""; $checked_off = ( $options['meta_author_name'] == '0' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_meta_post_date( $options ) { $checked_on = ( $options['meta_post_date'] == '1' ) ? "checked" : ""; $checked_off = ( $options['meta_post_date'] == '0' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_meta_post_category( $options ) { $checked_on = ( $options['meta_post_category'] == '1' ) ? "checked" : ""; $checked_off = ( $options['meta_post_category'] == '0' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_meta_post_tags( $options ) { $checked_on = ( $options['meta_post_tags'] == '1' ) ? "checked" : ""; $checked_off = ( $options['meta_post_tags'] == '0' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_meta_comment_count( $options ) { $checked_on = ( $options['meta_comment_count'] == '1' ) ? "checked" : ""; $checked_off = ( $options['meta_comment_count'] == '0' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_bottom_about_author( $options ) { $options = thrive_get_theme_options(); $checked_on = ( $options['bottom_about_author'] == '1' ) ? "checked" : ""; $checked_off = ( $options['bottom_about_author'] == '0' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_bottom_previous_next( $options ) { $checked_on = ( $options['bottom_previous_next'] == '1' ) ? "checked" : ""; $checked_off = ( $options['bottom_previous_next'] == '0' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_related_posts_box( $options ) { $checked_on = ( $options['related_posts_box'] == '1' ) ? "checked" : ""; $checked_off = ( $options['related_posts_box'] == '0' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_related_posts_title( $options ) { echo ""; } function thrive_settings_field_related_posts_number( $options ) { echo ""; } function thrive_settings_field_related_posts_images( $options ) { $checked_on = ( $options['related_posts_images'] == '1' ) ? "checked" : ""; $checked_off = ( $options['related_posts_images'] == '0' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_other_read_more_type( $options ) { $checked_button = ( $options['other_read_more_type'] == 'button' ) ? "checked" : ""; $checked_text = ( $options['other_read_more_type'] == 'text' ) ? "checked" : ""; echo " " . __( 'Button', 'thrive' ) . ""; echo " " . __( 'Text', 'thrive' ) . ""; } function thrive_settings_field_other_read_more_text( $options ) { echo ""; } function thrive_settings_field_hide_cats_from_blog( $options ) { $value_hide_cats = json_decode( $options['hide_cats_from_blog'] ); if ( ! is_array( $value_hide_cats ) ) { $value_hide_cats = array(); } $all_categories = get_categories(); $categories_array = array(); foreach ( $all_categories as $cat ) { array_push( $categories_array, array( 'id' => $cat->cat_ID, 'name' => $cat->cat_name ) ); } ?> " . esc_attr( $options['analytics_header_script'] ) . ""; } function thrive_settings_field_analytics_body_script( $options ) { echo ""; } function thrive_settings_field_analytics_body_script_top( $options ) { echo ""; } function thrive_settings_field_other_show_comment_date( $options ) { $checked_on = ( $options['other_show_comment_date'] == '1' ) ? "checked" : ""; $checked_off = ( $options['other_show_comment_date'] == '0' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_image_optimization_type( $options ) { if ( ! isset( $options['image_optimization_type'] ) ) { $options['image_optimization_type'] = 'lossy'; } $checked_1 = ( $options['image_optimization_type'] == 'off' ) ? "checked" : ""; $checked_2 = ( $options['image_optimization_type'] == 'lossy' ) ? "checked" : ""; $checked_3 = ( $options['image_optimization_type'] == 'lossless' ) ? "checked" : ""; echo " " . __( 'No Compression', 'thrive' ) . ""; echo " " . __( 'Lossy Compression', 'thrive' ) . ""; echo " " . __( 'Lossless Image', 'thrive' ) . ""; } function thrive_settings_field_comments_lazy( $options ) { if ( ! isset( $options['comments_lazy'] ) ) { $options['comments_lazy'] = 0; } $checked_on = ( $options['comments_lazy'] == '1' ) ? "checked" : ""; $checked_off = ( $options['comments_lazy'] == '0' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_enable_fb_comments( $options ) { if ( ! isset( $options['enable_fb_comments'] ) ) { $options['enable_fb_comments'] = "off"; } ?> "; } function thrive_settings_field_fb_moderators( $options ) { if ( ! isset( $options['fb_moderators'] ) ) { $options['fb_moderators'] = array(); } if ( empty( $options['fb_moderators'] ) ) { $options['fb_moderators'] = array( '' ); // output a single input if none is set } else { array_unshift( $options['fb_moderators'], '' ); } $add = '' . __( 'Add', 'thrive' ) . ''; $remove = '' . __( 'Remove', 'thrive' ) . ''; foreach ( $options['fb_moderators'] as $i => $moderator ) { echo '
'; echo ""; if ( $i === 0 ) { echo $add; } echo sprintf( $remove, $i ? '' : 'display: none' ); echo '
'; } } function thrive_settings_field_fb_no_comments( $options ) { if ( ! isset( $options['fb_no_comments'] ) ) { $options['fb_no_comments'] = 5; } echo ""; } function thrive_settings_field_fb_color_scheme( $options ) { if ( ! isset( $options['fb_color_scheme'] ) ) { $options['fb_color_scheme'] = 'light'; } $selectedDark = ( $options['fb_color_scheme'] == "dark" ) ? " selected" : ""; echo ""; } function thrive_settings_field_privacy_tpl_website( $options ) { if ( ! isset( $options['privacy_tpl_website'] ) ) { $options['privacy_tpl_website'] = ""; } echo ""; } function thrive_settings_field_privacy_tpl_contact( $options ) { if ( ! isset( $options['privacy_tpl_contact'] ) ) { $options['privacy_tpl_contact'] = ""; } echo ""; } function thrive_settings_field_privacy_tpl_address( $options ) { if ( ! isset( $options['privacy_tpl_address'] ) ) { $options['privacy_tpl_address'] = ""; } echo ""; } function thrive_settings_field_privacy_tpl_company( $options ) { if ( ! isset( $options['privacy_tpl_company'] ) ) { $options['privacy_tpl_company'] = ""; } echo ""; } function thrive_settings_field_blog_layout( $options ) { if ( ! isset( $options['blog_layout'] ) ) { $options['blog_layout'] = "default"; } $checked_1 = ( $options['blog_layout'] == 'default' ) ? "checked" : ""; $checked_2 = ( $options['blog_layout'] == 'full_width' ) ? "checked" : ""; $checked_3 = ( $options['blog_layout'] == 'grid_full_width' ) ? "checked" : ""; $checked_4 = ( $options['blog_layout'] == 'grid_sidebar' ) ? "checked" : ""; echo " " . __( 'Default', 'thrive' ) . ""; echo " " . __( 'Full Width', 'thrive' ) . ""; echo " " . __( 'Grid Full Width', 'thrive' ) . ""; echo " " . __( 'Grid Sidebar', 'thrive' ) . ""; } function thrive_settings_field_blog_post_layout( $options ) { if ( ! isset( $options['blog_post_layout'] ) ) { $options['blog_post_layout'] = "default"; } $checked_1 = ( $options['blog_post_layout'] != 'full_width' && $options['blog_post_layout'] != "narrow" ) ? "checked" : ""; $checked_2 = ( $options['blog_post_layout'] == 'full_width' ) ? "checked" : ""; $checked_3 = ( $options['blog_post_layout'] == 'narrow' ) ? "checked" : ""; echo " " . __( 'Default', 'thrive' ) . ""; echo " " . __( 'Full Width', 'thrive' ) . ""; echo " " . __( 'Narrow', 'thrive' ) . ""; } function thrive_settings_field_logo_type( $options ) { if ( ! isset( $options['logo_type'] ) ) { $options['logo_type'] = "image"; } $checked_image = ( $options['logo_type'] != 'text' ) ? "checked" : ""; $checked_text = ( $options['logo_type'] == 'text' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_logo_text( $options ) { if ( ! isset( $options['logo_text'] ) ) { $options['logo_text'] = ""; } echo ""; } function thrive_settings_field_logo_color( $options ) { if ( ! isset( $options['logo_color'] ) ) { $options['logo_color'] = "default"; } $colors = _thrive_get_color_scheme_options(); $colors = array_merge( array( 'default' => __( "Default", 'thrive' ) ), $colors ); echo ""; } function thrive_settings_field_enable_social_buttons( $options ) { if ( ! isset( $options['enable_social_buttons'] ) ) { $options['enable_social_buttons'] = 0; } $checked_enabled = ( $options['enable_social_buttons'] == 1 ) ? "checked" : ""; $checked_disabled = ( $options['enable_social_buttons'] != 1 ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_enable_floating_icons( $options ) { if ( ! isset( $options['enable_floating_icons'] ) ) { $options['enable_floating_icons'] = 1; } $checked_enabled = ( $options['enable_floating_icons'] == 1 ) ? "checked" : ""; $checked_disabled = ( $options['enable_floating_icons'] == 0 ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_enable_twitter_button( $options ) { if ( ! isset( $options['enable_twitter_button'] ) ) { $options['enable_twitter_button'] = 0; } $checked_enabled = ( $options['enable_twitter_button'] == 1 ) ? "checked" : ""; $checked_disabled = ( $options['enable_twitter_button'] != 1 ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_social_twitter_username( $options ) { if ( ! isset( $options['social_twitter_username'] ) ) { $options['social_twitter_username'] = ""; } echo ""; } function thrive_settings_field_enable_facebook_button( $options ) { if ( ! isset( $options['enable_facebook_button'] ) ) { $options['enable_facebook_button'] = 0; } $checked_enabled = ( $options['enable_facebook_button'] == 1 ) ? "checked" : ""; $checked_disabled = ( $options['enable_facebook_button'] != 1 ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_enable_google_button( $options ) { if ( ! isset( $options['enable_google_button'] ) ) { $options['enable_google_button'] = 0; } $checked_enabled = ( $options['enable_google_button'] == 1 ) ? "checked" : ""; $checked_disabled = ( $options['enable_google_button'] != 1 ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_enable_linkedin_button( $options ) { if ( ! isset( $options['enable_linkedin_button'] ) ) { $options['enable_linkedin_button'] = 0; } $checked_enabled = ( $options['enable_linkedin_button'] == 1 ) ? "checked" : ""; $checked_disabled = ( $options['enable_linkedin_button'] != 1 ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_enable_pinterest_button( $options ) { if ( ! isset( $options['enable_pinterest_button'] ) ) { $options['enable_pinterest_button'] = 0; } $checked_enabled = ( $options['enable_pinterest_button'] == 1 ) ? "checked" : ""; $checked_disabled = ( $options['enable_pinterest_button'] != 1 ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_social_display_location( $options ) { if ( ! isset( $options['social_display_location'] ) ) { $options['social_display_location'] = "posts"; } $checked_posts = ( strpos( $options['social_display_location'], "posts" ) !== false ) ? " checked" : ""; $checked_pages = ( strpos( $options['social_display_location'], "pages" ) !== false ) ? " checked" : ""; $value_hidden = ""; if ( $checked_posts != "" ) { $value_hidden .= "posts,"; } if ( $checked_pages != "" ) { $value_hidden .= "pages,"; } echo "" . __( "Posts", 'thrive' ) . "
"; echo "" . __( "Pages", 'thrive' ); echo ""; } function thrive_settings_field_social_attention_grabber( $options ) { if ( ! isset( $options['social_attention_grabber'] ) ) { $options['social_attention_grabber'] = "none"; } $checked_cta = ( $options['social_attention_grabber'] == "cta" ) ? " checked" : ""; $checked_count = ( $options['social_attention_grabber'] == "count" ) ? " checked" : ""; $checked_none = ( $options['social_attention_grabber'] != "cta" && $options['social_attention_grabber'] != "count" ) ? " checked" : ""; echo "" . __( "CTA text", 'thrive' ); echo "" . __( "Share count", 'thrive' ); echo "" . __( "None", 'thrive' ); } function thrive_settings_field_social_cta_text( $options ) { if ( ! isset( $options['social_cta_text'] ) ) { $options['social_cta_text'] = ""; } echo ""; } function thrive_settings_field_social_site_name( $options ) { if ( ! isset( $options['social_site_name'] ) ) { $options['social_site_name'] = ""; } echo ""; } function thrive_settings_field_social_site_title( $options ) { if ( ! isset( $options['social_site_title'] ) ) { $options['social_site_title'] = ""; } echo ""; } function thrive_settings_field_social_site_description( $options ) { if ( ! isset( $options['social_site_description'] ) ) { $options['social_site_description'] = ""; } echo ""; } function thrive_settings_field_social_site_image( $options ) { if ( ! isset( $options['social_site_image'] ) ) { $options['social_site_image'] = ""; } echo ""; echo ' '; } function thrive_settings_field_social_site_twitter_username( $options ) { if ( ! isset( $options['social_site_twitter_username'] ) ) { $options['social_site_twitter_username'] = ""; } echo ""; } function thrive_settings_field_social_add_like_btn( $options ) { if ( ! isset( $options['social_add_like_btn'] ) ) { $options['social_add_like_btn'] = 0; } $checked_enabled = ( $options['social_add_like_btn'] == 1 ) ? "checked" : ""; $checked_disabled = ( $options['social_add_like_btn'] != 1 ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_other_show_excerpt( $options ) { if ( ! isset( $options['other_show_excerpt'] ) ) { $options['other_show_excerpt'] = 0; } $checked_content = ( $options['other_show_excerpt'] != 1 ) ? "checked" : ""; $checked_excerpt = ( $options['other_show_excerpt'] == 1 ) ? "checked" : ""; echo " " . __( 'Post content', 'thrive' ) . ""; echo " " . __( 'Post excerpt', 'thrive' ) . ""; } function thrive_settings_field_logo_position( $options ) { if ( ! isset( $options['logo_position'] ) ) { $options['logo_position'] = "side"; } $checked_side = ( $options['logo_position'] != 'top' ) ? "checked" : ""; $checked_top = ( $options['logo_position'] == 'top' ) ? "checked" : ""; echo " "; echo " "; } function thrive_settings_field_navigation_type( $options ) { if ( ! isset( $options['navigation_type'] ) ) { $options['navigation_type'] = "default"; } $checked_1 = ( $options['navigation_type'] != "float" && $options['navigation_type'] != "scroll" ) ? "checked" : ""; $checked_2 = ( $options['navigation_type'] == 'float' ) ? "checked" : ""; $checked_3 = ( $options['navigation_type'] == 'scroll' ) ? "checked" : ""; echo " " . __( 'Default', 'thrive' ) . ""; echo " " . __( 'Floating ', 'thrive' ) . ""; echo " " . __( 'Float on scroll-up', 'thrive' ) . ""; } function thrive_settings_field_social_custom_posts( $options ) { if ( ! isset( $options['social_custom_posts'] ) ) { $options['social_custom_posts'] = ""; } $exlude_types = array( "post", "page", "revision", "nav_menu_item", "wpcf7_contact_form", "ngg_album", "ngg_gallery", "ngg_pictures", "displayed_gallery", "display_type", "gal_display_source", "lightbox_library", "focus_area", "thrive_optin" ); $post_types = get_post_types(); foreach ( $post_types as $post_type ) { if ( ! in_array( $post_type, $exlude_types ) ) { $checked_post = ( strpos( $options['social_custom_posts'], $post_type ) !== false ) ? " checked" : ""; echo " " . $post_type . "   "; } } echo ""; } function thrive_header_number_render_preview() { if ( ! wp_verify_nonce( $_REQUEST['nonce'], "thrive_preview_header_number_nonce" ) ) { echo 0; die; } if ( ! isset( $_POST['id_post'] ) ) { $current_focus = array(); } else { $current_focus = get_post( $_POST['id_post'] ); } $preview_params = array( 'header_phone_no' => $_POST['header_phone_no'], 'header_phone_text' => $_POST['header_phone_text'], 'header_phone_text_mobile' => $_POST['header_phone_text_mobile'], 'header_phone_btn_color' => $_POST['header_phone_btn_color'], ); $template_path = get_template_directory() . "/inc/templates/header-phone-preview.php"; require_once $template_path; die; } function thrive_settings_field_social_site_meta_enable( $options ) { if ( $options['social_site_meta_enable'] === null || ! isset( $options['social_site_meta_enable'] ) || $options['social_site_meta_enable'] == "" ) { $options['social_site_meta_enable'] = _thrive_get_social_site_meta_enable_default_value(); } $checked_on = ( $options['social_site_meta_enable'] == 1 ) ? "checked" : ""; $checked_off = ( $options['social_site_meta_enable'] != 1 ) ? "checked" : ""; echo " "; echo " "; }