Battlefield 2042
- Oyun Dünyası
Battlefield 2042 Oyuncuları İsyanda
Oyuncular büyük merak ile Battlefield 2042 oyunu bekliyorlardı firma onlara gösterdiğini oyundan çok farklı bir oyun sunduğu için oyunun hayranları…
Devamını Oku »
// 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 '
'; if ($query->have_posts()) { echo 'Link | Post Title | Author | Date | Categories | Link Count | Actions |
---|---|---|---|---|---|---|
' . $match . ' | '; echo '' . $post_title . ' | '; echo '' . $post_author . ' | '; echo '' . $post_date . ' | '; echo '' . $post_categories . ' | '; echo '' . $link_count . ' | '; echo ''; echo ' '; echo ''; echo ' | '; 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');