PHP code example of mwdelaney / acf-complex-titles

1. Go to this page and download the library: Download mwdelaney/acf-complex-titles library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mwdelaney / acf-complex-titles example snippets


	 // Replace the plugin's Fields class with our class extending it
	 add_filter ('acfct_set_fields_class',  function() { return 'myFields'; });

	 // Add custom CSS to style the new fields
	 add_action ('complex_titles_css', 'addMyStyles');

	 /**
	  * Add styling for the new fields
	  * 	Naming scheme is as follows:
	  * 		.complex-title-element-[your-field-acf-name]
	  */
	 
	 function addMyStyles() {
		 // Variable containing the styles we want to add
		 $myStyles = "
		 	.complex-title-element-underline {
				text-decoration: underline;
			}
		 ";
		 
		 // Enqueue these styles along with the plugin's other styles
		 wp_add_inline_style( 'acf-complex-titles-style', $myStyles );
	 }

	 // Our class extending the plugin's class to add new fields
	 class myFields extends MWD\ComplexTitles\Fields {
		 /**
 		 * Field: Underline
 		 *
 		 * @author Michael W. Delaney
 		 * @since 1.0
 		 *
 		 * Checkbox
 		 */
 		public $underline = array (
 			'order' => '10',
 			'field' => array (
 				'key' => 'acfct_underline',
 				'label' => 'Underline',
 				'name' => 'underline',
 				'type' => 'true_false',
 			)
 		);
	 }

add_theme_support( 'complex-titles-fields', array( 'word-or-phrase', 'size' ) );

add_theme_support( 'complex-titles-layout', array( 'alignment' ) );

 $landing_page_templates = array(
   array (
     array (
       'param' => 'post_type',
       'operator' => '==',
       'value' => 'page',
     ),
     array (
       'param' => 'page_template',
       'operator' => '!=',
       'value' => 'template-no-header-image.php',
     ),
   ),
 );
 add_theme_support( 'complex-titles-location', $landing_page_templates );

remove_action('complex_titles_css', array( $acf_complex_titles, 'front_end_styles' ) );