do_action (‘after_setup_theme’)
هوک after_setup_theme برای اعمال تنظیمات در قالب بعد از نصب آن میباشد.
منبع
File: wp-settings.php
این هوک زمانی لود میشود که قالب فعال شود. و درون این هوک تنظیمات مربوط به نصب قالب، تعریف ویژگیها و هوکهای قالب قرار میگیرد.
function twentyfifteen_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on twentyfifteen, use a find and replace * to change 'twentyfifteen' to the name of your theme in all the template files */ load_theme_textdomain( 'twentyfifteen', get_template_directory() . '/languages' ); // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); /* * Let WordPress manage the document title. * By adding theme support, we declare that this theme does not use a * hard-coded tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 825, 510, true ); } add_action( 'after_setup_theme', 'twentyfifteen_setup' );
در تکه کد فوق که بخشی از کد تنظیمات قالب پیش فرض وردپرس(قالب2019) میباشد ابتدا تنظیمات مورد نیاز در تابع twentyfifteen_setup نوشته شده است و در انتها به هوک after_setup_theme توسط add_action متصل شده است.