// Shortcode function to list external links with additional details and management options function list_external_links_with_details($atts) { // Attributes $atts = shortcode_atts( array( 'order' => isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC', 'start_date' => isset($_GET['start_date']) ? sanitize_text_field($_GET['start_date']) : '', 'end_date' => isset($_GET['end_date']) ? sanitize_text_field($_GET['end_date']) : '' ), $atts, 'external_links_list' ); // Date query parameters $date_query = array(); if ($atts['start_date']) { $date_query['after'] = $atts['start_date']; } if ($atts['end_date']) { $date_query['before'] = $atts['end_date']; } if (!empty($date_query)) { $date_query['inclusive'] = true; } // Query posts $args = array( 'post_type' => 'post', 'posts_per_page' => -1, 'orderby' => 'date', 'order' => $atts['order'], 'date_query' => $date_query ); $query = new WP_Query($args); ob_start(); // Start output buffering echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; if ($query->have_posts()) { echo ''; echo ''; while ($query->have_posts()) { $query->the_post(); $post_id = get_the_ID(); $post_date = get_the_date(); $post_title = '' . get_the_title() . ''; $post_author = get_the_author(); $post_categories = get_the_category_list(', '); $content = get_the_content(); $pattern = '/]*>([^<]+)<\/a>/i'; preg_match_all($pattern, $content, $matches); $link_count = count($matches[0]); if (!empty($matches[0])) { foreach ($matches[0] as $match) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } } } echo '
LinkPost TitleAuthorDateCategoriesLink CountActions
' . $match . '' . $post_title . '' . $post_author . '' . $post_date . '' . $post_categories . '' . $link_count . ''; echo '
'; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; } else { echo '

No posts found.

'; } wp_reset_postdata(); return ob_get_clean(); // Return the buffered content } // Register the shortcode add_shortcode('external_links_list', 'list_external_links_with_details'); // Handle form submissions function handle_form_submission() { if (isset($_POST['remove_link'])) { $post_id = intval($_POST['post_id']); $link_html = wp_unslash($_POST['link_html']); $post_content = get_post_field('post_content', $post_id); // Bağlantı etiketini ve içeriğini al preg_match('/]*href=([\"\']??)([^\" >]* )\\1[^>]*>(.*)<\/a>/siU', $link_html, $matches); // Bağlantının içeriği $link_content = $matches[3]; // Bağlantıyı ve içeriğini içeren parçayı kaldır $content_without_link = str_replace($link_html, $link_content, $post_content); // Gönderi içeriğini güncelle wp_update_post(array( 'ID' => $post_id, 'post_content' => $content_without_link, )); } if (isset($_POST['delete_post'])) { $post_id = intval($_POST['post_id']); wp_delete_post($post_id); } } add_action('init', 'handle_form_submission'); bebek fotoğrafları Arşivleri | Lafmacun.Net - Sosyal İçerik Platformu
Instagram takipçi satın al

bebek fotoğrafları

Başa dön tuşu