Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    I am sorry, but it is not obvious how to register UI code.

    Please take a look at the documentation in the wiki: https://github.com/fusioneng/Shortcake/wiki/Registering-Shortcode-UI

    Where should i add this?

    Your theme’s functions.php file would be a good place.

    Thread Starter mschouten

    (@mschouten)

    Thank you for your quick reply!!

    I added the following to functions.php:

    /**
    	 * Register a UI for the Shortcode.
    	 * Pass the shortcode tag (string)
    	 * and an array or args.
    	 */
    	shortcode_ui_register_for_shortcode(
    		'shortcake_dev',
    		array(
    
    			// Display label. String. Required.
    			'label' => 'Shortcake Dev',
    
    			// Icon/attachment for shortcode. Optional. src or dashicons-$icon. Defaults to carrot.
    			'listItemImage' => 'dashicons-editor-quote',
    
    			'inner_content' => array(
    				'label' => 'Quote',
    			),
    
    			'post_type'     => array( 'post' ),
    
    			// Available shortcode attributes and default values. Required. Array.
    			// Attribute model expects 'attr', 'type' and 'label'
    			// Supported field types: text, checkbox, textarea, radio, select, email, url, number, and date.
    			'attrs' => array(
    
    				array(
    					'label' => 'Attachment',
    					'attr'  => 'attachment',
    					'type'  => 'attachment',
    					'libraryType' => array( 'image' ),
    					'addButton'   => 'Select Image',
    					'frameTitle'  => 'Select Image',
    				),
    
    				array(
    					'label' => 'Cite',
    					'attr'  => 'source',
    					'type'  => 'text',
    					'meta' => array(
    						'placeholder' => 'Test placeholder',
    						'data-test'    => 1,
    					),
    				),
    
    				array(
    					'label'    => 'Select Page',
    					'attr'     => 'page',
    					'type'     => 'post_select',
    					'query'    => array( 'post_type' => 'page' ),
    					'multiple' => true,
    				),
    
    			),
    
    		)
    	);
    /**
    	 * Register a UI for the Shortcode.
    	 * Pass the shortcode tag (string)
    	 * and an array or args.
    	 */
    	shortcode_ui_register_for_shortcode(
    		'shortcake_dev',
    		array(
    
    			// Display label. String. Required.
    			'label' => 'Shortcake Dev',
    
    			// Icon/attachment for shortcode. Optional. src or dashicons-$icon. Defaults to carrot.
    			'listItemImage' => 'dashicons-editor-quote',
    
    			'inner_content' => array(
    				'label' => 'Quote',
    			),
    
    			'post_type'     => array( 'post' ),
    
    			// Available shortcode attributes and default values. Required. Array.
    			// Attribute model expects 'attr', 'type' and 'label'
    			// Supported field types: text, checkbox, textarea, radio, select, email, url, number, and date.
    			'attrs' => array(
    
    				array(
    					'label' => 'Attachment',
    					'attr'  => 'attachment',
    					'type'  => 'attachment',
    					'libraryType' => array( 'image' ),
    					'addButton'   => 'Select Image',
    					'frameTitle'  => 'Select Image',
    				),
    
    				array(
    					'label' => 'Cite',
    					'attr'  => 'source',
    					'type'  => 'text',
    					'meta' => array(
    						'placeholder' => 'Test placeholder',
    						'data-test'    => 1,
    					),
    				),
    
    				array(
    					'label'    => 'Select Page',
    					'attr'     => 'page',
    					'type'     => 'post_select',
    					'query'    => array( 'post_type' => 'page' ),
    					'multiple' => true,
    				),
    
    			),
    
    		)
    	);

    Can you help me further?
    I am a web designer / web developer, not that technical..

    Thread Starter mschouten

    (@mschouten)

    This is a really nice plugin, i can see it’s potential!
    but I am sorry, i really can’t get it to work…

    Thread Starter mschouten

    (@mschouten)

    Is there some kind of video tutorial or step-by-step tutorial?
    This should be in WP Core i think!!

    I did the very same and I am having no luck either. I don’t consider myself stupid, but this is either a very complicated installation or the most under-documented plugin installation I have ever encountered. Maybe both, but I am still hoping to be able to use it as I have used it with themes that have the compatibility built-in, and I love it!

    I tried to activate the plugin and received an error – Parse error: syntax error, unexpected T_FUNCTION in /home/content/M/y/i/Myiscom/html/portstlucie/wp-content/plugins/shortcode-ui/shortcode-ui.php on line 32.

    digbymaass

    (@digbymaass)

    Do you put everything on that page into function.php or only selected parts?

    This lack of documentation is hopeless. And I don’t even know if it’s going to do what I want.

    I want to hide everything in the visual editor but the year link in this rather long set of shortcodes:

    [popup id=”table”][table id=65 /][/popup]
    [popup_trigger id=”table”]2014[/popup_trigger]

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Register UI code’ is closed to new replies.