esc_html__('Number of items per page', 'simple-tags'), 'default' => 20, 'option' => 'st_related_posts_per_page' ]; add_screen_option($option, $args); $this->terms_table = new RelatedPosts_List(); } /** * Method for build the page HTML manage tags * * @return void * @author Olatechpro */ public function page_manage_relatedposts() { // Default order if (!isset($_GET['order'])) { $_GET['order'] = 'name-asc'; } settings_errors(__CLASS__); if (!isset($_GET['add'])) { //all tax ?>

' . esc_html__('Search results for “%s”', 'simple-tags') . '', esc_html($search)); } ?> terms_table->prepare_items(); ?>
terms_table->search_box(__('Search Related Posts', 'simple-tags'), 'term'); ?>
terms_table->display(); //Display the table ?>

taxopress_manage_relatedposts(); echo '
'; } } ?>
0 && apply_filters('taxopress_related_posts_create_limit', true)) { $related_post_limit = true; } $ui = new taxopress_admin_ui(); ?>

' . esc_html__('Shortcode: ', 'simple-tags'); ?>  

:

  • %post_permalink%
  • %post_title%
  • %post_date%
  • %post_tagcount%
  • %post_comment%
  • %post_id%
  • %post_relatedtags%
  • %post_excerpt%
  • %post_thumb_url%
  • %post_content%
  • %post_category%
  • %post_size%
  • %post_color%


__('Security check failed.', 'simple-tags')]); } if (!current_user_can('simple_tags')) { wp_send_json_error(['message' => __('Permission denied.', 'simple-tags')]); } $post_id = isset($_POST['preview_post_id']) ? intval($_POST['preview_post_id']) : 0; if (!$post_id) { wp_send_json_error([ 'html' => '

' . esc_html__('Select a post to see a preview.', 'simple-tags') . '

' ]); return; } // Get current form settings $settings = []; if (isset($_POST['taxopress_related_post'])) { $settings = wp_unslash($_POST['taxopress_related_post']); } // Create an instance of the client class $client = new SimpleTags_Client_RelatedPosts(); $default_featured_media = isset($settings['default_featured_media']) ? $settings['default_featured_media'] : ''; // If it's the default value, use the proper plugin URL path if ($default_featured_media === 'default') { $default_featured_media = STAGS_URL . '/assets/images/taxopress-white-logo.png'; } // Prepare arguments with strict type casting and validation $args = array( 'post_id' => $post_id, 'taxonomy' => isset($settings['taxonomy']) ? sanitize_text_field($settings['taxonomy']) : 'post_tag', 'max_related_posts' => isset($settings['max_related_posts']) ? max(1, intval($settings['max_related_posts'])) : 5, 'format' => isset($settings['format']) ? sanitize_text_field($settings['format']) : 'list', 'title' => isset($settings['title']) ? wp_kses_post($settings['title']) : '', 'title_header' => isset($settings['title_header']) ? sanitize_text_field($settings['title_header']) : '', 'hide_title' => !empty($settings['hide_title']), 'xformat' => isset($settings['xformat']) ? wp_kses_post($settings['xformat']) : '', 'post_types' => isset($_POST['post_types']) && is_array($_POST['post_types']) ? array_map('sanitize_text_field', $_POST['post_types']) : ['post'], 'limit_days' => isset($settings['limit_days']) ? max(0, intval($settings['limit_days'])) : 0, 'nopoststext' => isset($settings['nopoststext']) ? wp_kses_post($settings['nopoststext']) : '', 'wrap_class' => isset($settings['wrap_class']) ? sanitize_html_class($settings['wrap_class']) : '', 'link_class' => isset($settings['link_class']) ? sanitize_html_class($settings['link_class']) : '', 'before' => isset($settings['before']) ? wp_kses_post($settings['before']) : '', 'after' => isset($settings['after']) ? wp_kses_post($settings['after']) : '', 'order' => isset($settings['order']) ? sanitize_text_field($settings['order']) : 'count-desc', 'hide_output' => !empty($settings['hide_output']), 'max_post_chars' => isset($settings['max_post_chars']) ? max(0, intval($settings['max_post_chars'])) : 100, 'taxopress_max_cats' => isset($settings['taxopress_max_cats']) ? max(0, intval($settings['taxopress_max_cats'])) : 3, 'taxopress_max_tags' => isset($settings['taxopress_max_tags']) ? max(0, intval($settings['taxopress_max_tags'])) : 3, 'imageresolution' => isset($settings['imageresolution']) ? sanitize_text_field($settings['imageresolution']) : '1536x1536', 'default_featured_media' => esc_url($default_featured_media), 'dateformat' => isset($settings['dateformat']) ? sanitize_text_field($settings['dateformat']) : 'd.m.Y', 'smallest' => isset($settings['smallest']) ? max(1, intval($settings['smallest'])) : 12, 'largest' => isset($settings['largest']) ? max(1, intval($settings['largest'])) : 12, 'unit' => isset($settings['unit']) ? sanitize_text_field($settings['unit']) : 'pt', 'mincolor' => isset($settings['mincolor']) ? sanitize_hex_color($settings['mincolor']) : '#353535', 'maxcolor' => isset($settings['maxcolor']) ? sanitize_hex_color($settings['maxcolor']) : '#000000', 'color' => !empty($settings['color']), ); // Get the HTML output $output = $client->get_related_posts($args); if (empty($output)) { if (!empty($settings['hide_output'])) { wp_send_json_success(['html' => '']); } wp_send_json_error(['message' => __('No related posts found.', 'simple-tags')]); } wp_send_json_success(['html' => $output]); } }