کد نمونه
Step ۱
اکسترا
استفاده از add action محتوا یا کدهای PHP
در مثال زیر می توانید نحوه تغییر آرایه تنظیمات قالب را مشاهده کنید.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* With this function you can modify imported theme options and change any options you want. | |
* | |
* @var $options = imported theme options array | |
*/ | |
function my_prefix_after_import_theme_options( $options ) { | |
// Replace website logo after importing demo. | |
$options[ 'logo' ] = 'https://yoursite.com/new_logo.png'; | |
// Update new options. | |
update_option( 'codevz_theme_options', $options ); | |
} | |
add_action( 'codevz/importer/after_import_theme_options', 'my_prefix_after_import_theme_options' ); |
اکسترا
کجا و چگونه کد های PHP را تغییر دهیم؟
بهترین راه حل اضافه کردن اکشن ها و فیلترهای سفارشی در فایل functions.php در قالب چایلد است. اما همچنین
می توانید افزونه خود را بسازید و از این کدها در افزونه خود استفاده کنید.