• 25-02-2024, 18:17:35
    #1


    aşağıdaki kodu, kullandığınız temanın function.php dosyasının en sonuna ekleyin


    function custom_column_headings($defaults) {
      $defaults['heading_counts'] = 'Başlık Sayıları';
      return $defaults;
    }
    add_filter('manage_posts_columns', 'custom_column_headings');
    
    function custom_column_content($column_name, $post_ID) {
      if ($column_name == 'heading_counts') {
        $content = get_post_field('post_content', $post_ID);
        $pattern = '/<(h2|h3|h4)>/';
        preg_match_all($pattern, $content, $matches);
        $h2_count = isset($matches[0]) ? count(array_filter($matches[0], function($match) { return $match === '<h2>'; })) : 0;
        $h3_count = isset($matches[0]) ? count(array_filter($matches[0], function($match) { return $match === '<h3>'; })) : 0;
        $h4_count = isset($matches[0]) ? count(array_filter($matches[0], function($match) { return $match === '<h4>'; })) : 0;
        echo "H2 Sayısı: $h2_count<br>";
        echo "H3 Sayısı: $h3_count<br>";
        echo "H4 Sayısı: $h4_count";
      }
    }
    add_action('manage_posts_custom_column', 'custom_column_content', 10, 2);
  • 25-02-2024, 18:23:14
    #2
    Harikasın
  • 25-02-2024, 20:23:10
    #3
    işinize yaradıysa ne mutlu