first commit
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
OceanWP Child Theme
|
||||
=================
|
||||
|
||||
Child Theme for the OceanWP WordPress theme.
|
||||
|
||||
### Usage
|
||||
Simply download the zip and upload the zip (oceanwp-child-theme-master.zip) under your WordPress dashboard at Appearance > Themes. Or extract and upload via FTP at wp-content/themes/.
|
||||
|
||||
|
||||
### Renaming
|
||||
You can of course rename the zip file so it isn't called oceanwp-child-theme-master.zip (you should do this so it makes more sense) and also change the "Theme Name" at the top of the style.css file.
|
||||
@@ -0,0 +1,240 @@
|
||||
$ = jQuery.noConflict(true);
|
||||
|
||||
function customDropdown() {
|
||||
document.getElementById("myDropdown").classList.toggle("show");
|
||||
}
|
||||
|
||||
$("#icon").click(function(event) {
|
||||
event.stopPropagation();
|
||||
customDropdown();
|
||||
});
|
||||
|
||||
// Close the dropdown if the user clicks outside of it
|
||||
window.onclick = function(event) {
|
||||
if (!event.target.matches('.dropbtn')) {
|
||||
var dropdowns = document.getElementsByClassName("dropdown-content");
|
||||
var i;
|
||||
|
||||
for (i = 0; i < dropdowns.length; i++) {
|
||||
var openDropdown = dropdowns[i];
|
||||
if (openDropdown.classList.contains('show')) {
|
||||
openDropdown.classList.remove('show');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
const FloatURL = 'https://www.float.sg';
|
||||
const SIGNUP_MODE = {
|
||||
signup: 'sign-up',
|
||||
subscribe: 'subscribe',
|
||||
}
|
||||
|
||||
initGoogleAuth();
|
||||
|
||||
$('form.signup-form').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
const form = $(this);
|
||||
const formData = form.serializeArray().reduce((result, prop) => {
|
||||
result[prop.name] = prop.value;
|
||||
return result;
|
||||
}, {});
|
||||
const errors = [];
|
||||
if (!formData.name) {
|
||||
form.find('input[name="name"]').addClass('has-error').siblings('.name-error').text('This field is required');
|
||||
errors.push('name');
|
||||
} else {
|
||||
form.find('input[name="name"]').removeClass('has-error').siblings('.name-error').text('');
|
||||
}
|
||||
|
||||
if (!formData.email) {
|
||||
form.find('input[name="email"]').addClass('has-error').siblings('.email-error').text('This field is required');
|
||||
errors.push('email');
|
||||
} else {
|
||||
form.find('input[name="email"]').removeClass('has-error').siblings('.email-error').text('');
|
||||
}
|
||||
|
||||
if (errors.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
formData.list_id = getListIdFromCountryCode(window.countryCode, SIGNUP_MODE.signup);
|
||||
formData.domain_url = getDomainByCountryCode(window.countryCode);
|
||||
onSignIn(formData).then((result) => {
|
||||
form.find('input[name="name"]').val('');
|
||||
form.find('input[name="email"]').val('');
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// newsletter form
|
||||
$('form.subscribe-form').on('submit', function(e) {
|
||||
const $this = $(this);
|
||||
|
||||
const form = $this;
|
||||
const formData = form.serializeArray().reduce((result, prop) => {
|
||||
result[prop.name] = prop.value;
|
||||
return result;
|
||||
}, {});
|
||||
const $msgBlock = $(form.find('.form-msg-block')[0] || $this.siblings('.form-msg-block')).length ? $(form.find('.form-msg-block')[0] || $this.siblings('.form-msg-block')) : null;
|
||||
let errors = [];
|
||||
if (!formData.name) {
|
||||
errors.push('Name is required');
|
||||
}
|
||||
if (!formData.email) {
|
||||
errors.push('Email is required');
|
||||
}
|
||||
if (errors.length) {
|
||||
const errMsg = errors.map(err => `<p class="error text-danger">${err}</p>`).join(' ');
|
||||
$msgBlock && $msgBlock.html(errMsg);
|
||||
return false;
|
||||
}
|
||||
formData.list_id = getListIdFromCountryCode(window.countryCode, SIGNUP_MODE.subscribe);
|
||||
formData.domain_url = getDomainByCountryCode(window.countryCode);
|
||||
|
||||
doSubscribeUser(formData, FloatURL + '/newsletter-subscribe')
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
// clear the form
|
||||
$(form).find('input[type=text], input[type=email]').val('');
|
||||
}
|
||||
|
||||
$msgBlock && $msgBlock.html(`<p class="success text-success">${res.message}</p>`);
|
||||
})
|
||||
.catch(err => {
|
||||
$msgBlock && $msgBlock.html('<p class="error text-danger">Something went wrong. Pleaes try again later.</p>');
|
||||
})
|
||||
.finally(() => {});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('button.sign-up-google-btn').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
$('#signupModal').modal('hide');
|
||||
let auth2 = gapi.auth2.getAuthInstance();
|
||||
auth2.signIn().then(function(googleUser) {
|
||||
const profile = googleUser.getBasicProfile();
|
||||
const requestData = {
|
||||
first_name: profile.getGivenName(),
|
||||
last_name: profile.getFamilyName(),
|
||||
email: profile.getEmail(),
|
||||
list_id: getListIdFromCountryCode(window.countryCode, SIGNUP_MODE.signup),
|
||||
domain_url: getDomainByCountryCode(window.countryCode),
|
||||
};
|
||||
onSignIn(requestData);
|
||||
return false;
|
||||
}).catch(error => {
|
||||
// console.log('error: ', error);
|
||||
});
|
||||
});
|
||||
|
||||
$("#successSignupModal, #signupModal").on('show.bs.modal', function(e) {
|
||||
$('body').css('overflow', 'hidden');
|
||||
});
|
||||
|
||||
$("#successSignupModal, #signupModal").on('hide.bs.modal', function(e) {
|
||||
$('body').css('overflow', 'unset');
|
||||
});
|
||||
|
||||
function onSignIn(requestData) {
|
||||
$('#signupModal').modal('hide');
|
||||
$('#successSignupModal').modal('show');
|
||||
return new Promise((resolve, reject) => doSubscribeUser(requestData, FloatURL + '/newsletter-subscribe')
|
||||
.then((res) => {
|
||||
const response = typeof(res) === 'string' ? JSON.parse(res) : res;
|
||||
if (response.errors) {
|
||||
// Handle errors
|
||||
const errMsgs = Object.keys(response.errors).reduce((result, key) => {
|
||||
const errMsg = response.errors[key];
|
||||
result.push(`<p class="error text-danger">${errMsg}</p>`);
|
||||
return result;
|
||||
}, []).join(' ');
|
||||
}
|
||||
return resolve(true);
|
||||
})
|
||||
.catch(err => {
|
||||
let message = "Server error, please refresh the page and try again";
|
||||
if (error && error.message) {
|
||||
message = error.message;
|
||||
}
|
||||
return reject(false);
|
||||
})
|
||||
.finally(() => {
|
||||
handleDissconnect();
|
||||
return reject(false);
|
||||
}));
|
||||
}
|
||||
|
||||
function doSubscribeUser(userData, url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return $.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
data: userData,
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
return resolve(res);
|
||||
},
|
||||
error: function(err) {
|
||||
return reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function handleDissconnect() {
|
||||
if (!gapi || !gapi.auth2) {
|
||||
return;
|
||||
}
|
||||
|
||||
gapi.auth2.getAuthInstance().disconnect().then(function() {
|
||||
//Do stuff here after the user has been signed out, you can still authenticate the token with Google on the server side
|
||||
});
|
||||
}
|
||||
|
||||
function initGoogleAuth() {
|
||||
if (typeof(gapi) === 'undefined' || !gapi) {
|
||||
return;
|
||||
}
|
||||
|
||||
gapi.load('auth2', function() {
|
||||
if (!ajax_object.google_client_id) {
|
||||
ajax_object.google_client_id = '343605975098-i4p86p4la6lpff0rmsq3mg36vi9do9rb.apps.googleusercontent.com';
|
||||
}
|
||||
gapi.auth2.init({
|
||||
client_id: ajax_object.google_client_id,
|
||||
// Scopes to request in addition to 'profile' and 'email'
|
||||
scope: 'profile email',
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getListIdFromCountryCode(countryCode, mode) {
|
||||
switch (countryCode.toUpperCase()) {
|
||||
case 'SG': {
|
||||
return contact_settings.sg_contact || 'f6ff7833-d6cf-425e-a426-395ac201b794';
|
||||
}
|
||||
case 'US': {
|
||||
return contact_settings.us_contact || 'a646ee53-dfec-4a6a-a0c3-102c6840df06';
|
||||
}
|
||||
default: {
|
||||
return contact_settings.default_list || 'a646ee53-dfec-4a6a-a0c3-102c6840df06';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getDomainByCountryCode(countryCode) {
|
||||
switch (countryCode.toUpperCase()) {
|
||||
case 'SG': {
|
||||
return 'https://www.float.sg'
|
||||
}
|
||||
case 'US': {
|
||||
return 'https://wwww.myfloat.com';
|
||||
}
|
||||
default: {
|
||||
return 'https://www.myfloat.com';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace WPC;
|
||||
|
||||
// use Elementor\Plugin; ?????
|
||||
|
||||
class Widget_Loader {
|
||||
|
||||
private static $_instance = null;
|
||||
|
||||
public static function instance()
|
||||
{
|
||||
if (is_null(self::$_instance)) {
|
||||
self::$_instance = new self();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
|
||||
private function include_widgets_files(){
|
||||
require_once(__DIR__ . '/widgets/custom-post-grid.php');
|
||||
require_once(__DIR__ . '/widgets/feature-article.php');
|
||||
require_once(__DIR__ . '/widgets/store-block.php');
|
||||
}
|
||||
|
||||
public function register_widgets(){
|
||||
|
||||
$this->include_widgets_files();
|
||||
|
||||
\Elementor\Plugin::instance()->widgets_manager->register_widget_type(new Widgets\CustomPostGrid());
|
||||
\Elementor\Plugin::instance()->widgets_manager->register_widget_type(new Widgets\FeatureArticle());
|
||||
\Elementor\Plugin::instance()->widgets_manager->register_widget_type(new Widgets\StoreBlock());
|
||||
|
||||
}
|
||||
|
||||
public function __construct(){
|
||||
add_action('elementor/widgets/widgets_registered', [$this, 'register_widgets'], 99);
|
||||
}
|
||||
}
|
||||
|
||||
// Instantiate Plugin Class
|
||||
Widget_Loader::instance();
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying the footer.
|
||||
*
|
||||
* @package OceanWP WordPress theme
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
</main><!-- #main -->
|
||||
|
||||
<!-- Signup modal -->
|
||||
<?php echo get_template_part('template-parts/components/signup-modal'); ?>
|
||||
|
||||
<!-- Success signup modal -->
|
||||
<?php echo get_template_part('template-parts/components/success-signup-modal'); ?>
|
||||
|
||||
<!-- Get current location -->
|
||||
<?php
|
||||
// $current_geo = geoip_detect2_get_info_from_current_ip(NULL, []);
|
||||
// $current_country = $current_geo->country->isoCode;
|
||||
$location = get_user_location();
|
||||
$current_country = $location['country_code'];
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
const countryCode = '<?php echo $current_country ?>';
|
||||
window.countryCode = countryCode;
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php do_action( 'ocean_after_main' ); ?>
|
||||
|
||||
<?php do_action( 'ocean_before_footer' ); ?>
|
||||
|
||||
<?php
|
||||
// Elementor `footer` location.
|
||||
if ( ! function_exists( 'elementor_theme_do_location' ) || ! elementor_theme_do_location( 'footer' ) ) {
|
||||
?>
|
||||
|
||||
<?php do_action( 'ocean_footer' ); ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php do_action( 'ocean_after_footer' ); ?>
|
||||
|
||||
</div><!-- #wrap -->
|
||||
|
||||
<?php do_action( 'ocean_after_wrap' ); ?>
|
||||
|
||||
</div><!-- #outer-wrap -->
|
||||
|
||||
<?php do_action( 'ocean_after_outer_wrap' ); ?>
|
||||
|
||||
<?php
|
||||
// If is not sticky footer.
|
||||
if ( ! class_exists( 'Ocean_Sticky_Footer' ) ) {
|
||||
get_template_part( 'partials/scroll-top' );
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
// Search overlay style.
|
||||
if ( 'overlay' === oceanwp_menu_search_style() ) {
|
||||
get_template_part( 'partials/header/search-overlay' );
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
// If sidebar mobile menu style.
|
||||
if ( 'sidebar' === oceanwp_mobile_menu_style() ) {
|
||||
|
||||
// Mobile panel close button.
|
||||
if ( get_theme_mod( 'ocean_mobile_menu_close_btn', true ) ) {
|
||||
get_template_part( 'partials/mobile/mobile-sidr-close' );
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
// Mobile Menu (if defined).
|
||||
get_template_part( 'partials/mobile/mobile-nav' );
|
||||
?>
|
||||
|
||||
<?php
|
||||
// Mobile search form.
|
||||
if ( get_theme_mod( 'ocean_mobile_menu_search', true ) ) {
|
||||
get_template_part( 'partials/mobile/mobile-search' );
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
// If full screen mobile menu style.
|
||||
if ( 'fullscreen' === oceanwp_mobile_menu_style() ) {
|
||||
get_template_part( 'partials/mobile/mobile-fullscreen' );
|
||||
}
|
||||
?>
|
||||
|
||||
<?php wp_footer(); ?>
|
||||
|
||||
<!-- Custom Sassy social style -->
|
||||
<style>
|
||||
ul.heateor_sss_sharing_ul li {
|
||||
margin: 5px 0!important;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,366 @@
|
||||
<?php
|
||||
/**
|
||||
* Child theme functions
|
||||
*
|
||||
* When using a child theme (see http://codex.wordpress.org/Theme_Development
|
||||
* and http://codex.wordpress.org/Child_Themes), you can override certain
|
||||
* functions (those wrapped in a function_exists() call) by defining them first
|
||||
* in your child theme's functions.php file. The child theme's functions.php
|
||||
* file is included before the parent theme's file, so the child theme
|
||||
* functions would be used.
|
||||
*
|
||||
* Text Domain: oceanwp
|
||||
* @link http://codex.wordpress.org/Plugin_API
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Load the parent style.css file
|
||||
*
|
||||
* @link http://codex.wordpress.org/Child_Themes
|
||||
*/
|
||||
function oceanwp_child_enqueue_parent_style() {
|
||||
// Dynamically get version number of the parent stylesheet (lets browsers re-cache your stylesheet when you update your theme)
|
||||
$theme = wp_get_theme( 'OceanWP' );
|
||||
$version = $theme->get( 'Version' );
|
||||
// Load the stylesheet
|
||||
wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'oceanwp-style' ), $version );
|
||||
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'oceanwp_child_enqueue_parent_style' );
|
||||
|
||||
/**
|
||||
* Link custom javascript file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function my_custom_scripts() {
|
||||
wp_enqueue_script( 'custom-js', get_stylesheet_directory_uri() . '/app.js', array( 'jquery' ),'',true );
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'my_custom_scripts' );
|
||||
|
||||
require_once 'custom-elementor.php';
|
||||
require_once 'widgets/float-widget-recent-post.php';
|
||||
|
||||
/**
|
||||
* Enqueue scripts and styles.
|
||||
*/
|
||||
function float_scripts() {
|
||||
wp_enqueue_script( 'custom-js' );
|
||||
wp_localize_script('custom-js', 'ajax_object', array('ajax_url' => admin_url( 'admin-ajax.php'), 'google_client_id' => defined("GOOGLE_CLIENT_APP_ID") ? GOOGLE_CLIENT_APP_ID : "343605975098-i4p86p4la6lpff0rmsq3mg36vi9do9rb.apps.googleusercontent.com" ));
|
||||
wp_localize_script('custom-js', 'contact_settings', array(
|
||||
'sg_contact' => defined("SG_CONTACT_LIST") ? SG_CONTACT_LIST : "f6ff7833-d6cf-425e-a426-395ac201b794",
|
||||
'us_contact' => defined("US_CONTACT_LIST") ? US_CONTACT_LIST : "a646ee53-dfec-4a6a-a0c3-102c6840df06",
|
||||
'default_list' => defined("DEFAULT_CONTACT_LIST") ? DEFAULT_CONTACT_LIST : "6e36b912-7cc3-4fb2-ba50-a664fbefb11b"
|
||||
));
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'float_scripts' );
|
||||
|
||||
function get_user_location() {
|
||||
|
||||
$ip = get_user_ip();
|
||||
$result = [
|
||||
'country'=>'',
|
||||
'city'=>'',
|
||||
'timezone' => 'Asia/Singapore',
|
||||
'region_name'=>'',
|
||||
'country_code'=>'',
|
||||
'lat'=>'',
|
||||
'lng'=>''
|
||||
];
|
||||
|
||||
$ip_data = @json_decode(file_get_contents('http://www.geoplugin.net/json.gp?ip='.$ip));
|
||||
if($ip_data && $ip_data->geoplugin_countryName != null){
|
||||
$result['country'] = $ip_data->geoplugin_countryName;
|
||||
$result['city'] = $ip_data->geoplugin_city;
|
||||
$result['timezone'] = $ip_data->geoplugin_timezone;
|
||||
$result['region_name'] = $ip_data->geoplugin_region;
|
||||
$result['country_code'] = $ip_data->geoplugin_countryCode;
|
||||
$result['lat'] = $ip_data->geoplugin_latitude;
|
||||
$result['lng'] = $ip_data->geoplugin_longitude;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function get_user_ip() {
|
||||
$client = @$_SERVER['HTTP_CLIENT_IP'];
|
||||
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
$remote = @$_SERVER['REMOTE_ADDR'];
|
||||
|
||||
if(filter_var($client, FILTER_VALIDATE_IP)){
|
||||
$ip = $client;
|
||||
}elseif(filter_var($forward, FILTER_VALIDATE_IP)){
|
||||
$ip = $forward;
|
||||
}else{
|
||||
$ip = $remote;
|
||||
}
|
||||
|
||||
return $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* set Popular Posts by Views
|
||||
*/
|
||||
function float_set_post_views($postID) {
|
||||
$count_key = 'float_post_views_count';
|
||||
$count = get_post_meta($postID, $count_key, true);
|
||||
|
||||
if (empty($count)) {
|
||||
delete_post_meta($postID, $count_key);
|
||||
add_post_meta($postID, $count_key, 1);
|
||||
} else {
|
||||
$count++;
|
||||
update_post_meta($postID, $count_key, $count);
|
||||
}
|
||||
}
|
||||
|
||||
function get_latest_articles($request) {
|
||||
$limit = isset($_GET['limit']) ? intval(trim($_GET['limit'])) : 10;
|
||||
$page = isset($_GET['page']) ? intval(trim($_GET['page'])) : 1;
|
||||
if (!isset($limit) || !is_int($limit) || $limit <= 0) {
|
||||
$limit = 10; // Set limit to by 10 as default
|
||||
}
|
||||
if (!isset($page) || !is_int($page) || $page <= 0) {
|
||||
$page = 1; // Set default page
|
||||
}
|
||||
$query = new WP_Query( array(
|
||||
'post_type' => 'post',
|
||||
'post_status' => 'publish',
|
||||
'ignore_sticky_posts' => 1,
|
||||
'posts_per_page' => $limit,
|
||||
'paged' => $page,
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC'
|
||||
) );
|
||||
|
||||
if ( !$query->have_posts() ) {
|
||||
return new WP_Error( 'empty_post', 'there is no post ', array('status' => 404) );
|
||||
}
|
||||
|
||||
// add meta to post
|
||||
$newPost = array();
|
||||
foreach ( $query->posts as $key => $post ) {
|
||||
add_meta_value_to_posts( $post );
|
||||
array_push( $newPost, $post );
|
||||
}
|
||||
wp_reset_postdata();
|
||||
|
||||
// Add co-authors to post if exists
|
||||
foreach ( $newPost as $post ) {
|
||||
$co_authors = get_coauthors( $post->ID );
|
||||
$result = [];
|
||||
|
||||
foreach ( $co_authors as $co_author ) {
|
||||
if (get_class($co_author) !== 'WP_User') {
|
||||
array_push($result, $co_author->display_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
array_push($result, $co_author->data->display_name);
|
||||
}
|
||||
|
||||
if ( !empty($result) ) {
|
||||
$post->co_authors = $result;
|
||||
}
|
||||
}
|
||||
|
||||
$response = new WP_REST_Response( $newPost );
|
||||
$response->set_status(200);
|
||||
return $response;
|
||||
}
|
||||
|
||||
function get_article_by_id($request) {
|
||||
$post_id = isset($request['id']) && intval($request['id']) ? intval($request['id']) : NULL;
|
||||
if (empty($post_id)) {
|
||||
return new WP_Error( 'error', 'missing post id params ', array('status' => 400) );
|
||||
}
|
||||
$post = get_post( $post_id );
|
||||
|
||||
if (empty($post)) {
|
||||
return new WP_Error( 'empty_post', 'there is no post ', array('status' => 404) );
|
||||
}
|
||||
add_meta_value_to_posts( $post );
|
||||
|
||||
// Add co-authors to post if exists
|
||||
$co_authors = get_coauthors( $post->ID );
|
||||
$result = [];
|
||||
|
||||
foreach ( $co_authors as $co_author ) {
|
||||
if (get_class($co_author) !== 'WP_User') {
|
||||
array_push($result, $co_author->display_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
array_push($result, $co_author->data->display_name);
|
||||
}
|
||||
|
||||
if ( !empty($result) ) {
|
||||
$post->co_authors = $result;
|
||||
}
|
||||
|
||||
$response = new WP_REST_Response($post);
|
||||
$response->set_status(200);
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
add_action('rest_api_init', function () {
|
||||
register_rest_route( 'float/v1', 'latest-articles',array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'get_latest_articles',
|
||||
'permission_callback' => '__return_true'
|
||||
));
|
||||
register_rest_route( 'float/v1', 'articles/(?P<id>\d+)',array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'get_article_by_id',
|
||||
'permission_callback' => '__return_true'
|
||||
));
|
||||
});
|
||||
|
||||
/**
|
||||
* add more menu item
|
||||
*/
|
||||
function add_signup_link( $items, $args ) {
|
||||
if ($args->theme_location == 'main_menu') {
|
||||
$items .= '<li class="menu-item menu-item-type-custom menu-item-object-custom"><a class="menu-link" role="button" data-toggle="modal" data-target="#signupModal" href="javascript:void(0)">Sign up</a></li>';
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
add_filter( 'wp_nav_menu_items', 'add_signup_link', 10, 2 );
|
||||
|
||||
/**
|
||||
* Add meta tags for marketing
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function add_meta_tags() {
|
||||
global $post;
|
||||
if ( is_single() ) {
|
||||
$des_post = strip_tags( $post->post_content );
|
||||
$des_post = strip_shortcodes( $des_post );
|
||||
$des_post = str_replace( array("\n", "\r", "\t"), ' ', $des_post );
|
||||
$des_post = trim( $des_post );
|
||||
$des_post = mb_substr( $des_post, 0, 300, 'utf8' );
|
||||
echo "\n" . '<meta name="description" content="' . $des_post . '" />' . "\n";
|
||||
echo '<meta property="og:title" content="' . $post->post_title . '" />' . "\n";
|
||||
echo '<meta property="og:description" content="' . $des_post . '" />' . "\n";
|
||||
echo '<meta property="og:type" content="article">' . "\n";
|
||||
echo '<meta property="og:image" content="' . get_the_post_thumbnail_url($post->ID) . '">' . "\n";
|
||||
echo '<meta property="og:url" content="' . get_permalink($post->ID) . '">' . "\n";
|
||||
echo '<meta property="og:site_name" content="' . get_bloginfo( 'name' ) . '">' . "\n";
|
||||
echo '<meta name="twitter:card" content="summary_large_image">' . "\n";
|
||||
echo '<meta name="twitter:image" content="' . get_the_post_thumbnail_url($post->ID) . '">' . "\n";
|
||||
}
|
||||
|
||||
if ( is_page() ) {
|
||||
echo "\n" . '<meta name="description" content="Travel Budget and Planning App" />' . "\n";
|
||||
echo '<meta property="og:title" content="' . get_bloginfo( 'name' ) . '" />' . "\n";
|
||||
echo '<meta property="og:description" content="Travel Budget and Planning App" />' . "\n";
|
||||
echo '<meta property="og:url" content="' . get_site_url() . '">' . "\n";
|
||||
echo '<meta property="og:site_name" content="' . get_bloginfo( 'name' ) . '">' . "\n";
|
||||
}
|
||||
|
||||
if ( is_home() ) {
|
||||
echo "\n" . '<meta name="description" content="Travel Budget and Planning App" />' . "\n";
|
||||
echo '<meta property="og:title" content="Homepage" />' . "\n";
|
||||
echo '<meta property="og:description" content="Travel Budget and Planning App" />' . "\n";
|
||||
echo '<meta property="og:url" content="' . get_site_url() . '">' . "\n";
|
||||
echo '<meta property="og:site_name" content="' . get_bloginfo( 'name' ) . '">' . "\n";
|
||||
}
|
||||
|
||||
if ( is_category() ) {
|
||||
$des_cat = strip_tags(category_description());
|
||||
echo "\n" . '<meta name="description" content="' . $des_cat . '" />' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
add_action('wp_head', 'add_meta_tags');
|
||||
|
||||
/**
|
||||
* Additional meta data to post
|
||||
* @param WP_POST &$post
|
||||
*/
|
||||
function add_meta_value_to_posts( &$post ) {
|
||||
if ( !$post ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// get all custom fields
|
||||
if ( function_exists( 'get_fields' ) ) {
|
||||
$post_meta = get_fields( $post->ID );
|
||||
if ( $post_meta ) {
|
||||
foreach ( $post_meta as $key => $meta ) {
|
||||
if ( !empty($meta) && is_string($meta) && preg_match( '/^http|^https:\/\/.*?/m', $meta ) ) {
|
||||
$meta = encodeURI( $meta );
|
||||
}
|
||||
$post->$key = $meta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get post author
|
||||
$post->display_name = get_the_author_meta( 'display_name', $post->post_author );
|
||||
|
||||
// get featured image
|
||||
$post->featured_image = encodeURI( get_the_post_thumbnail_url( $post ) );
|
||||
$post->_wp_attachment_metadata = get_post_meta( $post->ID, '_wp_attachment_metadata', true );
|
||||
|
||||
}
|
||||
|
||||
function encodeURI($url) {
|
||||
// http://php.net/manual/en/function.rawurlencode.php
|
||||
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURI
|
||||
$unescaped = array(
|
||||
'%2D'=>'-','%5F'=>'_','%2E'=>'.','%21'=>'!', '%7E'=>'~',
|
||||
'%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')'
|
||||
);
|
||||
$reserved = array(
|
||||
'%3B'=>';','%2C'=>',','%2F'=>'/','%3F'=>'?','%3A'=>':',
|
||||
'%40'=>'@','%26'=>'&','%3D'=>'=','%2B'=>'+','%24'=>'$'
|
||||
);
|
||||
$score = array(
|
||||
'%23'=>'#'
|
||||
);
|
||||
return strtr(rawurlencode($url), array_merge($reserved,$unescaped,$score));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Comment fields
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
if ( ! function_exists( 'oceanwp_modify_comment_form_fields' ) ) {
|
||||
|
||||
function oceanwp_modify_comment_form_fields( $fields ) {
|
||||
|
||||
$commenter = wp_get_current_commenter();
|
||||
$req = get_option( 'require_name_email' );
|
||||
|
||||
// Labels.
|
||||
if ( $req ) {
|
||||
$comment_name = oceanwp_theme_strings( 'owp-string-comment-name-req', false, 'oceanwp' );
|
||||
$comment_email = oceanwp_theme_strings( 'owp-string-comment-email-req', false, 'oceanwp' );
|
||||
} else {
|
||||
$comment_name = oceanwp_theme_strings( 'owp-string-comment-name', false, 'oceanwp' );
|
||||
$comment_email = oceanwp_theme_strings( 'owp-string-comment-email', false, 'oceanwp' );
|
||||
}
|
||||
|
||||
$comment_site = oceanwp_theme_strings( 'owp-string-comment-website', false, 'oceanwp' );
|
||||
|
||||
$fields['author'] = '<div class="comment-form-author"><label for="author" class="screen-reader-text">'. esc_html__( 'Enter your name or username to comment', 'oceanwp' ) . '</label><input type="text" name="author" id="author" value="'. esc_attr( $commenter['comment_author'] ) .'" placeholder="'. $comment_name .'" size="22" tabindex="0"'. ( $req ? ' aria-required="true"' : '' ) .' class="input-name" /></div>';
|
||||
|
||||
$fields['email'] = '<div class="comment-form-email"><label for="email" class="screen-reader-text">'. esc_html__( 'Enter your email address to comment', 'oceanwp' ) . '</label><input type="text" name="email" id="email" value="'. esc_attr( $commenter['comment_author_email'] ) .'" placeholder="'. $comment_email .'" size="22" tabindex="0"'. ( $req ? ' aria-required="true"' : '' ) .' class="input-email" /></div>';
|
||||
|
||||
$fields['url'] = '';
|
||||
|
||||
$fields['cookies'] = '';
|
||||
|
||||
return $fields;
|
||||
|
||||
}
|
||||
|
||||
add_filter( 'comment_form_default_fields', 'oceanwp_modify_comment_form_fields' );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* The Header for our theme.
|
||||
*
|
||||
* @package OceanWP WordPress theme
|
||||
*/
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html class="<?php echo esc_attr( oceanwp_html_classes() ); ?>" <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<!-- Google Tag Manager -->
|
||||
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','GTM-W7DMNQ2');</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
|
||||
<meta charset="<?php bloginfo( 'charset' ); ?>">
|
||||
<meta name="facebook-domain-verification" content="spd14hdwl8crxdjkigtovd477anp2w" />
|
||||
<link rel="profile" href="https://gmpg.org/xfn/11">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700;800&display=swap" rel="stylesheet">
|
||||
|
||||
<?php wp_head(); ?>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
|
||||
<script src="https://apis.google.com/js/client:platform.js"></script>
|
||||
</head>
|
||||
|
||||
<body <?php body_class(); ?> <?php oceanwp_schema_markup( 'html' ); ?>>
|
||||
|
||||
<!-- Google Tag Manager (noscript) -->
|
||||
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W7DMNQ2"
|
||||
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
|
||||
<?php wp_body_open(); ?>
|
||||
|
||||
<?php do_action( 'ocean_before_outer_wrap' ); ?>
|
||||
|
||||
<div id="outer-wrap" class="site clr">
|
||||
|
||||
<a class="skip-link screen-reader-text" href="#main"><?php oceanwp_theme_strings( 'owp-string-header-skip-link', 'oceanwp' ); ?></a>
|
||||
|
||||
<?php do_action( 'ocean_before_wrap' ); ?>
|
||||
|
||||
<div id="wrap" class="clr">
|
||||
|
||||
<?php do_action( 'ocean_top_bar' ); ?>
|
||||
|
||||
<?php do_action( 'ocean_header' ); ?>
|
||||
|
||||
<?php do_action( 'ocean_before_main' ); ?>
|
||||
|
||||
<main id="main" class="site-main clr"<?php oceanwp_schema_markup( 'main' ); ?> role="main">
|
||||
|
||||
<?php do_action( 'ocean_page_header' ); ?>
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* Single post layout
|
||||
*
|
||||
* @package OceanWP WordPress theme
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>">
|
||||
|
||||
<?php
|
||||
// Get posts format.
|
||||
$format = get_post_format();
|
||||
|
||||
// Get elements.
|
||||
$elements = oceanwp_blog_single_elements_positioning();
|
||||
|
||||
// Loop through elements.
|
||||
foreach ( $elements as $element ) {
|
||||
|
||||
// Featured Image.
|
||||
if ( 'featured_image' === $element
|
||||
&& ! post_password_required() ) {
|
||||
|
||||
$format = $format ? $format : 'thumbnail';
|
||||
|
||||
get_template_part( 'partials/single/media/blog-single', $format );
|
||||
|
||||
}
|
||||
|
||||
// Title.
|
||||
if ( 'title' === $element ) {
|
||||
|
||||
get_template_part( 'partials/single/header' );
|
||||
|
||||
}
|
||||
|
||||
// Meta.
|
||||
if ( 'meta' === $element ) {
|
||||
|
||||
get_template_part( 'partials/single/meta' );
|
||||
|
||||
}
|
||||
|
||||
// Content.
|
||||
if ( 'content' === $element ) {
|
||||
|
||||
get_template_part( 'partials/single/content' );
|
||||
|
||||
}
|
||||
|
||||
// Tags.
|
||||
if ( 'tags' === $element ) {
|
||||
|
||||
get_template_part( 'partials/single/tags' );
|
||||
|
||||
}
|
||||
|
||||
// Social Share.
|
||||
if ( 'social_share' === $element
|
||||
&& OCEAN_EXTRA_ACTIVE ) {
|
||||
|
||||
do_action( 'ocean_social_share' );
|
||||
|
||||
}
|
||||
|
||||
// Next/Prev.
|
||||
if ( 'next_prev' === $element ) {
|
||||
|
||||
get_template_part( 'partials/single/next-prev' );
|
||||
|
||||
}
|
||||
|
||||
// Author Box.
|
||||
if ( 'author_box' === $element ) {
|
||||
|
||||
get_template_part( 'partials/single/author-bio' );
|
||||
|
||||
}
|
||||
|
||||
// Related Posts.
|
||||
if ( 'related_posts' === $element ) {
|
||||
|
||||
get_template_part( 'partials/single/related-posts' );
|
||||
|
||||
}
|
||||
|
||||
// Comments.
|
||||
if ( 'single_comments' === $element ) {
|
||||
|
||||
comments_template();
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</article>
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Post single meta
|
||||
*
|
||||
* @package OceanWP WordPress theme
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get meta sections.
|
||||
$sections = oceanwp_blog_single_meta();
|
||||
|
||||
// Return if sections are empty.
|
||||
if ( empty( $sections )
|
||||
|| 'post' !== get_post_type() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Return if quote format.
|
||||
if ( 'quote' === get_post_format() ) {
|
||||
return;
|
||||
} ?>
|
||||
|
||||
<?php do_action( 'ocean_before_single_post_meta' ); ?>
|
||||
|
||||
<ul class="meta clr">
|
||||
|
||||
<?php
|
||||
// Loop through meta sections.
|
||||
foreach ( $sections as $section ) {
|
||||
?>
|
||||
|
||||
<?php if ( 'author' === $section ) { ?>
|
||||
<?php
|
||||
// Get co-authors
|
||||
$authors = [];
|
||||
|
||||
$co_authors = get_coauthors(get_the_ID());
|
||||
|
||||
foreach($co_authors as $co_author) {
|
||||
if(get_class($co_author) !== 'WP_User') {
|
||||
array_push($authors, $co_author->display_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
array_push($authors, $co_author->data->display_name);
|
||||
}
|
||||
|
||||
if (empty($authors)) {
|
||||
$post_author = get_the_author_meta( 'display_name' , get_post_field('post_author') );
|
||||
array_push($authors, $post_author);
|
||||
}
|
||||
|
||||
$authors = join(', ', $authors);
|
||||
?>
|
||||
<li class="meta-author"></span><i class="icon-user" aria-hidden="true"></i><?php echo $authors ?></li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( 'date' === $section ) { ?>
|
||||
<li class="meta-date"<?php oceanwp_schema_markup( 'publish_date' ); ?>><span class="screen-reader-text"><?php esc_html_e( 'Post published:', 'oceanwp' ); ?></span><i class="icon-clock" aria-hidden="true"></i><?php echo get_the_date(); ?></li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( 'mod-date' === $section ) { ?>
|
||||
<li class="meta-mod-date"<?php oceanwp_schema_markup( 'modified_date' ); ?>><span class="screen-reader-text"><?php esc_html_e( 'Post last modified:', 'oceanwp' ); ?></span><i class="icon-note" aria-hidden="true"></i><?php echo esc_html( get_the_modified_date() ); ?></li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( 'categories' === $section ) { ?>
|
||||
<li class="meta-cat"><span class="screen-reader-text"><?php esc_html_e( 'Post category:', 'oceanwp' ); ?></span><i class="icon-folder" aria-hidden="true"></i><?php the_category( ' <span class="owp-sep">/</span> ', get_the_ID() ); ?></li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( 'reading-time' === $section ) { ?>
|
||||
<li class="meta-cat"><span class="screen-reader-text"><?php esc_html_e( 'Reading time:', 'oceanwp' ); ?></span><i class="icon-cup" aria-hidden="true"></i><?php echo esc_attr( ocean_reading_time() ); ?></li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( 'comments' === $section && comments_open() && ! post_password_required() ) { ?>
|
||||
<li class="meta-comments"><span class="screen-reader-text"><?php esc_html_e( 'Post comments:', 'oceanwp' ); ?></span><i class="icon-bubble" aria-hidden="true"></i><?php comments_popup_link( esc_html__( '0 Comments', 'oceanwp' ), esc_html__( '1 Comment', 'oceanwp' ), esc_html__( '% Comments', 'oceanwp' ), 'comments-link' ); ?></li>
|
||||
<?php } ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
|
||||
<?php do_action( 'ocean_after_single_post_meta' ); ?>
|
||||
@@ -0,0 +1,11 @@
|
||||
<div class="store-block py-5">
|
||||
<p class="title text-center"><strong>Download</strong> the Float app now.</p>
|
||||
<div class="download-btn-wrapper d-flex flex-wrap justify-content-around mx-auto">
|
||||
<a class="mx-2 mb-2" href="https://smart.link/afcjz898yquo8" target="_blank">
|
||||
<img src="https://blog.float.sg/wp-content/themes/float/images/google.svg" alt="google-img">
|
||||
</a>
|
||||
<a class="mx-2 mb-2" href="https://smart.link/afcjz898yquo8" target="_blank">
|
||||
<img src="https://blog.float.sg/wp-content/themes/float/images/apple.svg" alt="apple-img">
|
||||
</a>
|
||||
</div>
|
||||
</div><!-- store-block -->
|
||||
@@ -0,0 +1,15 @@
|
||||
<div class="subscribe-form-wrapper bgc-gray d-flex justify-content-center">
|
||||
<form class="subscribe-form" id="subscribe-form" method="POST" data-action="/newsletter-subscribe">
|
||||
<h2 class="text-center">Think we're onto something? Sign-up for Float</h3>
|
||||
<div class="mb-4">
|
||||
<input type="text" name="name" id="name" value="" placeholder="Name">
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<input type="email" name="email" id="email" value="" placeholder="Email">
|
||||
</div>
|
||||
<div class="form-msg-block mb-4"></div>
|
||||
<div class="text-center">
|
||||
<button type="submit" id="subscribe-button" class="subscribe-button">Sign-up</button>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- subscribe-form -->
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying all pages, single posts and attachments
|
||||
*
|
||||
* This is a new template file that WordPress introduced in
|
||||
* version 4.3.
|
||||
*
|
||||
* @package OceanWP WordPress theme
|
||||
*/
|
||||
|
||||
get_header();
|
||||
float_set_post_views(get_the_ID()); ?>
|
||||
|
||||
<?php do_action( 'ocean_before_content_wrap' ); ?>
|
||||
|
||||
<div id="content-wrap" class="container clr">
|
||||
|
||||
<?php do_action( 'ocean_before_primary' ); ?>
|
||||
|
||||
<div id="primary" class="content-area clr">
|
||||
|
||||
<?php do_action( 'ocean_before_content' ); ?>
|
||||
|
||||
<div id="content" class="site-content clr">
|
||||
|
||||
<?php do_action( 'ocean_before_content_inner' ); ?>
|
||||
|
||||
<?php
|
||||
// Elementor `single` location.
|
||||
if ( ! function_exists( 'elementor_theme_do_location' ) || ! elementor_theme_do_location( 'single' ) ) {
|
||||
|
||||
// Start loop.
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
|
||||
if ( is_singular( 'download' ) ) {
|
||||
|
||||
// EDD Page.
|
||||
get_template_part( 'partials/edd/single' );
|
||||
|
||||
} elseif ( is_singular( 'page' ) ) {
|
||||
|
||||
// Single post.
|
||||
get_template_part( 'partials/page/layout' );
|
||||
|
||||
} elseif ( is_singular( 'oceanwp_library' ) || is_singular( 'elementor_library' ) ) {
|
||||
|
||||
// Library post types.
|
||||
get_template_part( 'partials/library/layout' );
|
||||
|
||||
} else {
|
||||
|
||||
// All other post types.
|
||||
get_template_part( 'partials/single/layout', get_post_type() );
|
||||
|
||||
}
|
||||
|
||||
endwhile;
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
<?php do_action( 'ocean_after_content_inner' ); ?>
|
||||
|
||||
</div><!-- #content -->
|
||||
|
||||
<?php do_action( 'ocean_after_content' ); ?>
|
||||
|
||||
</div><!-- #primary -->
|
||||
|
||||
<?php do_action( 'ocean_after_primary' ); ?>
|
||||
|
||||
</div><!-- #content-wrap -->
|
||||
|
||||
<?php do_action( 'ocean_after_content_wrap' ); ?>
|
||||
|
||||
<?php
|
||||
|
||||
// Load custom float block for single post
|
||||
get_template_part( 'partials/single/subscribe-form' );
|
||||
get_template_part( 'partials/single/store-block' );
|
||||
|
||||
?>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
@@ -0,0 +1,717 @@
|
||||
/*
|
||||
Theme Name: OceanWP Child
|
||||
Theme URI: https://oceanwp.org/
|
||||
Description: OceanWP WordPress theme example child theme.
|
||||
Author: Nick
|
||||
Author URI: https://oceanwp.org/
|
||||
Template: oceanwp
|
||||
Version: 1.0
|
||||
*/
|
||||
|
||||
/* Parent stylesheet should be loaded from functions.php not using @import */
|
||||
|
||||
#site-navigation-wrap .dropdown-menu {
|
||||
display: block;
|
||||
float: none;
|
||||
position: relative;
|
||||
top: auto;
|
||||
left: auto;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
#footer-bottom.no-footer-nav #copyright {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#site-navigation-wrap a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.oceanwp-mobile-menu-icon a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.single-post ul.meta, .single-post ul.meta li a {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.entry-content p {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.entry-content p {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.entry-content p a,
|
||||
.entry-content li a,
|
||||
.entry-content ol a {
|
||||
font-weight: normal;
|
||||
color: #007bff;
|
||||
}
|
||||
|
||||
.entry-content p a:hover,
|
||||
.entry-content li a:hover,
|
||||
.entry-content ol a:hover {
|
||||
color: #007bff8c;
|
||||
}
|
||||
|
||||
.entry-content li,
|
||||
.entry-content ol {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.custom-post-grid-block {
|
||||
margin: 0 auto;
|
||||
}
|
||||
.post-wrapper {
|
||||
margin-bottom: 30px;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 8px 35px 0 rgba(0,6,55,.15);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.post-wrapper .thumbnail {
|
||||
width: 100%;
|
||||
padding-top: 50%;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
}
|
||||
.post-wrapper .title {
|
||||
margin: 10px 0 0;
|
||||
font-family: "Open Sans", -apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
||||
font-size: 22px;
|
||||
font-weight: 400;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
.post-wrapper .title a {
|
||||
color: #21262C;
|
||||
text-decoration: none;
|
||||
}
|
||||
.post-wrapper .title a:hover {
|
||||
color: #23527C;
|
||||
}
|
||||
.post-wrapper .content-wrapper {
|
||||
padding: 15px 25px 25px;
|
||||
}
|
||||
.post-wrapper .meta {
|
||||
margin-bottom: 5px;
|
||||
font-family: "Open Sans", -apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
||||
font-size: 13px;
|
||||
text-decoration: none;
|
||||
color: #6063EA;
|
||||
}
|
||||
.post-wrapper .post-content {
|
||||
margin: 0 0 7px;
|
||||
font-family: "Poppins",Sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.5em;
|
||||
color: #8B8B8B;
|
||||
}
|
||||
.post-wrapper .read-more {
|
||||
font-family: "Poppins",Sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #8562F8;
|
||||
text-decoration: none;
|
||||
}
|
||||
.post-content .read-more:hover {
|
||||
color: #553AB0;
|
||||
}
|
||||
.text-truncate-1-line {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
.text-truncate-2-line {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Feature article */
|
||||
.feature-article-block {
|
||||
position: relative;
|
||||
min-height: 150px;
|
||||
padding-top: 47.61%;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
}
|
||||
.feature-article-block .content-wrapper {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 80%;
|
||||
}
|
||||
.feature-article-block .title {
|
||||
margin: 0;
|
||||
padding: 0 0 5px;
|
||||
font-family: "Roboto", -apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
}
|
||||
.feature-article-block .article-meta {
|
||||
margin-bottom: 0;
|
||||
font-family: "Roboto", -apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
||||
font-size: 8px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 1px;
|
||||
color: #fff;
|
||||
}
|
||||
.feature-article-block .read-more {
|
||||
font-family: "Roboto", -apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
||||
font-size: 5px;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
display: inline-block;
|
||||
padding: 5px 15px;
|
||||
letter-spacing: 1px;
|
||||
color: #fff;
|
||||
border: 1px solid #f1f1f1;
|
||||
border-radius: 20px;
|
||||
-webkit-transition: all 0.3s ease;
|
||||
-moz-transition: all 0.3s ease;
|
||||
-ms-transition: all 0.3s ease;
|
||||
-o-transition: all 0.3s ease;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.feature-article-block .read-more:hover {
|
||||
border: 1px solid #13aff0 !important;
|
||||
text-decoration: none;
|
||||
background-color: #13aff0;
|
||||
color: #fff !important;
|
||||
}
|
||||
.feature-article-block .category-wrapper {
|
||||
width: fit-content;
|
||||
margin: 0 auto 20px;
|
||||
padding: 6px 15px;
|
||||
letter-spacing: 2px;
|
||||
border-radius: 20px;
|
||||
background-color: #6063EA;
|
||||
font-family: "Roboto", -apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
||||
font-size: 8px;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
-webkit-transition: all 0.3s ease;
|
||||
-moz-transition: all 0.3s ease;
|
||||
-ms-transition: all 0.3s ease;
|
||||
-o-transition: all 0.3s ease;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.feature-article-block .category-wrapper * {
|
||||
color: #fff;
|
||||
}
|
||||
.feature-article-block .category-wrapper:hover {
|
||||
background-color: #fff;
|
||||
color: #13aff0;
|
||||
}
|
||||
.feature-article-block .category-wrapper:hover * {
|
||||
color: #13aff0;
|
||||
}
|
||||
.feature-article-block .category-wrapper a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
.feature-article-block .divider {
|
||||
width: 50px;
|
||||
margin: 5px auto;
|
||||
border-top: 2px solid #fff;
|
||||
}
|
||||
@media (min-width: 576px) {
|
||||
.feature-article-block {
|
||||
min-height: unset;
|
||||
}
|
||||
.feature-article-block .article-meta {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.feature-article-block .category-wrapper {
|
||||
font-size: 10px;
|
||||
}
|
||||
.feature-article-block .title {
|
||||
font-size: 30px;
|
||||
}
|
||||
.feature-article-block .divider {
|
||||
margin: 10px auto;
|
||||
}
|
||||
.feature-article-block .article-meta {
|
||||
margin: 15px 0 20px;
|
||||
font-size: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
.feature-article-block .read-more {
|
||||
padding: 8px 20px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
@media (min-width: 992px) {
|
||||
.feature-article-block .title {
|
||||
font-size: 45px;
|
||||
}
|
||||
}
|
||||
/* End Feature article */
|
||||
|
||||
/* Sassy social share */
|
||||
@media (min-width: 768px) {
|
||||
div.heateor_sss_sharing_container {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 7px;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
ul.heateor_sss_sharing_ul {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
/* End Sassy social share */
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.custom-post-grid-block {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.post-wrapper {
|
||||
width: 49%;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
.custom-post-grid-block {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.post-wrapper {
|
||||
width: 32%;
|
||||
}
|
||||
.post-wrapper:nth-child(3n + 2) {
|
||||
margin: 0 2% 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-wrapper {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dropbtn {
|
||||
padding: 16px;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.dropbtn:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.filter-icon {
|
||||
font-size: 25px;
|
||||
color: #21262C;
|
||||
}
|
||||
|
||||
.dropdown {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.dropdown-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
background-color: #f1f1f1;
|
||||
min-width: 160px;
|
||||
overflow: auto;
|
||||
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.dropdown-content a {
|
||||
color: black;
|
||||
padding: 12px 16px;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
font-family: "Open Sans", -apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.dropdown a:hover {
|
||||
text-decoration: none;
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
.show {display: block;}
|
||||
|
||||
.custom-pagination {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.custom-pagination ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.custom-pagination a {
|
||||
display: inline-block;
|
||||
padding: 10px 18px;
|
||||
font-family: "Open Sans", -apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
||||
font-size: 14px;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
.custom-pagination a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.custom-pagination .is-active li {
|
||||
font-weight: bold;
|
||||
border-bottom: 3px solid #13aff0;
|
||||
}
|
||||
|
||||
/* Modal */
|
||||
.nsem-dialog, .nssm-dialog {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.nsem-modal-content, .nssm-modal-content {
|
||||
border: none !important;
|
||||
border-radius: 0 !important;
|
||||
min-height: 100vh !important;
|
||||
}
|
||||
|
||||
.nsem-modal-content {
|
||||
padding: 72px 45px !important;
|
||||
}
|
||||
|
||||
.nsem-close {
|
||||
margin: -70px -60px 0 0 !important;
|
||||
font-size: 38px !important;
|
||||
opacity: 1 !important;
|
||||
font-weight: 500 !important;
|
||||
}
|
||||
|
||||
.nsem-modal-header{
|
||||
border: none !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.nsem-header-small{
|
||||
font-family: 'Open Sans', sans-serif !important;
|
||||
font-style: normal !important;
|
||||
font-weight: 600 !important;
|
||||
font-size: 16px !important;
|
||||
line-height: 120% !important;
|
||||
letter-spacing: 0.1em !important;
|
||||
text-transform: uppercase !important;
|
||||
color: #000000 !important;
|
||||
}
|
||||
|
||||
.nsem-title{
|
||||
margin: 12px 0 !important;
|
||||
font-family: 'Open Sans', sans-serif !important;
|
||||
font-style: normal !important;
|
||||
font-weight: 600 !important;
|
||||
font-size: 32px !important;
|
||||
line-height: 115.4% !important;
|
||||
color: #000000 !important;
|
||||
}
|
||||
|
||||
.nsem-subtitle{
|
||||
margin-bottom: 54px !important;
|
||||
font-family: 'Open Sans', sans-serif !important;
|
||||
font-style: normal !important;
|
||||
font-weight: normal !important;
|
||||
font-size: 20px !important;
|
||||
line-height: 145% !important;
|
||||
letter-spacing: -0.2px !important;
|
||||
color: #000000 !important;
|
||||
}
|
||||
|
||||
.nsem-modal-body{
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.nsem-btn-1{
|
||||
width: 100% !important;
|
||||
padding: 13px 0 !important;
|
||||
font-family: 'Open Sans', sans-serif !important;
|
||||
font-style: normal !important;
|
||||
font-weight: bold !important;
|
||||
font-size: 16px !important;
|
||||
line-height: 134.77% !important;
|
||||
background-color: #FFFFFF !important;
|
||||
border-width: 0 !important;
|
||||
border: 2px solid #000000 !important;
|
||||
box-sizing: border-box !important;
|
||||
border-radius: 5px !important;
|
||||
}
|
||||
|
||||
.nsem-btn-1 img {
|
||||
margin-right: 12px !important;
|
||||
}
|
||||
|
||||
.nsem-btn-1 p {
|
||||
margin-top: 2px !important;
|
||||
margin-bottom: 0 !important;
|
||||
padding-bottom: 0 !important;
|
||||
color: #000 !important;
|
||||
}
|
||||
|
||||
.nsem-btn-1:focus{
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
.nsem-form-input{
|
||||
border: 2px solid #000000 !important;
|
||||
box-sizing: border-box !important;
|
||||
border-radius: 5px !important;
|
||||
padding: 23px 12px !important;
|
||||
margin-bottom: 32px !important;
|
||||
font-weight: normal !important;
|
||||
line-height: 145% !important;
|
||||
letter-spacing: -0.2px !important;
|
||||
color: #000000 !important;
|
||||
}
|
||||
|
||||
.nsem-form-input::placeholder{
|
||||
font-family: 'Open Sans', sans-serif !important;
|
||||
font-style: normal !important;
|
||||
font-weight: normal !important;
|
||||
font-size: 16px !important;
|
||||
line-height: 145% !important;
|
||||
letter-spacing: -0.2px !important;
|
||||
color: #000000 !important;
|
||||
opacity: 0.5 !important;
|
||||
}
|
||||
|
||||
.nsem-form-input:focus{
|
||||
border-color: #6063EA !important;
|
||||
box-shadow: 0 0 !important;
|
||||
color: #000000 !important;
|
||||
}
|
||||
|
||||
.nsem-body-small-container{
|
||||
margin: 20px 0 21px !important;
|
||||
}
|
||||
|
||||
.nsem-body-small{
|
||||
font-family: 'Open Sans', sans-serif !important;
|
||||
font-style: normal !important;
|
||||
font-weight: normal !important;
|
||||
font-size: 16px !important;
|
||||
line-height: 145% !important;
|
||||
letter-spacing: -0.2px !important;
|
||||
color: #000000 !important;
|
||||
opacity: 0.5 !important;
|
||||
}
|
||||
|
||||
.nsem-btn-2{
|
||||
width: 100% !important;
|
||||
padding: 13px 0 !important;
|
||||
border-radius: 4px !important;
|
||||
border-width: 0 !important;
|
||||
font-family: 'Open Sans', sans-serif !important;
|
||||
font-style: normal !important;
|
||||
font-weight: 800 !important;
|
||||
font-size: 18px !important;
|
||||
line-height: 134.77% !important;
|
||||
text-align: center !important;
|
||||
text-transform: unset !important;
|
||||
letter-spacing: unset !important;
|
||||
background-color: #6063EA !important;
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
.nsem-btn-2:focus{
|
||||
outline: none !important;
|
||||
background-color: #ECECFF !important;
|
||||
}
|
||||
|
||||
.nssm-modal-content {
|
||||
padding: 32px !important;
|
||||
background-color: #241342 !important;
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
.nssm-modal-header {
|
||||
border: none !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.nssm-close{
|
||||
margin: -27px -15px 0 0 !important;
|
||||
font-size: 38px !important;
|
||||
opacity: 1 !important;
|
||||
font-weight: 300 !important;
|
||||
color: #FFFFFF !important;
|
||||
text-shadow: 0 0 !important;
|
||||
}
|
||||
|
||||
.nssm-close:hover{
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
.nssm-body{
|
||||
padding: 126px 0 !important;
|
||||
}
|
||||
|
||||
.nssm-small{
|
||||
font-family: 'Open Sans', sans-serif !important;
|
||||
font-style: normal !important;
|
||||
font-weight: 600 !important;
|
||||
font-size: 16px !important;
|
||||
line-height: 120% !important;
|
||||
letter-spacing: 0.1em !important;
|
||||
text-transform: uppercase !important;
|
||||
}
|
||||
|
||||
.nssm-title{
|
||||
margin: 12px 0 40px !important;
|
||||
font-family: 'Open Sans', sans-serif !important;
|
||||
font-style: normal !important;
|
||||
font-weight: 600 !important;
|
||||
font-size: 32px !important;
|
||||
line-height: 115.4% !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.nssm-text{
|
||||
font-family: 'Open Sans', sans-serif !important;
|
||||
font-style: normal !important;
|
||||
font-weight: normal !important;
|
||||
font-size: 20px !important;
|
||||
line-height: 145% !important;
|
||||
letter-spacing: -0.2px !important;
|
||||
}
|
||||
|
||||
.nssm-custom-link{
|
||||
color: #FFFFFF !important;
|
||||
text-decoration: underline !important;
|
||||
}
|
||||
|
||||
.nssm-custom-link:hover{
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
form.signup-form .nsem-form-input.has-error {
|
||||
border-color: #000 !important;
|
||||
margin-bottom: 0 !important;
|
||||
-webkit-transition: none !important;
|
||||
-moz-transition: none !important;
|
||||
-o-transition: none !important;
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
.email-error, .name-error {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.store-block .title {
|
||||
margin-bottom: 16px;
|
||||
font-family: "Open Sans", -apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
||||
font-size: 24px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.store-block .download-btn-wrapper {
|
||||
max-width: 250px;
|
||||
}
|
||||
|
||||
#related-posts .col {
|
||||
flex: auto;
|
||||
max-width: unset;
|
||||
}
|
||||
|
||||
.subscribe-form-wrapper {
|
||||
padding: 30px 28px;
|
||||
}
|
||||
|
||||
.subscribe-form-wrapper.bgc-gray {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.subscribe-form-wrapper form {
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
}
|
||||
|
||||
.form-msg-block p {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.textwidget h1 {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.textwidget p {
|
||||
margin-bottom: -20px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
@media (max-width: 425px) {
|
||||
#signupModal .nsem-modal-content {
|
||||
min-height: 850px;
|
||||
overflow: auto;
|
||||
}
|
||||
#signupModal .modal-body {
|
||||
overflow: hidden;
|
||||
}
|
||||
#successSignupModal {
|
||||
overflow: auto;
|
||||
}
|
||||
#successSignupModal .nssm-modal-content {
|
||||
min-height: 850px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (min-width: 426px){
|
||||
.nsem-modal-content {
|
||||
padding: 72px !important;
|
||||
}
|
||||
.nsem-dialog, .nssm-dialog {
|
||||
margin: 38px auto !important;
|
||||
}
|
||||
.nsem-modal-content, .nssm-modal-content {
|
||||
height: auto !important;
|
||||
border: 1px solid rgba(0,0,0,.2) !important;
|
||||
border-radius: .3rem !important;
|
||||
min-height: unset !important;
|
||||
}
|
||||
.modal{
|
||||
overflow-y: auto !important;
|
||||
}
|
||||
.nssm-body{
|
||||
padding: 126px 41px 144px !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Edit elementor style */
|
||||
.elementor-section.elementor-section-boxed > .elementor-container {
|
||||
max-width: unset !important;
|
||||
}
|
||||
.elementor-column-gap-default>.elementor-row>.elementor-column>.elementor-element-populated {
|
||||
padding: 10px 0 !important;
|
||||
}
|
||||
/* End edit elementor style */
|
||||
|
||||
/* Edit search form sidebar */
|
||||
#right-sidebar .searchform label {
|
||||
width: 100%;
|
||||
}
|
||||
/* End edit search form sidebar */
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<div class="modal fade float-custom-modal" id="signupModal" tabindex="-1" role="dialog" aria-labelledby="signupModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog nsem-dialog" role="document">
|
||||
<div class="modal-content nsem-modal-content">
|
||||
<div class="modal-header nsem-modal-header">
|
||||
<div class="nsem-header">
|
||||
<small class="nsem-header-small">FOR FREE</small>
|
||||
<h5 class="nsem-title">Sign up for Float today</h5>
|
||||
<p class="nsem-subtitle">See where you can save, get exclusive tips & offers, and live a better life. <br> It's the Float way to go.</p>
|
||||
</div>
|
||||
<button type="button" class="close nsem-close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body nsem-modal-body">
|
||||
<button class="nsem-btn-1 d-flex justify-content-center aligns-item-center sign-up-google-btn">
|
||||
<img src="https://www.float.sg/assets/img/google-icon.png" alt="" width="24px">
|
||||
<p>Sign Up with Google</p>
|
||||
</button>
|
||||
<div class="text-center nsem-body-small-container">
|
||||
<small class="nsem-body-small">or</small>
|
||||
</div>
|
||||
<form class="signup-form validate" data-action="" method="POST">
|
||||
<?php wp_nonce_field('float_signup_user','float_signup_user_nonce', true, true ); ?>
|
||||
<div class="form-group">
|
||||
<input type="text" name="name" class="form-control nsem-form-input" placeholder="Name">
|
||||
<small class="name-error text-danger form-text"></small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="email" name="email" class="form-control nsem-form-input requried email" id="modal-email" placeholder="Email">
|
||||
<small class="email-error text-danger form-text"></small>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="nsem-btn-2">Sign Up</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<div class="modal fade" id="successSignupModal" tabindex="-1" role="dialog" aria-labelledby="successSignupModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog nssm-dialog" role="document">
|
||||
<div class="modal-content nssm-modal-content">
|
||||
<div class="modal-header nssm-modal-header">
|
||||
<a href="/"><img src="https://www.float.sg/assets/img/float-travel-app-logo.png" alt="" width="118px"></a>
|
||||
<button type="button" class="close nssm-close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body nssm-body">
|
||||
<small class="nssm-small">Thanks for signing up!</small>
|
||||
<h5 class="nssm-title">Now you are ready to start your journey with Float. Download the app to get started, and start earning Float Points today.</h5>
|
||||
<p class="nssm-text">We sent you an email to help get you started with simple next steps. If you didn’t receive the email or have problems setting up your account, please <a href="#" class="nssm-custom-link">contact us.</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
|
||||
namespace WPC\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use WP_Query;
|
||||
|
||||
if (!defined('ABSPATH')) exit; // Exit if accessed directly
|
||||
|
||||
|
||||
class CustomPostGrid extends Widget_Base {
|
||||
|
||||
public function get_name(){
|
||||
return 'custom-post-grid';
|
||||
}
|
||||
|
||||
public function get_title(){
|
||||
return 'Custom Post Grid';
|
||||
}
|
||||
|
||||
public function get_icon(){
|
||||
return 'fa fa-th';
|
||||
}
|
||||
|
||||
public function get_categories(){
|
||||
return ['basic'];
|
||||
}
|
||||
|
||||
protected function _register_controls(){
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_content',
|
||||
[
|
||||
'label' => 'Settings',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
}
|
||||
|
||||
|
||||
protected function render(){
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
$location = get_user_location();
|
||||
$current_country = $location['country_code'];
|
||||
|
||||
// default settings
|
||||
$post_filter = 'recent';
|
||||
$posts_per_page = 6;
|
||||
$page = 1;
|
||||
|
||||
if (!empty($_GET['post_filter'])) {
|
||||
$post_filter = $_GET['post_filter'];
|
||||
}
|
||||
|
||||
if (!empty($_GET['page_no'])) {
|
||||
$page = $_GET['page_no'];
|
||||
}
|
||||
|
||||
$args = [
|
||||
'posts_per_page' => $posts_per_page,
|
||||
'post_type' => 'post',
|
||||
'post_status' => array('publish'),
|
||||
'paged' => $page,
|
||||
];
|
||||
|
||||
if ($post_filter == 'recent') {
|
||||
$args = array_merge($args, [
|
||||
'ignore_sticky_posts' => 1,
|
||||
'orderby' => 'post_date',
|
||||
'order' => 'DESC',
|
||||
]);
|
||||
} else if ($post_filter == 'newest') {
|
||||
$args = array_merge($args, [
|
||||
'ignore_sticky_posts' => 0,
|
||||
'orderby' => 'post_date',
|
||||
'order' => 'DESC',
|
||||
]);
|
||||
} else if ($post_filter == 'trending') {
|
||||
$args = array_merge($args, [
|
||||
'ignore_sticky_posts' => 1,
|
||||
'orderby' => 'ID',
|
||||
'order' => 'DESC',
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => 'is_trending',
|
||||
'value' => '1',
|
||||
'compare' => '=='
|
||||
)
|
||||
)
|
||||
]);
|
||||
} else if ($post_filter == 'hottest_stories') {
|
||||
$args = array_merge($args, [
|
||||
'ignore_sticky_posts' => 1,
|
||||
'meta_key' => 'float_post_views_count',
|
||||
'orderby' => 'meta_value_num',
|
||||
'order' => 'DESC'
|
||||
]);
|
||||
} else if ($post_filter == 'oldest') {
|
||||
$args = array_merge($args, [
|
||||
'ignore_sticky_posts' => 1,
|
||||
'order' => 'ASC'
|
||||
]);
|
||||
}
|
||||
|
||||
// Insert query by country
|
||||
if (isset($args['meta_query'])) {
|
||||
$metaQuery = $args['meta_query'];
|
||||
$metaQuery = array_merge($metaQuery, [
|
||||
'relation' => 'AND',
|
||||
array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'location',
|
||||
'value' => $current_country,
|
||||
'compare' => 'LIKE',
|
||||
),
|
||||
array(
|
||||
'key'=> 'location',
|
||||
'compare' => 'NOT EXISTS'
|
||||
),
|
||||
array(
|
||||
'key'=> 'location',
|
||||
'value' => '',
|
||||
'compare' => '='
|
||||
)
|
||||
)
|
||||
]);
|
||||
$args['meta_query'] = $metaQuery;
|
||||
} else {
|
||||
$args = array_merge($args, [
|
||||
'meta_query' => array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'location',
|
||||
'value' => $current_country,
|
||||
'compare' => 'LIKE',
|
||||
),
|
||||
array(
|
||||
'key'=> 'location',
|
||||
'compare' => 'NOT EXISTS'
|
||||
),
|
||||
array(
|
||||
'key'=> 'location',
|
||||
'value' => '',
|
||||
'compare' => '='
|
||||
)
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
$count_query_args = $args;
|
||||
$count_query_args['posts_per_page'] = -1;
|
||||
$post_query = new WP_Query( $args );
|
||||
$count_query = new WP_Query($count_query_args);
|
||||
$posts = $post_query->posts;
|
||||
$count = $count_query->post_count;
|
||||
if ($count === 0 || $count < $posts_per_page) {
|
||||
$total_page = 0;
|
||||
} else {
|
||||
$total_page = intval($count) / intval($posts_per_page);
|
||||
$total_page = $total_page / intval($total_page) > 0 ? intval($total_page) + 1 : intval($total_page);
|
||||
}
|
||||
|
||||
$filterMap = [
|
||||
'recent' => 'Recent',
|
||||
'trending' => 'Trending',
|
||||
'hottest_stories' => 'Hottest Stories',
|
||||
'newest' => 'Newest',
|
||||
'oldest' => 'Oldest'
|
||||
];
|
||||
|
||||
// Filter block
|
||||
$html =
|
||||
'<div class="filter-wrapper">
|
||||
<h2>' . $filterMap[$post_filter] . '</h2>
|
||||
<div class="dropdown">
|
||||
<button onclick="customDropdown()" class="dropbtn"><i id="icon" class="filter-icon fas fa-sliders-h"></i></button>
|
||||
<div id="myDropdown" class="dropdown-content">
|
||||
<a href="/?post_filter=recent">Recent</a>
|
||||
<a href="/?post_filter=trending">Trending</a>
|
||||
<a href="/?post_filter=hottest_stories">Hottest Stories</a>
|
||||
<a href="/?post_filter=newest">Newest</a>
|
||||
<a href="/?post_filter=oldest">Oldest</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
// End filter block
|
||||
|
||||
// Post grid block
|
||||
$html .= '<div class="custom-post-grid-block">';
|
||||
|
||||
foreach ($posts as $post) {
|
||||
// Get co-authors
|
||||
$authors = [];
|
||||
|
||||
$co_authors = get_coauthors($post->ID);
|
||||
|
||||
foreach($co_authors as $co_author) {
|
||||
if(get_class($co_author) !== 'WP_User') {
|
||||
array_push($authors, $co_author->display_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
array_push($authors, $co_author->data->display_name);
|
||||
}
|
||||
|
||||
if (empty($authors)) {
|
||||
$post_author = get_the_author_meta( 'display_name' , get_post_field('post_author') );
|
||||
array_push($authors, $post_author);
|
||||
}
|
||||
|
||||
$authors = join(', ', $authors);
|
||||
|
||||
$post_content = strip_tags( $post->post_content );
|
||||
$post_content = strip_shortcodes( $post_content );
|
||||
$post_content = str_replace( array("\n", "\r", "\t"), ' ', $post_content );
|
||||
$post_content = trim( $post_content );
|
||||
$post_content = mb_substr( $post_content, 0, 300, 'utf8' );
|
||||
|
||||
$comment_count = '';
|
||||
|
||||
if ($post->comment_count) {
|
||||
$comment_count = '<i class="icon-bubble" aria-hidden="true"></i>' . $post->comment_count;
|
||||
}
|
||||
|
||||
$html .=
|
||||
'<div class="post-wrapper">
|
||||
<div>
|
||||
<a href="' . get_permalink($post->ID) . '">
|
||||
<div class="thumbnail" style="background-image: url(' . get_the_post_thumbnail_url($post->ID) . ');"></div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="content-wrapper">
|
||||
<h2 class="title">
|
||||
<a class="text-truncate-2-line" href="' . get_permalink($post->ID) . '" title="'. $post->post_title .'">
|
||||
' . $post->post_title . '
|
||||
</a>
|
||||
</h2>
|
||||
<div class="meta text-truncate-1-line" title="' . $authors . ' - ' . get_the_date( 'F j, Y', $post->ID ) . '">
|
||||
' . $authors . ' - ' . get_the_date( 'F j, Y', $post->ID ) . ' ' . $comment_count .'
|
||||
</div>
|
||||
<p class="post-content text-truncate-2-line">' . $post_content . '</p>
|
||||
<a class="read-more" href="' . get_permalink($post->ID) .'">Read More ></a>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
$html .= '</div>';
|
||||
// End post grid block
|
||||
|
||||
// Pagination block
|
||||
$html .= '<div class="custom-pagination">';
|
||||
$html .= '<ul>';
|
||||
|
||||
for ($i = 1; $i <= $total_page; $i++) {
|
||||
$html .= '<a href="/?post_filter=' . $post_filter . '&page_no=' . $i . '" class="' . ($i === intval($page) ? 'is-active' : '') . '" data-page="'. $i . '"><li>' . $i . '</li></a>';
|
||||
}
|
||||
|
||||
$html .= '</ul>';
|
||||
$html .= '</div>';
|
||||
// End pagination block
|
||||
|
||||
echo $html;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,329 @@
|
||||
<?php
|
||||
namespace WPC\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use WP_Query;
|
||||
|
||||
if (!defined('ABSPATH')) exit; // Exit if accessed directly
|
||||
|
||||
|
||||
class FeatureArticle extends Widget_Base
|
||||
{
|
||||
|
||||
public function get_name()
|
||||
{
|
||||
return 'feature-article';
|
||||
}
|
||||
|
||||
public function get_title()
|
||||
{
|
||||
return 'Feature Article';
|
||||
}
|
||||
|
||||
public function get_icon()
|
||||
{
|
||||
return 'fas fa-image';
|
||||
}
|
||||
|
||||
public function get_categories()
|
||||
{
|
||||
return ['basic'];
|
||||
}
|
||||
|
||||
protected function _register_controls()
|
||||
{
|
||||
|
||||
$this->start_controls_section('section_content', ['label' => 'Settings', ]);
|
||||
|
||||
$this->add_control(
|
||||
'feature_article',
|
||||
[
|
||||
'label' => __( 'Feature article', 'plugin-name' ),
|
||||
'type' => \Elementor\Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'manual' => __( 'Manual', 'plugin-name' ),
|
||||
'auto' => __( 'Auto', 'plugin-name' ),
|
||||
],
|
||||
'default' => 'manual',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_select',
|
||||
[
|
||||
'label' => __( 'Post select', 'plugin-name' ),
|
||||
'type' => \Elementor\Controls_Manager::SELECT,
|
||||
'options' => $this->getPublishedPosts(),
|
||||
'placeholder' => 'Select post',
|
||||
'condition' => [
|
||||
'feature_article' => 'manual'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'swap_day',
|
||||
[
|
||||
'label' => __( 'Swap day', 'plugin-name' ),
|
||||
'type' => \Elementor\Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'0' => 'Sunday',
|
||||
'1' => 'Monday',
|
||||
'2' => 'Tuesday',
|
||||
'3' => 'Wednesday',
|
||||
'4' => 'Thursday',
|
||||
'5' => 'Friday',
|
||||
'6' => 'Saturday'
|
||||
],
|
||||
'default' => '1',
|
||||
'condition' => [
|
||||
'feature_article' => 'auto'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
$this->start_controls_section(
|
||||
'style_section',
|
||||
[
|
||||
'label' => __( 'Style', 'plugin-name' ),
|
||||
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_color',
|
||||
[
|
||||
'label' => __( 'Title Color', 'plugin-domain' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'scheme' => [
|
||||
'type' => \Elementor\Scheme_Color::get_type(),
|
||||
'value' => \Elementor\Scheme_Color::COLOR_1,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .title' => 'color: {{VALUE}}',
|
||||
],
|
||||
'default' => '#FFFFFF'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'divider_color',
|
||||
[
|
||||
'label' => __( 'Divider Color', 'plugin-domain' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'scheme' => [
|
||||
'type' => \Elementor\Scheme_Color::get_type(),
|
||||
'value' => \Elementor\Scheme_Color::COLOR_1,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .divider' => 'border-top: 2px solid {{VALUE}}',
|
||||
],
|
||||
'default' => '#FFFFFF'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'article_meta_color',
|
||||
[
|
||||
'label' => __( 'Meta Color', 'plugin-domain' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'scheme' => [
|
||||
'type' => \Elementor\Scheme_Color::get_type(),
|
||||
'value' => \Elementor\Scheme_Color::COLOR_1,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .article-meta' => 'color: {{VALUE}}',
|
||||
],
|
||||
'default' => '#FFFFFF'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'read_more_color',
|
||||
[
|
||||
'label' => __( 'Read More Color', 'plugin-domain' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'scheme' => [
|
||||
'type' => \Elementor\Scheme_Color::get_type(),
|
||||
'value' => \Elementor\Scheme_Color::COLOR_1,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .read-more' => 'color: {{VALUE}}; border: 1px solid {{VALUE}};',
|
||||
],
|
||||
'default' => '#FFFFFF'
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
}
|
||||
|
||||
protected function render()
|
||||
{
|
||||
global $wpdb;
|
||||
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
$post_id = null;
|
||||
|
||||
if ($settings['feature_article'] === 'auto') {
|
||||
$article_setting = $wpdb->get_results(
|
||||
'
|
||||
SELECT *
|
||||
FROM wp_feature_article
|
||||
LIMIT 1
|
||||
'
|
||||
)[0];
|
||||
|
||||
if (empty($article_setting)) {
|
||||
$wpdb->insert(
|
||||
'wp_feature_article',
|
||||
[
|
||||
'post_id' => $this->getRandomPostID(),
|
||||
'swap_day' => $settings['swap_day'],
|
||||
'last_swap' => date('Y-m-d H:i:s')
|
||||
]
|
||||
);
|
||||
} else {
|
||||
if ($settings['swap_day'] === $article_setting->swap_day
|
||||
&& date('Y-m-d') > date('Y-m-d', strtotime($article_setting->last_swap))
|
||||
&& date('w') === $article_setting->swap_day) {
|
||||
$wpdb->update(
|
||||
'wp_feature_article',
|
||||
[
|
||||
'post_id' => $this->getRandomPostID(),
|
||||
'swap_day' => $settings['swap_day'],
|
||||
'last_swap' => date('Y-m-d H:i:s')
|
||||
],
|
||||
[
|
||||
'swap_day' => $settings['swap_day']
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ($settings['swap_day'] !== $article_setting->swap_day) {
|
||||
$wpdb->update(
|
||||
'wp_feature_article',
|
||||
[
|
||||
'post_id' => $this->getRandomPostID(),
|
||||
'swap_day' => $settings['swap_day'],
|
||||
'last_swap' => date('Y-m-d H:i:s')
|
||||
],
|
||||
[
|
||||
'swap_day' => $article_setting->swap_day,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$article_setting = $wpdb->get_results(
|
||||
'
|
||||
SELECT *
|
||||
FROM wp_feature_article
|
||||
LIMIT 1
|
||||
'
|
||||
)[0];
|
||||
|
||||
$post_id = $article_setting->post_id;
|
||||
|
||||
} else {
|
||||
$post_id = $settings['post_select'];
|
||||
}
|
||||
|
||||
$query = new WP_Query(['p' => $post_id]);
|
||||
$post = $query->posts[0];
|
||||
|
||||
$html =
|
||||
|
||||
'<div class="feature-article-block text-center" style="background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url(' . get_the_post_thumbnail_url($post->ID) . ');">
|
||||
<div class="content-wrapper">';
|
||||
|
||||
// Get categories
|
||||
$categories = get_the_category($post->ID);
|
||||
$categories_template_arr = [];
|
||||
|
||||
if (!empty($categories)) {
|
||||
$html .= '<div class="category-wrapper d-none d-md-block text-uppercase">';
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$category = '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '">' . esc_html( $category->name ) . '</a>';
|
||||
array_push($categories_template_arr, $category);
|
||||
}
|
||||
|
||||
$html .= join(' / ', $categories_template_arr);
|
||||
$html .= '</div>';
|
||||
}
|
||||
|
||||
// Get co-authors
|
||||
$authors = [];
|
||||
$co_authors = get_coauthors($post->ID);
|
||||
|
||||
foreach($co_authors as $co_author) {
|
||||
if(get_class($co_author) !== 'WP_User') {
|
||||
array_push($authors, $co_author->display_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
array_push($authors, $co_author->data->display_name);
|
||||
}
|
||||
|
||||
if (empty($authors)) {
|
||||
$post_author = get_the_author_meta( 'display_name' , get_post_field('post_author') );
|
||||
array_push($authors, $post_author);
|
||||
}
|
||||
|
||||
$authors = join(', ', $authors);
|
||||
|
||||
$html .=
|
||||
'<div class="divider"></div>
|
||||
<a href="' . get_permalink($post->ID) . '"><h2 class="title text-truncate-2-line" title="' . $post->post_title . '">' . $post->post_title . '</h2></a>
|
||||
<div class="divider"></div>
|
||||
<p class="article-meta text-uppercase text-truncate" title="' . $authors . '">' . get_the_date( 'F j, Y', $post->ID ) . ' by ' . $authors . '</p>
|
||||
<a class="read-more text-uppercase" href="' . get_permalink($post->ID) . '">Read more</a>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
echo $html;
|
||||
}
|
||||
|
||||
protected function getPublishedPosts() {
|
||||
$result = [];
|
||||
|
||||
$args = [
|
||||
'post_type' => 'post',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 1000,
|
||||
'ignore_sticky_posts' => 1,
|
||||
'orderby' => 'post_date',
|
||||
'order' => 'DESC',
|
||||
];
|
||||
|
||||
$post_query = new WP_Query( $args );
|
||||
|
||||
$posts = $post_query->posts;
|
||||
|
||||
foreach ($posts as $post) {
|
||||
$result += [$post->ID => $post->post_title];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function getRandomPostID() {
|
||||
$args = array(
|
||||
'post_type' => 'post',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 1,
|
||||
'orderby' => 'rand'
|
||||
);
|
||||
|
||||
$query = new WP_Query ( $args );
|
||||
$random_post = $query->posts[0];
|
||||
|
||||
return $random_post->ID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
class Float_Widget_Recent_Post extends WP_Widget {
|
||||
public function __construct() {
|
||||
$widget_ops = array(
|
||||
'classname' => 'float_widget_recent_entries',
|
||||
'description' => __( 'Your site’s most recent Posts.' ),
|
||||
'customize_selective_refresh' => true,
|
||||
);
|
||||
parent::__construct( 'float-recent-posts', __( 'Float Recent Posts' ), $widget_ops );
|
||||
$this->alt_option_name = 'float_widget_recent_entries';
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
if ( ! isset( $args['widget_id'] ) ) {
|
||||
$args['widget_id'] = $this->id;
|
||||
}
|
||||
|
||||
$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' );
|
||||
|
||||
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
|
||||
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
||||
|
||||
$number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
|
||||
if ( ! $number ) {
|
||||
$number = 5;
|
||||
}
|
||||
|
||||
$r = new WP_Query(
|
||||
apply_filters(
|
||||
'widget_posts_args',
|
||||
array(
|
||||
'posts_per_page' => $number,
|
||||
'no_found_rows' => true,
|
||||
'post_status' => 'publish',
|
||||
'ignore_sticky_posts' => true,
|
||||
),
|
||||
$instance
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! $r->have_posts() ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<?php echo $args['before_widget']; ?>
|
||||
<?php
|
||||
if ( $title ) {
|
||||
echo $args['before_title'] . $title . $args['after_title'];
|
||||
}
|
||||
?>
|
||||
<ul class="oceanwp-recent-posts clr">
|
||||
<?php foreach ( $r->posts as $recent_post ) : ?>
|
||||
<?php
|
||||
$post_title = get_the_title( $recent_post->ID );
|
||||
$title = ( ! empty( $post_title ) ) ? $post_title : __( '(no title)' );
|
||||
?>
|
||||
<li class="clr">
|
||||
<?php if (has_post_thumbnail( $recent_post->ID )) : ?>
|
||||
<a href="<?php the_permalink( $recent_post->ID ); ?>" title="<?php echo $post_title; ?>" class="recent-posts-thumbnail">
|
||||
<img width="150" height="150" src="<?php echo get_the_post_thumbnail_url( $recent_post->ID, 'thumbnail' ); ?>" class="attachment-thumbnail size-thumbnail wp-post-image" alt="<?php echo $post_title; ?>" loading="lazy" itemprop="image">
|
||||
<span class="overlay"></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<div class="recent-posts-details clr">
|
||||
<div class="recent-posts-details-inner clr">
|
||||
<a href="<?php the_permalink( $recent_post->ID ); ?>" title="<?php echo $post_title; ?>" class="recent-posts-title"><?php echo $post_title; ?></a>
|
||||
<div class="recent-posts-info clr">
|
||||
<div class="recent-posts-date"><?php echo get_the_date( 'F j, Y', $recent_post->ID ) ?><span class="sep">/</span></div>
|
||||
<div class="recent-posts-comments"><a href="<?php echo get_comments_link( $recent_post->ID ); ?>"><?php echo get_comments_number( $recent_post->ID ) ?> Comments</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php
|
||||
echo $args['after_widget'];
|
||||
}
|
||||
|
||||
public function update( $new_instance, $old_instance ) {
|
||||
$instance = $old_instance;
|
||||
$instance['title'] = sanitize_text_field( $new_instance['title'] );
|
||||
$instance['number'] = (int) $new_instance['number'];
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public function form( $instance ) {
|
||||
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
||||
$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
|
||||
?>
|
||||
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" placeholder="Recent Posts" /></p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:' ); ?></label>
|
||||
<input class="tiny-text" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="number" step="1" min="1" value="<?php echo $number; ?>" size="3" /></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
// Register the widget
|
||||
function float_widget_recent_post_function() {
|
||||
register_widget( 'Float_Widget_Recent_Post' );
|
||||
}
|
||||
add_action( 'widgets_init', 'float_widget_recent_post_function' );
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace WPC\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
|
||||
if (!defined('ABSPATH')) exit; // Exit if accessed directly
|
||||
|
||||
|
||||
class StoreBlock extends Widget_Base {
|
||||
|
||||
public function get_name(){
|
||||
return 'store-block';
|
||||
}
|
||||
|
||||
public function get_title(){
|
||||
return 'Store Block';
|
||||
}
|
||||
|
||||
public function get_icon(){
|
||||
return 'fab fa-app-store';
|
||||
}
|
||||
|
||||
public function get_categories(){
|
||||
return ['basic'];
|
||||
}
|
||||
|
||||
protected function _register_controls(){
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_content',
|
||||
[
|
||||
'label' => 'Settings',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
}
|
||||
|
||||
|
||||
protected function render(){
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
// Store block
|
||||
$html =
|
||||
'<div class="store-block">
|
||||
<p class="title text-center"><strong>Download</strong> the Float app now.</p>
|
||||
<div class="download-btn-wrapper d-flex flex-wrap justify-content-around mx-auto">
|
||||
<a class="mx-2 mb-2" href="https://smart.link/afcjz898yquo8" target="_blank">
|
||||
<img src="https://blog.float.sg/wp-content/themes/float/images/google.svg" alt="google-img">
|
||||
</a>
|
||||
<a class="mx-2 mb-2" href="https://smart.link/afcjz898yquo8" target="_blank">
|
||||
<img src="https://blog.float.sg/wp-content/themes/float/images/apple.svg" alt="apple-img">
|
||||
</a>
|
||||
</div>
|
||||
</div>';
|
||||
// End store block
|
||||
|
||||
echo $html;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user