Skip to content

Instantly share code, notes, and snippets.

@hellofromtonya
Created June 26, 2018 22:22
Show Gist options
  • Save hellofromtonya/6d39d58c4cef87ed8af356e5cca584cb to your computer and use it in GitHub Desktop.
Save hellofromtonya/6d39d58c4cef87ed8af356e5cca584cb to your computer and use it in GitHub Desktop.
Beans Beta Testing.
<?php
/**
* You can add this to your child theme either in the functions.php file or in a separate file.
* Make sure that
add_action( 'admin_init', 'beans_child_test_fields' );
/**
* Test the Fields API for post meta.
*
* @since 1.5.0
*
* @return void
*/
function beans_child_test_fields() {
$beans_uri = get_template_directory_uri();
// Add a featured image to the Hello World! post.
$image_id = (int) get_post_thumbnail_id( 1, 'thumbnail' );
$fields = array(
array(
'id' => 'beans_test_slider',
'label' => 'Test Slider',
'description' => 'Testing the slider',
'type' => 'slider',
'default' => 40,
'min' => 0,
'max' => 100,
'interval' => 1,
'unit' => 'Percentage complete', // Adds this text after the current value.
),
array(
'id' => 'beans_test_radio_with_images',
'label' => 'Layout',
'description' => 'The layout to select',
'type' => 'radio',
'default' => 'default_fallback',
'options' => array(
'default_fallback' => 'Use Default Layout',
'c' => array(
'src' => $beans_uri . '/lib/admin/assets/images/layouts/c.png',
'alt' => 'Full width content layout',
'screen_reader_text' => 'Select the full width content layout',
),
'c_sp' => array(
'src' => $beans_uri . '/lib/admin/assets/images/layouts/cs.png',
'alt' => 'Content + Sidebar Primary Layout',
'screen_reader_text' => 'Select the content and sidebar primary layout',
),
'sp_c' => array(
'src' => $beans_uri . '/lib/admin/assets/images/layouts/sc.png',
'alt' => 'Sidebar Primary + Content Layout',
'screen_reader_text' => 'Select the sidebar primary and content layout',
),
),
),
array(
'id' => 'beans_text_test',
'type' => 'text',
'label' => 'Testing the text field.',
'default' => '',
),
array(
'id' => 'beans_textarea_test',
'type' => 'textarea',
'label' => 'Testing the textarea field.',
'default' => '',
),
array(
'id' => 'beans_radio_test',
'label' => 'Radio buttons',
'description' => 'Radio buttons',
'type' => 'radio',
'default' => 'no',
'options' => array(
'no' => 'No',
'yes' => 'Yes',
),
),
array(
'id' => 'beans_image_test',
'type' => 'image',
'label' => 'Image Test',
'default' => $image_id,
),
array(
'id' => 'beans_single_activation_test',
'label' => 'Activate',
'type' => 'activation',
'default' => false,
),
array(
'id' => 'beans_single_select_test',
'label' => 'Select',
'type' => 'select',
'default' => 'aggressive',
'attributes' => array( 'style' => 'margin: -3px 0 0 -8px;' ),
'options' => array(
'aggressive' => 'Aggressive',
'standard' => 'Standard',
),
),
array(
'id' => 'beans_single_checkbox_test',
'label' => false,
'checkbox_label' => 'Enable the checkbox test',
'type' => 'checkbox',
'default' => false,
),
);
beans_register_post_meta( $fields, array( 'post' ), 'beans_single_test', array( 'title' => 'Testing Single Fields' ) );
$fields = array(
array(
'id' => 'beans_group_test',
'label' => 'Group of fields',
'description' => 'This is a group of fields.',
'type' => 'group',
'fields' => array(
array(
'id' => 'beans_group_activation_test',
'label' => 'Activate',
'type' => 'activation',
'default' => false,
),
array(
'id' => 'beans_group_select_test',
'label' => 'Select',
'type' => 'select',
'default' => 'aggressive',
'attributes' => array( 'style' => 'margin: -3px 0 0 -8px;' ),
'options' => array(
'aggressive' => 'Aggressive',
'standard' => 'Standard',
),
),
array(
'id' => 'beans_group_checkbox_test',
'label' => false,
'checkbox_label' => 'Enable the checkbox test',
'type' => 'checkbox',
'default' => false,
),
),
),
);
beans_register_post_meta( $fields, array( 'post' ), 'beans_group_test', array( 'title' => 'Testing a Group of Fields' ) );
}
<div class="uk-badge">Badge</div>
<div class="uk-badge uk-badge-success">Success</div>
<div class="uk-badge uk-badge-warning">Warning</div>
<div class="uk-badge uk-badge-danger">Danger</div>
<h2>Alert</h2>
<div class="uk-alert" data-uk-alert">
<a href="" class="uk-alert-close uk-close"></a>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
</div>
<div class="uk-alert uk-alert-success" data-uk-alert>
<a href="" class="uk-alert-close uk-close"></a>
<p>To indicate an important message add the <code>.uk-alert-success</code> class.</p>
</div>
<div class="uk-alert uk-alert-warning" data-uk-alert>
<a href="" class="uk-alert-close uk-close"></a>
<p>To indicate an important message add the <code>.uk-alert-warning</code> class.</p>
</div>
<div class="uk-alert uk-alert-danger" data-uk-alert>
<a href="" class="uk-alert-close uk-close"></a>
<p>To indicate an important message add the <code>.uk-alert-danger</code> class.</p>
</div>
<div class="uk-alert uk-alert-large" data-uk-alert>
<a href="" class="uk-alert-close uk-close"></a>
<h2>Today's headline</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation llamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
@hellofromtonya
Copy link
Author

The uikit-rendering.html code can be put into a post or page. Log into your sandbox site. Go into a new Post or Page. Insert the HTML into the text tab. Then make sure it renders properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment