コード例 #1
0
/**
 * Construct and display options for posts. Used by the featured, recent, related, and popular posts shortcodes and widgets.
 *
 * @since 1.1.0
 *
 * @param string $component Required. Name of shortcode or widget whose options are being displayed.
 * @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_posts($component, $opts = array(), $widget = false)
{
    if (!isset($component)) {
        return;
    }
    // Get the global variables.
    global $blogcentral_opts;
    global $blogcentral_defaults;
    global $blogcentral_initial;
    if ($opts) {
        $opts = array_map('stripslashes_deep', $opts);
        $opts = wp_parse_args($opts, $blogcentral_defaults['posts_landing']);
    } else {
        $opts = $blogcentral_initial['posts_landing'];
    }
    $opts['name'] = $component;
    ob_start();
    blogcentral_display_component_layout_options($component, $opts['layout'], $widget);
    blogcentral_display_component_layout_wraps($opts, $widget);
    blogcentral_display_main_options($opts, $widget);
    // Display options that are specific to posts display.
    blogcentral_display_posts_specific_opts($opts, $widget);
    return ob_get_clean();
}
コード例 #2
0
 /**
  * Display options for the single post page
  *
  * Can use the same options set for the posts landing page, or override them.
  *
  * @since 1.0.0
  *
  * @param array $opts Optional. Saved options, if any.
  */
 function blogcentral_display_options_posts_single($opts)
 {
     echo "<div>\n\t\t\t\t<br /><input class='displaymaster' type='checkbox' name='" . blogcentral_get_field_name_wrap('override_landing', "blogcentral[posts_single]", $widget) . "'" . checked($opts['override_landing'], 'on', false) . " /> \n\t\t\t\t<label>";
     _e('Override posts listing settings. If checked none of the settings for the listing page will be applied to the single post page.', BLOGCENTRAL_TXT_DOMAIN);
     echo "</label><div ";
     if (!$opts['override_landing']) {
         echo "style='display:none;'";
     }
     echo " class='hideshow'>";
     blogcentral_display_component_layout_options('posts_single', $opts['layout']);
     $opts['name'] = 'posts_single';
     blogcentral_display_component_layout_wraps($opts);
     blogcentral_display_main_options($opts);
     blogcentral_display_posts_specific_opts($opts);
     echo '</div></div>';
 }