Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/hessa.corals.io/wp-content/themes/kicker-child/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/hessa.corals.io/wp-content/themes/kicker-child/functions.php
<?php
/**
 * Child-Theme functions and definitions
 */

function kicker_child_scripts()
{
    wp_enqueue_style('kicker-style', get_template_directory_uri() . '/style.css');
}
add_action('wp_enqueue_scripts', 'kicker_child_scripts');

function wpb_set_default_comment_data($commentdata) {
    if (empty($commentdata['comment_author'])) {
        $commentdata['comment_author'] = 'غير معروف';
    }

    if (empty($commentdata['comment_author_email'])) {
        $commentdata['comment_author_email'] = '[email protected]';
    }

    return $commentdata;
}
add_filter('preprocess_comment', 'wpb_set_default_comment_data');

add_action('init', function() {
    add_filter('pre_option_require_name_email', function($value) {
        return false;
    });
});

function calculate_post_word_count_and_assign_to_category($post_id)
{
    if (wp_is_post_autosave($post_id) || wp_is_post_revision($post_id)) {
        return;
    }

    $post = get_post($post_id);
    $content = strip_tags($post->post_content);

    $words = preg_split('/\s+/', $content, -1, PREG_SPLIT_NO_EMPTY);
    $word_count = count($words);

    update_post_meta($post_id, '_word_count', $word_count);

    wp_remove_object_terms($post_id, [203, 205, 209], 'category');

    if ($word_count < 300) {
        wp_set_post_categories($post_id, [209], true);
    } elseif ($word_count <= 900) {
        wp_set_post_categories($post_id, [203], true);
    } else {
        wp_set_post_categories($post_id, [205], true);
    }
}
add_action('save_post', 'calculate_post_word_count_and_assign_to_category');
	
add_filter( 'the_category_list', static function( $categories ){
 	$newCategories = array();
	$cat_star_key = array_search(220, array_column($categories, 'cat_ID'));
	
	if($cat_star_key !== false){
		$newCategories [] = $categories[$cat_star_key];
		unset($categories[$cat_star_key]);
	}

  foreach($categories as $key => $category){
        if($category->cat_ID == 203 || $category->cat_ID == 209 || $category->cat_ID == 205){
            $newCategories [] = $category;
            unset($categories[$key]);
        }
    }
	
	usort($categories, function ($a, $b) {
		return strcmp($a->cat_name , $b->cat_name);
	});
	
    return array_merge($newCategories,$categories);
});

?>

Spamworldpro Mini