/** * Construct and display options for the flickr photos 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. Only relative if displaying a widget's options because these shortcode options are not saved to the database, they are used in the shortcode builder to generate the shortcode string. * @param object $widget Optional. Widget object if displaying options for a widget. */ function blogcentral_options_flickr_photos($opts_str, $opts, $widget) { $opts['name'] = 'flickr_photos'; $opts_str = ''; $opts_str .= "<div class='blogcentral-wrap text-format'>"; ob_start(); blogcentral_display_custom_text_class_options($opts, $widget); $opts_str .= ob_get_clean(); $opts_str .= '<p class="section-title div3">' . __('General', BLOGCENTRAL_TXT_DOMAIN) . '</p> <table class="form-table"><tbody> <tr> <th>' . __('Limit', BLOGCENTRAL_TXT_DOMAIN) . '</th> <td><label>' . __('Number of items to display', BLOGCENTRAL_TXT_DOMAIN) . "</label> <input type='text'"; if (isset($opts['limit'])) { $opts_str .= " value='" . esc_attr($opts['limit']) . "'"; } $opts_str .= " name='" . blogcentral_get_field_name_wrap('limit', "blogcentral[flickr_photos]", $widget) . "' />"; $opts_str .= '</td> </tr> </table>'; $opts_str .= "<table class='form-table'>\n\t\t\t<tbody>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>" . __('User id', BLOGCENTRAL_TXT_DOMAIN) . '</th> <td><label>' . __('User id', BLOGCENTRAL_TXT_DOMAIN) . '</label> <input type="text"'; if (isset($opts['user_id'])) { $opts_str .= ' value="' . esc_attr($opts['user_id']) . '"'; } $opts_str .= ' name="' . blogcentral_get_field_name_wrap('user_id', "blogcentral[flickr_photos]", $widget) . '" /></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); } }