/** * Construct and display options for the progressbars shortcode and widget. * * Filters 4bzCore plugin's options. * * @since 1.1.0 * * @param string $opts_str Required. 4bzCore plugin's default options. * @param array $opts Optional. Saved options. * @param object $widget Optional. Widget object if displaying options for a widget. */ function blogcentral_options_progressbars($opts_str, $opts = array(), $widget = false) { $progressbars_name = blogcentral_get_field_name_wrap('items', "blogcentral[progressbars]", $widget); $skills_html = ''; $skills = isset($opts['items']) ? $opts['items'] : array(); $opts['name'] = 'progressbars'; $defaults = array('cols' => '1'); if ($opts) { $opts = wp_parse_args($opts, $defaults); } else { $opts = $defaults; } ob_start(); echo '<div id="progressbars-cont-opts" class="blogcentral-wrap text-format">'; blogcentral_display_custom_text_class_options($opts, $widget); $opts_str = ob_get_clean(); // Construct options for the actual progressbars items. $opts_str .= "<p class='section-title div3'>" . __('Progressbars Specific Options', BLOGCENTRAL_TXT_DOMAIN) . '</p><table class="form-table"><tbody> <tr> <th>' . __('Items', BLOGCENTRAL_TXT_DOMAIN) . "</th>\n\t\t\t\t<td>\n\t\t\t\t\t<br /><p class='instruction'><small>" . __('Sort the progressbars by hovering over an item until a hand appears, drag and drop where desired.', BLOGCENTRAL_TXT_DOMAIN) . '</small></p><br /><input data-index="0" type="button" class="button-2 add-skill" value="' . __('Add Item', BLOGCENTRAL_TXT_DOMAIN) . '" data-name="' . $progressbars_name . '" /> <ul class="skills-wrap sortable">'; if (is_array($skills) && 0 < count($skills)) { $i = 0; foreach ($skills as $key => $val) { $opts_str .= '<li class="skills-cont" data-skill-index="' . $i . '"><br /><button type="button" class="button-2 delete-row">' . __('Delete', BLOGCENTRAL_TXT_DOMAIN) . '</button><br /><br />' . '<div><label>' . __('Name', BLOGCENTRAL_TXT_DOMAIN) . '</label><input type="text" class="add-skill-name" data-skill-index="' . $i . '" name="' . $progressbars_name . '[' . $i . '][name]" value="' . esc_attr($key) . '" style="padding:5px;" /></div>' . '<br /><label>' . __('Percentage', BLOGCENTRAL_TXT_DOMAIN) . '</label><input type="text" class="add-skill-value"' . ' name="' . $progressbars_name . '[' . $i . '][value]" value="' . esc_attr($val) . '"/>' . '<span class="instruction"><small>' . __('Enter percentage as a number 0-100', BLOGCENTRAL_TXT_DOMAIN) . '</small></span></li>'; ++$i; } } $opts_str .= "</ul></td></tr><tr>\n\t\t\t\t\t<th>" . __('How many columns?', BLOGCENTRAL_TXT_DOMAIN) . "</th>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<div class='options-section'>\n\t\t\t\t\t\t\t <select name='" . blogcentral_get_field_name_wrap('cols', "blogcentral[progressbars]", $widget) . "'>"; ob_start(); blogcentral_display_cols_options($opts['cols']); $opts_str .= ob_get_clean() . "</select></div></td></tr></tbody></table></div>"; return $opts_str; }
/** * Construct and display main options for components. * * @since 1.0.0 * * @param array $opts Optional. Saved options. * @param object $widget Optional. Widget object if displaying options for a widget. */ function blogcentral_display_main_options($opts, &$widget = false) { $defaults = array('cols' => '1', 'border' => '0', 'masonry' => false, 'alternate_color' => false); if ($opts) { $opts = wp_parse_args($opts, $defaults); } else { $opts = $defaults; } $name = $opts ? isset($opts['name']) ? esc_html($opts['name']) : 'posts_landing' : 'posts_landing'; $border_name = blogcentral_get_field_name_wrap('border', "blogcentral[{$opts['name']}]", $widget); blogcentral_display_custom_text_class_options($opts, $widget); echo "<p class='section-title div3'>"; _e('General Options', BLOGCENTRAL_TXT_DOMAIN); echo "</p>\n\t\t\t<table class='form-table'>\n\t\t\t\t<tbody>"; // If displaying options for the single post page, do not display these options. if ('posts_single' !== $name) { echo "<tr>\n\t\t\t\t\t\t<th>" . __('How many columns?', BLOGCENTRAL_TXT_DOMAIN) . "</th>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<select name='" . blogcentral_get_field_name_wrap('cols', "blogcentral[{$name}]", $widget) . "'>"; blogcentral_display_cols_options($opts['cols']); echo "</select>\n\t\t\t\t\t\t\t<p class='instruction fixed'><small>"; _e('Note: the number of columns shown may change due to the size of the screen and/or the layout chosen for the posts. Layout 2, at the most, will be displayed in 2 columns, even if you choose 3 or 4 columns.', BLOGCENTRAL_TXT_DOMAIN); echo "</small></p>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>"; } echo "<tr>\n\t\t\t\t\t\t<th>" . __('Border for each post', BLOGCENTRAL_TXT_DOMAIN) . "</th>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<div class='group'>\n\t\t\t\t\t\t\t\t<input type='radio' value='0' name='" . $border_name . "'" . checked($opts['border'], '0', false) . " /> \n\t\t\t\t\t\t\t\t<label>"; _e('No border', BLOGCENTRAL_TXT_DOMAIN); echo "</label><br />\n\t\t\t\t\t\t\t\t<input type='radio' value='1' name='" . $border_name . "'" . checked($opts['border'], '1', false) . " /> \n\t\t\t\t\t\t\t\t<label style='border-bottom: 3px double #eeeeee;'>"; _e('Bottom Border', BLOGCENTRAL_TXT_DOMAIN); echo "</label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>"; // If displaying options for the single post page, do not display these options if ('posts_single' !== $name) { echo "<tr>\n\t\t\t\t\t\t<th>" . __('Masonry display', BLOGCENTRAL_TXT_DOMAIN) . "</th>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<input class='displaymaster' type='checkbox' name='" . blogcentral_get_field_name_wrap('masonry', "blogcentral[{$name}]", $widget) . "'" . checked($opts['masonry'], 'on', false) . " />\n\t\t\t\t\t\t\t\t<label>"; _e('Display in a masonry layout', BLOGCENTRAL_TXT_DOMAIN); echo "</label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>" . __('Alternate background color', BLOGCENTRAL_TXT_DOMAIN) . "</th>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<div class='group'>\n\t\t\t\t\t\t\t\t<input type='checkbox' name='" . blogcentral_get_field_name_wrap('alternate_color', "blogcentral[{$name}]", $widget) . "' class='displaymaster'" . checked($opts['alternate_color'], 'on', false) . " />\n\t\t\t\t\t\t\t\t<label>"; _e('Even items children will have a background color. You can customize the color by entering code in the custom css box. To target the children use this code: .alternate-color .component:nth-child(2n) .component-content-wrap { background-color: #your color here !important; }', BLOGCENTRAL_TXT_DOMAIN); echo "</label></div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>"; } echo "</tbody>\n\t\t\t</table>"; // If displaying options for the main posts page ie index.php, do not display these options. if ('posts_landing' !== $name && 'posts_single' !== $name) { $opts['name'] = $name; blogcentral_display_query_opts($opts, $widget); } }