ﺎﻫ ﻪﻧﻭﺰﻓﺍ ﻭ ﮎﺩﻮﮐ ﯼﺎﻫ ﻢﺗ ،ﻂﯾﺍﺮﺷ :ﻢﺗ ﺯﺎﺳ ﯽﺷﺭﺎﻔﺳ


  1. <span>1. ﺱﺮﭘﺩﺭﻭ ﻢﺗ ﺯﺎﺳ ﯽﺷﺭﺎﻔﺳ ﺮﺑ ﯼﺍ ﻪﻣﺪﻘﻣ
  2. <span>2. ﺱﺮﭘﺩﺭﻭ ﻢﺗ ﺯﺎﺳ ﯽﺷﺭﺎﻔﺳ ﺎﺑ ﻞﻣﺎﻌﺗ
  3. <span>3. ﺱﺮﭘﺩﺭﻭ ﺐﻟﺎﻗ Customizer Boilerplate
  4. <span>4. ﺱﺮﭘﺩﺭﻭ ﺐﻟﺎﻗ ﺵﺮﺘﺴﮔ Customizer Boilerplate
  5. 5. ﻥﺪﻧﺍﻮﺧ ﻝﺎﺣ ﺭﺩ: ﯽﺷﺭﺎﻔﺳﺡﺮﻃ ،ﻂﯾﺍﺮﺷ :ﻢﺗ ﻩﺪﻨﻨﮐ

.ﺪﯿﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ ﺩﻮﺧ ﻉﻮﺿﻮﻣ ﺭﺩ ﺪﯿﻫﺍﻮﺧﯽﻣ ﻪﮐ ﺩﻮﺑ ﯽﯾﺎﻫﻪﻨﯾﺰﮔ ﺯﺍ ﯼﺍﻪﯾﺍﺭﺁ

:ﺪﯿﻨﮐ ﻞﺼﺘﻣ ﺩﻮﺟﻮﻣ ﺮﺘﻠﯿﻓ ﮏﯾ ﻪﺑ ﺍﺭ ﻥﺁ add_filter ﻊﺑﺎﺗ ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ ﻭ ﻩﺩﺮﮐ ﻒﯾﺮﻌﺗ

add_filter( $tag, $function_to_add, $priority, $accepted_args );

:ﺪﯿﻫﺩ ﻡﺎﺠﻧﺍ ﻦﯾﺍ ﻪﯿﺒﺷ ﯼﺭﺎﮐ ﺮﮔﺍ ﻦﯾﺍﺮﺑﺎﻨﺑ .ﺩﻮﺷ ﯽﻣ ﺍﺮﺟﺍ ﺮﺗﺩﻭﺯ ﺎﻤﺷ ﺩﺮﮑﻠﻤﻋ ،ﺪﯿﻨﮐ ﻢﮐ

// Adding first message
function my_theme_add_first_message( $content ) {
	$content .= '<p>First Message</p>';
	return $content;
}
add_filter( 'the_content', 'my_theme_add_first_message', 1 );

// Adding second message
function my_theme_add_second_message( $content ) {
	$content .= '<p>Second Message</p>';
	return $content;
}
add_filter( 'the_content', 'my_theme_add_second_message', 2 );

.ﺪﻨﻨﯿﭼﯽﻣ ﺩﻮﺧ ﻩﺍﺭ ﺭﺩ ﺍﺭ ﺰﯿﭼ ﻪﻤﻫ ﻭ ﺪﻨﺘﻠﻏﯽﻣ ﻪﭙﺗ ﺯﺍ ﻪﮐ ﺪﻨﺘﺴﻫ ﯽﻓﺮﺑ ﯼﺎﻫu20

؟ﺩﻮﺷﯽﻣ ﻝﺎﻤﻋﺍ ﻪﻧﻮﮕﭼ Boilerplate Theme Customizer ﺩﺭﻮﻣ ﺭﺩ ﻉﻮﺿﻮﻣ ﻦﯾﺍ

:ﺪﯿﻨﮐ ﻪﺟﻮﺗ ﻝﺎﺜﻣ ﻦﯾﺍ ﻪﺑ .ﺪﻫﺩ ﯽﻣ ﻡﺎﺠﻧﺍ ﺪﯾﺩﺮﮐ ﻒﯾﺮﻌﺗ ﻼًﺒﻗ ﻪﮐ my_theme_options_array

function my_theme_options_array() {
	// Using helper function to get default required capability
	$thsp_cbp_capability = thsp_cbp_capability();

	$options = array(
		// Section ID
		'my_theme_new_section' => array(

			'existing_section' => false,
			'args' => array(
				'title' => __( 'New Section', 'my_theme_textdomain' ),
				'priority' => 10
			),
			'fields' => array(
				/*
				 * Radio field
				 */
				'my_radio_button' => array(
					'setting_args' => array(
						'default' => 'option-2',
						'type' => 'option',
						'capability' => $thsp_cbp_capability,
						'transport' => 'refresh',
					),					
					'control_args' => array(
						'label' => __( 'My Radio Button', 'my_theme_textdomain' ),
						'type' => 'radio', // Radio control
						'choices' => array(
							'option-1' => array(
								'label' => __( 'Option 1', 'my_theme_textdomain' )
							),
							'option-2' => array(
								'label' => __( 'Option 2', 'my_theme_textdomain' )
							),
							'option-3' => array(
								'label' => __( 'Option 3', 'my_theme_textdomain' )
							)
						),					
						'priority' => 3
					)
				)
			)
		)
	);
	
	return $options;
}
add_filter( 'thsp_cbp_options_array', 'my_theme_options_array', 1 );

:ﻥﺎﺳﺁ .ﺪﯿﺷﺎﺑ ﻪﺘﺷﺍﺩ ﺍﺭ My Checkbox ﺪﺷﺎﺑ ﺮﺘﻬﺑ ﺪﯾﺎﺷ ،ﻦﻣ ﯽﯾﻮﯾﺩﺍﺭ ﻪﻤﮐﺩ ﯼﺎﺟ ﻪﺑ ﺎﻣﺍ ،

function my_child_theme_options_array( $options ) {
	// Using helper function to get default required capability
	$thsp_cbp_capability = thsp_cbp_capability();

	/*
	 * This time, we're only editing fields in my_theme_new_section in the $options array
	 */	
	$options['my_theme_new_section']['fields'] = array(
		'my_checkbox_field' => array(
			'setting_args' => array(
				'default' => true,
				'type' => 'option',
				'capability' => $thsp_cbp_capability,
				'transport' => 'refresh',
			),					
			'control_args' => array(
				'label' => __( 'My Checkbox', 'my_theme_textdomain' ),
				'type' => 'checkbox', // Checkbox field control
				'priority' => 2
			)
		)
	);
	
	return $options;
}
add_filter( 'thsp_cbp_options_array', 'my_child_theme_options_array', 2 );

.options$ﻪﯾﺍﺭﺁ ﻞﮐ ﻪﻧ ،ﻡﺭﺍﺩ ﺭﺎﮐ ﻭ ﺮﺳ options['my_theme_new_section']['fields']

:ﻥﺎﺳﺁ ﻢﻫ ﺯﺎﺑ .ﺪﯿﻫﺩ ﻥﺎﺸﻧ ﺹﺎﺧ ﻪﻧﻭﺰﻓﺍ ﮏﯾ ﻥﺩﻮﺑ ﻝﺎﻌﻓ ﺕﺭﻮﺻ ﺭﺩ ﻂﻘﻓ ﺍﺭ Theme Customize

function my_plugin_dependency_options_array( $options ) {
	// Using helper function to get default required capability
	$thsp_cbp_capability = thsp_cbp_capability();

	/*
	 * Only adding my_plugin_dependency_section if 'test-plugin.php' is active
	 */	
	if ( is_plugin_active( 'test-plugin/test-plugin.php' ) ) {
	
		$options['my_plugin_dependency_section'] = array(
			'existing_section' => false,
			'args' => array(
				'title' => __( 'Plugin Dependency', 'my_theme_textdomain' ),
				'priority' => 10
			),
			'fields' => array(
				/*
				 * Text field
				 */
				// Field ID
				'new_text_field' => array(
					'setting_args' => array(
						'default' => __( '', 'my_theme_textdomain' ),
						'type' => 'option',
						'capability' => $thsp_cbp_capability,
						'transport' => 'refresh',
					),					
					'control_args' => array(
						'label' => __( 'Only shows if', 'my_theme_textdomain' ),
						'type' => 'text', // Text field control
						'priority' => 5
					)
				),
			)
		);
	
	}
	
	return $options;
}
add_filter( 'thsp_cbp_options_array', 'my_plugin_dependency_options_array', 3 );

.ﺪﯿﻫﺩﯽﻣ ﻡﺎﺠﻧﺍ ﻢﺗ ﮏﯾ function.php ﻞﯾﺎﻓ ﺯﺍ ﺍﺭ ﺭﺎﮐ ﻦﯾﺍ ﻪﮐ ﯽﺷﻭﺭ ﻥﺎﻤﻫ ﻪﺑ ،ﺪﯾﻮﺷ

ﻮﺸﻧ ﻪﻧﺍﻮﯾﺩ ﻪﻨﯾﺰﮔ

.ﺪﺷﺎﺑ ﻢﮐ ﻥﺎﮑﻣﺍ ﺪﺣ ﺎﺗ ﺎﻤﺷ ﻢﺗ ﯼﺎﻫﻪﻨﯾﺰﮔ ﺩﺍﺪﻌﺗ ﺎﺗ ﺪﻨﮐ ﮏﻤﮐ ،ﻪﻧﻭﺰﻓﺍ ﻪﺑ ﻪﺘﺴﺑﺍﻭ ﯼ

.ﺖﺴﯿﻧ ﯽﻟﺎﻋ ﻉﻮﺿﻮﻣ ﮏﯾ ﻻًﺎﻤﺘﺣﺍ ﻭ ﺖﺳﺍ WYSIWYG ﺮﮕﺸﯾﺍﺮﯾﻭ ﮏﯾ ،ﺖﺴﯿﻧ ﻢﺗ ﮏﯾ ،ﺩﺭﺍﺩ ﺮﺼﻨﻋ ﺮﻫ

.ﺪﺷﺎﺑ ﺪﯾﺎﺑ ﻪﮐ ﺖﺳﺍ ﯼﺰﯿﭼ ﻥﺎﻤﻫ ﺮﺑﺭﺎﮐ ﺕﺍﺭﺎﻈﺘﻧﺍ ﺪﯾﻮﺷ ﻦﺌﻤﻄﻣ ﻪﮐ ﺖﺳﺍ ﻦﯾﺍ ﺎﻤﺷ ﻪﻔﯿﻇﻭ ،ﺪﯿ