first commit
This commit is contained in:
+112
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* The public-facing functionality of the module.
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Powerkit
|
||||
* @subpackage Modules/public
|
||||
*/
|
||||
|
||||
/**
|
||||
* The public-facing functionality of the module.
|
||||
*/
|
||||
class Powerkit_Coming_Soon_Public extends Powerkit_Module_Public {
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
public function initialize() {
|
||||
add_filter( 'wp', array( $this, 'init_page' ) );
|
||||
add_action( 'wp', array( $this, 'change_httpcode' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set HTTP status header.
|
||||
*/
|
||||
public function change_httpcode() {
|
||||
// Check location.
|
||||
if ( is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( powerkit_coming_soon_page_visible() || powerkit_coming_soon_site_visible() ) {
|
||||
$httpcode = get_option( 'powerkit_coming_soon_httpcode', 404 );
|
||||
|
||||
status_header( $httpcode );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Init Page
|
||||
*/
|
||||
public function init_page() {
|
||||
// Check location.
|
||||
if ( is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( powerkit_coming_soon_page_visible() || powerkit_coming_soon_site_visible() ) {
|
||||
add_filter( 'pre_get_document_title', array( $this, 'title' ) );
|
||||
add_action( 'template_redirect', array( $this, 'template' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Title
|
||||
*/
|
||||
public function title() {
|
||||
$page_id = get_option( 'powerkit_coming_soon_page' );
|
||||
|
||||
if ( $page_id ) {
|
||||
|
||||
$page = get_post( $page_id );
|
||||
|
||||
// Set title.
|
||||
$title = $page ? $page->post_title : esc_html__( 'Coming Soon', 'powerkit' );
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Template
|
||||
*/
|
||||
public function template() {
|
||||
$page_id = get_option( 'powerkit_coming_soon_page' );
|
||||
|
||||
if ( $page_id ) {
|
||||
// Get page object.
|
||||
$object = get_post( $page_id );
|
||||
|
||||
// Get title.
|
||||
$title = $object ? $object->post_title : esc_html__( 'Coming Soon', 'powerkit' );
|
||||
|
||||
// Get content.
|
||||
$content = $object ? $object->post_content : esc_html__( 'Get Ready... Something Really Cool Is Coming Soon', 'powerkit' );
|
||||
|
||||
// Set template path.
|
||||
$template_path = apply_filters( 'powerkit_coming_soon_template', POWERKIT_CS_TEMPLATES . '/default.php' );
|
||||
|
||||
if ( ! file_exists( $template_path ) ) {
|
||||
wp_die( 'Template file does not exist!' );
|
||||
}
|
||||
|
||||
include_once $template_path;
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the stylesheets for the public-facing side of the site.
|
||||
*/
|
||||
public function wp_enqueue_scripts() {
|
||||
// Styles.
|
||||
wp_enqueue_style( 'powerkit-coming-soon', powerkit_style( plugin_dir_url( __FILE__ ) . 'css/public-powerkit-coming-soon.css' ), array(), powerkit_get_setting( 'version' ), 'all' );
|
||||
|
||||
// Add RTL support.
|
||||
wp_style_add_data( 'powerkit-coming-soon', 'rtl', 'replace' );
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* All of the CSS for your public-facing functionality should be
|
||||
* included in this file.
|
||||
*/
|
||||
/**
|
||||
* Environment for all styles (variables, additions, etc).
|
||||
*/
|
||||
/*--------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------*/
|
||||
.pk-coming-soon-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.pk-coming-soon-image {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pk-coming-soon-image img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.pk-coming-soon-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 40px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.pk-coming-soon-page {
|
||||
min-height: 100vh;
|
||||
}
|
||||
.pk-coming-soon-container {
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.pk-coming-soon-image {
|
||||
flex: 0 0 50%;
|
||||
max-width: 50%;
|
||||
min-height: 100vh;
|
||||
height: 100%;
|
||||
}
|
||||
.pk-coming-soon-image img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
-o-object-fit: cover;
|
||||
object-fit: cover;
|
||||
}
|
||||
.pk-coming-soon-content {
|
||||
flex: 0 0 50%;
|
||||
max-width: 50%;
|
||||
}
|
||||
.pk-coming-soon-content:first-child:last-child {
|
||||
flex: 0 0 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.pk-coming-soon-content .entry-content {
|
||||
margin: 0 auto;
|
||||
max-width: 640px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pk-coming-soon-content .pk-social-links-items {
|
||||
justify-content: center;
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* All of the CSS for your public-facing functionality should be
|
||||
* included in this file.
|
||||
*/
|
||||
/**
|
||||
* Environment for all styles (variables, additions, etc).
|
||||
*/
|
||||
/*--------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------*/
|
||||
.pk-coming-soon-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.pk-coming-soon-image {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pk-coming-soon-image img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.pk-coming-soon-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 40px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.pk-coming-soon-page {
|
||||
min-height: 100vh;
|
||||
}
|
||||
.pk-coming-soon-container {
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.pk-coming-soon-image {
|
||||
flex: 0 0 50%;
|
||||
max-width: 50%;
|
||||
min-height: 100vh;
|
||||
height: 100%;
|
||||
}
|
||||
.pk-coming-soon-image img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
-o-object-fit: cover;
|
||||
object-fit: cover;
|
||||
}
|
||||
.pk-coming-soon-content {
|
||||
flex: 0 0 50%;
|
||||
max-width: 50%;
|
||||
}
|
||||
.pk-coming-soon-content:first-child:last-child {
|
||||
flex: 0 0 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.pk-coming-soon-content .entry-content {
|
||||
margin: 0 auto;
|
||||
max-width: 640px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pk-coming-soon-content .pk-social-links-items {
|
||||
justify-content: center;
|
||||
}
|
||||
Reference in New Issue
Block a user