Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1219142
    Jean Loup F
    Participant

    Hi,

    for personnal needs, I’ve add an option in Under Construction plugin to place a specific URL and not only a social URL.

    I give the code here, for archive and for those who need this. (And also to suggest the awesome Theme.co team to add this feature in a next update of the plugin ;))

    File modified :

    functions/options.php

    <?php
    
    // =============================================================================
    // FUNCTIONS/OPTIONS.PHP
    // -----------------------------------------------------------------------------
    // Plugin options.
    // =============================================================================
    
    // =============================================================================
    // TABLE OF CONTENTS
    // -----------------------------------------------------------------------------
    //   01. Set Options
    //   02. Get Options
    // =============================================================================
    
    // Set Options
    // =============================================================================
    
    //
    // Set $_POST variables to options array and update option.
    //
    
    GLOBAL $x_under_construction_options;
    
    if ( isset( $_POST['x_under_construction_form_submitted'] ) ) {
      if ( strip_tags( $_POST['x_under_construction_form_submitted'] ) == 'submitted' && current_user_can( 'manage_options' ) ) {
    
        $x_under_construction_options['x_under_construction_enable']           = ( isset( $_POST['x_under_construction_enable'] ) ) ? strip_tags( $_POST['x_under_construction_enable'] ) : '';
        $x_under_construction_options['x_under_construction_heading']          = strip_tags( $_POST['x_under_construction_heading'] );   
        $x_under_construction_options['x_under_construction_subheading']       = strip_tags( $_POST['x_under_construction_subheading'] );
        $x_under_construction_options['x_under_construction_date']             = strip_tags( $_POST['x_under_construction_date'] );
        $x_under_construction_options['x_under_construction_link']            = strip_tags( $_POST['x_under_construction_link'] );
        $x_under_construction_options['x_under_construction_facebook']         = strip_tags( $_POST['x_under_construction_facebook'] );
        $x_under_construction_options['x_under_construction_twitter']          = strip_tags( $_POST['x_under_construction_twitter'] );
        $x_under_construction_options['x_under_construction_google_plus']      = strip_tags( $_POST['x_under_construction_google_plus'] );
        $x_under_construction_options['x_under_construction_instagram']        = strip_tags( $_POST['x_under_construction_instagram'] );
        $x_under_construction_options['x_under_construction_background_image'] = strip_tags( $_POST['x_under_construction_background_image'] );
        $x_under_construction_options['x_under_construction_background_color'] = strip_tags( $_POST['x_under_construction_background_color'] );
        $x_under_construction_options['x_under_construction_heading_color']    = strip_tags( $_POST['x_under_construction_heading_color'] );
        $x_under_construction_options['x_under_construction_subheading_color'] = strip_tags( $_POST['x_under_construction_subheading_color'] );
        $x_under_construction_options['x_under_construction_date_color']       = strip_tags( $_POST['x_under_construction_date_color'] );
        $x_under_construction_options['x_under_construction_social_color']     = strip_tags( $_POST['x_under_construction_social_color'] );
    
        update_option( 'x_under_construction', $x_under_construction_options );
    
      }
    }
    
    // Get Options
    // =============================================================================
    
    $x_under_construction_options = apply_filters( 'x_under_construction_options', get_option( 'x_under_construction' ) );
    
    if ( $x_under_construction_options != '' ) {
    
      $x_under_construction_enable           = $x_under_construction_options['x_under_construction_enable'];
      $x_under_construction_heading          = $x_under_construction_options['x_under_construction_heading'];
      $x_under_construction_subheading       = $x_under_construction_options['x_under_construction_subheading'];
      $x_under_construction_date             = $x_under_construction_options['x_under_construction_date'];
      $x_under_construction_link             = $x_under_construction_options['x_under_construction_link'];
      $x_under_construction_facebook         = $x_under_construction_options['x_under_construction_facebook'];
      $x_under_construction_twitter          = $x_under_construction_options['x_under_construction_twitter'];
      $x_under_construction_google_plus      = $x_under_construction_options['x_under_construction_google_plus'];
      $x_under_construction_instagram        = $x_under_construction_options['x_under_construction_instagram'];
      $x_under_construction_background_image = $x_under_construction_options['x_under_construction_background_image'];
      $x_under_construction_background_color = $x_under_construction_options['x_under_construction_background_color'];
      $x_under_construction_heading_color    = $x_under_construction_options['x_under_construction_heading_color'];
      $x_under_construction_subheading_color = $x_under_construction_options['x_under_construction_subheading_color'];
      $x_under_construction_date_color       = $x_under_construction_options['x_under_construction_date_color'];
      $x_under_construction_social_color     = $x_under_construction_options['x_under_construction_social_color'];
    
    }

    views/admin/options-page-main.php

    <?php
    // =============================================================================
    // VIEWS/ADMIN/OPTIONS-PAGE-MAIN.PHP
    // -----------------------------------------------------------------------------
    // Plugin options page main content.
    // =============================================================================
    // =============================================================================
    // TABLE OF CONTENTS
    // -----------------------------------------------------------------------------
    //   01. Main Content
    // =============================================================================
    // Main Content
    // =============================================================================
    ?>
    <div id="post-body-content">
    <div class="meta-box-sortables ui-sortable">
    <!--
    ENABLE
    -->
    <div id="meta-box-enable" class="postbox">
    <div class="handlediv" title="<?php _e( 'Click to toggle', '__x__' ); ?>"><br></div>
    <h3 class="hndle"><span><?php _e( 'Enable', '__x__' ); ?></span></h3>
    <div class="inside">
    <p><?php _e( 'Select the checkbox below to enable the plugin.', '__x__' ); ?></p>
    <table class="form-table">
    <tr>
    <th>
    <label for="x_under_construction_enable">
    <strong><?php _e( 'Enable Under Construction', '__x__' ); ?></strong>
    <span><?php _e( 'Select to enable the plugin and display options below.', '__x__' ); ?></span>
    </label>
    </th>
    <td>
    <fieldset>
    <legend class="screen-reader-text"><span>input type="checkbox"</span></legend>
    <input type="checkbox" class="checkbox" name="x_under_construction_enable" id="x_under_construction_enable" value="1" <?php echo ( isset( $x_under_construction_enable ) && checked( $x_under_construction_enable, '1', false ) ) ? checked( $x_under_construction_enable, '1', false ) : ''; ?>>
    </fieldset>
    </td>
    </tr>
    </table>
    </div>
    </div>
    <!--
    SETTINGS
    -->
    <div id="meta-box-settings" class="postbox" style="display: <?php echo ( isset( $x_under_construction_enable ) && $x_under_construction_enable == 1 ) ? 'block' : 'none'; ?>;">
    <div class="handlediv" title="<?php _e( 'Click to toggle', '__x__' ); ?>"><br></div>
    <h3 class="hndle"><span><?php _e( 'Settings', '__x__' ); ?></span></h3>
    <div class="inside">
    <p><?php _e( 'Select your plugin settings below.', '__x__' ); ?></p>
    <table class="form-table">
    <tr>
    <th>
    <label for="x_under_construction_heading">
    <strong><?php _e( 'Heading', '__x__' ); ?></strong>
    <span><?php _e( 'Enter your desired heading.', '__x__' ); ?></span>
    </label>
    </th>
    <td><input name="x_under_construction_heading" id="x_under_construction_heading" type="text" value="<?php echo ( isset( $x_under_construction_heading ) ) ? stripslashes( $x_under_construction_heading ) : ''; ?>" class="large-text"></td>
    </tr>
    <tr>
    <th>
    <label for="x_under_construction_subheading">
    <strong><?php _e( 'Subheading', '__x__' ); ?></strong>
    <span><?php _e( 'Enter your desired subheading.', '__x__' ); ?></span>
    </label>
    </th>
    <td><input name="x_under_construction_subheading" id="x_under_construction_subheading" type="text" value="<?php echo ( isset( $x_under_construction_subheading ) ) ? stripslashes( $x_under_construction_subheading ) : ''; ?>" class="large-text"></td>
    </tr>
    <tr>
    <th>
    <label for="x_under_construction_date">
    <strong><?php _e( 'Completed By', '__x__' ); ?></strong>
    <span><?php _e( 'Set the date when maintenance is expected to be complete.', '__x__' ); ?></span>
    </label>
    </th>
    <td><input name="x_under_construction_date" id="x_under_construction_date" type="text" value="<?php echo ( isset( $x_under_construction_date ) ) ? $x_under_construction_date : ''; ?>" class="large-text datepicker"></td>
    </tr>
    <tr>
    <th>
    <label for="x_under_construction_link">
    <strong><?php _e( 'External link', '__x__' ); ?></strong>
    <span><?php _e( 'Enter the URL to the external link.', '__x__' ); ?></span>
    </label>
    </th>
    <td><input name="x_under_construction_link" id="x_under_construction_link" type="text" value="<?php echo ( isset( $x_under_construction_link ) ) ? $x_under_construction_link : ''; ?>" class="large-text"></td>
    </tr>
    <tr>
    <th>
    <label for="x_under_construction_facebook">
    <strong><?php _e( 'Facebook Profile', '__x__' ); ?></strong>
    <span><?php _e( 'Enter the URL to your Facebook profile.', '__x__' ); ?></span>
    </label>
    </th>
    <td><input name="x_under_construction_facebook" id="x_under_construction_facebook" type="text" value="<?php echo ( isset( $x_under_construction_facebook ) ) ? $x_under_construction_facebook : ''; ?>" class="large-text"></td>
    </tr>
    <tr>
    <th>
    <label for="x_under_construction_twitter">
    <strong><?php _e( 'Twitter Profile', '__x__' ); ?></strong>
    <span><?php _e( 'Enter the URL to your Twitter profile.', '__x__' ); ?></span>
    </label>
    </th>
    <td><input name="x_under_construction_twitter" id="x_under_construction_twitter" type="text" value="<?php echo ( isset( $x_under_construction_twitter ) ) ? $x_under_construction_twitter : ''; ?>" class="large-text"></td>
    </tr>
    <tr>
    <th>
    <label for="x_under_construction_google_plus">
    <strong><?php _e( 'Google+ Profile', '__x__' ); ?></strong>
    <span><?php _e( 'Enter the URL to your Google+ profile.', '__x__' ); ?></span>
    </label>
    </th>
    <td><input name="x_under_construction_google_plus" id="x_under_construction_google_plus" type="text" value="<?php echo ( isset( $x_under_construction_google_plus ) ) ? $x_under_construction_google_plus : ''; ?>" class="large-text"></td>
    </tr>
    <tr>
    <th>
    <label for="x_under_construction_instagram">
    <strong><?php _e( 'Instagram Profile', '__x__' ); ?></strong>
    <span><?php _e( 'Enter the URL to your Instagram profile.', '__x__' ); ?></span>
    </label>
    </th>
    <td><input name="x_under_construction_instagram" id="x_under_construction_instagram" type="text" value="<?php echo ( isset( $x_under_construction_instagram ) ) ? $x_under_construction_instagram : ''; ?>" class="large-text"></td>
    </tr>
    <tr>
    <th>
    <label for="x_under_construction_background_image">
    <strong><?php _e( 'Background Image', '__x__' ); ?></strong>
    <span><?php _e( 'Optionally set a background image.', '__x__' ); ?></span>
    </label>
    </th>
    <td><input name="x_under_construction_background_image" id="x_under_construction_background_image" type="text" value="<?php echo ( isset( $x_under_construction_background_image ) ) ? $x_under_construction_background_image : ''; ?>" class="large-text"></td>
    </tr>
    <tr>
    <th>
    <label for="x_under_construction_background_color">
    <strong><?php _e( 'Background', '__x__' ); ?></strong>
    <span><?php _e( 'Select your color.', '__x__' ); ?></span>
    </label>
    </th>
    <td><input name="x_under_construction_background_color" id="x_under_construction_background_color" type="text" value="<?php echo ( isset( $x_under_construction_background_color ) ) ? $x_under_construction_background_color : '#34495e'; ?>" class="wp-color-picker" data-default-color="#34495e"></td>
    </tr>
    <tr>
    <th>
    <label for="x_under_construction_heading_color">
    <strong><?php _e( 'Headings', '__x__' ); ?></strong>
    <span><?php _e( 'Select your color.', '__x__' ); ?></span>
    </label>
    </th>
    <td><input name="x_under_construction_heading_color" id="x_under_construction_heading_color" type="text" value="<?php echo ( isset( $x_under_construction_heading_color ) ) ? $x_under_construction_heading_color : '#ffffff'; ?>" class="wp-color-picker" data-default-color="#ffffff"></td>
    </tr>
    <tr>
    <th>
    <label for="x_under_construction_subheading_color">
    <strong><?php _e( 'Subheading', '__x__' ); ?></strong>
    <span><?php _e( 'Select your color.', '__x__' ); ?></span>
    </label>
    </th>
    <td><input name="x_under_construction_subheading_color" id="x_under_construction_subheading_color" type="text" value="<?php echo ( isset( $x_under_construction_subheading_color ) ) ? $x_under_construction_subheading_color : '#ffffff'; ?>" class="wp-color-picker" data-default-color="#ffffff"></td>
    </tr>
    <tr>
    <th>
    <label for="x_under_construction_date_color">
    <strong><?php _e( 'Completed By', '__x__' ); ?></strong>
    <span><?php _e( 'Select your color.', '__x__' ); ?></span>
    </label>
    </th>
    <td><input name="x_under_construction_date_color" id="x_under_construction_date_color" type="text" value="<?php echo ( isset( $x_under_construction_date_color ) ) ? $x_under_construction_date_color : '#ffffff'; ?>" class="wp-color-picker" data-default-color="#ffffff"></td>
    </tr>
    <tr>
    <th>
    <label for="x_under_construction_social_color">
    <strong><?php _e( 'Social Profile Links', '__x__' ); ?></strong>
    <span><?php _e( 'Select your color.', '__x__' ); ?></span>
    </label>
    </th>
    <td><input name="x_under_construction_social_color" id="x_under_construction_social_color" type="text" value="<?php echo ( isset( $x_under_construction_social_color ) ) ? $x_under_construction_social_color : '#ffffff'; ?>" class="wp-color-picker" data-default-color="#ffffff"></td>
    </tr>
    </table>
    </div>
    </div>
    </div>
    </div>

    views/site/under-construction.php

    <?php
    // =============================================================================
    // VIEWS/SITE/UNDER-CONSTRUCTION.PHP
    // -----------------------------------------------------------------------------
    // Plugin site output.
    // =============================================================================
    // =============================================================================
    // TABLE OF CONTENTS
    // -----------------------------------------------------------------------------
    //   01. Require Options
    //   02. Output
    // =============================================================================
    // Require Options
    // =============================================================================
    require( X_UNDER_CONSTRUCTION_PATH . '/functions/options.php' );
    // Output
    // =============================================================================
    $link        = $x_under_construction_link;
    $facebook    = $x_under_construction_facebook;
    $twitter     = $x_under_construction_twitter;
    $google_plus = $x_under_construction_google_plus;
    $instagram   = $x_under_construction_instagram;
    ?>
    <!DOCTYPE html>
    <!--[if IE 9]><html class="no-js ie9" <?php language_attributes(); ?>><![endif]-->
    <!--[if gt IE 9]><!--><html class="no-js" <?php language_attributes(); ?>><!--<![endif]-->
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php wp_title(''); ?></title>
    <link rel="profile" href="http://gmpg.org/xfn/11">
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
    <?php wp_head(); ?>
    </head>
    <body>
    <div class="x-under-construction-overlay">
    <div class="x-under-construction-wrap-outer">
    <div class="x-under-construction-wrap-inner">
    <div class="x-under-construction">
    <h1><?php echo stripslashes( $x_under_construction_heading ); ?></h1>
    <h2><?php echo stripslashes( $x_under_construction_subheading ); ?></h2>
    <?php if ( $x_under_construction_date != '' ) : ?>
    <div class="x-under-construction-countdown cf">
    <span class="days">0 Days</span>
    <span class="hours">0 Hours</span>
    <span class="minutes">0 Minutes</span>
    <span class="seconds">0 Seconds</span>
    </div>
    <script type="text/javascript">
    jQuery(document).ready(function($) {
    $('.x-under-construction-countdown').countdown('<?php echo $x_under_construction_date; ?>',
    function(e) {
    var $this = $(this);
    $this.find('.days').text(e.strftime('%-D Days'));
    $this.find('.hours').text(e.strftime('%-H Hours'));
    $this.find('.minutes').text(e.strftime('%-M Minutes'));
    $this.find('.seconds').text(e.strftime('%-S Seconds'));
    }
    );
    });
    </script>
    <?php endif; ?>
    <?php if ( $link || $facebook || $twitter || $google_plus || $instagram ) : ?>
    <div class="x-under-construction-social">
    <?php if ( $link )    : ?><a href="<?php echo $link ?>" target="_blank"><i class="x-icon-link-square" data-x-icon=""></i></a><?php endif; ?>
    <?php if ( $facebook )    : ?><a href="<?php echo $facebook ?>" target="_blank"><i class="x-icon-facebook-square" data-x-icon=""></i></a><?php endif; ?>
    <?php if ( $twitter )     : ?><a href="<?php echo $twitter ?>" target="_blank"><i class="x-icon-twitter-square" data-x-icon=""></i></a><?php endif; ?>
    <?php if ( $google_plus ) : ?><a href="<?php echo $google_plus ?>" target="_blank"><i class="x-icon-google-plus-square" data-x-icon=""></i></a><?php endif; ?>
    <?php if ( $instagram )   : ?><a href="<?php echo $instagram ?>" target="_blank"><i class="x-icon-instagram" data-x-icon=""></i></a><?php endif; ?>
    </div>
    <?php endif; ?>
    </div>
    </div>
    </div>
    </div>
    <?php wp_footer(); ?>
    </body>
    </html>

    Voila.

    #1219213
    Christopher
    Moderator

    Thanks for sharing.

  • <script> jQuery(function($){ $("#no-reply-1219142 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>