Commit 7ea1db8a by Arun Raj

Adding wp-featured-slider plugin

parent f6b429bb
.featured-content-slider{visibility: hidden; opacity:0; transition:opacity 0.5s linear; }.slick-initialized { visibility: visible; opacity:1; } .featured-content-slider .slick-arrow{text-indent:-99999px; padding:0px !important; margin:0px !important; border-radius:0px !important}.featured-content-slider button.slick-arrow {background-color: transparent!important; width:15px; height:26px; position:absolute; z-index:999;border:0px !important;padding:0 !important; margin:0px !important; border-radius:0px !important}.featured-content-slider button.slick-next, .featured-content-slider button.slick-next:hover, .featured-content-slider button.slick-next:focus{background:url(arrow-right.png) 0 0 no-repeat !important; background-size:15px 26px !important;}.featured-content-slider button.slick-prev, .featured-content-slider button.slick-prev:hover, .featured-content-slider button.slick-prev:focus{background:url(arrow-left.png) 0 0 no-repeat !important;background-size:15px 26px !important;}.featured-content-slider.design-4 button.slick-next, .featured-content-slider.design-4 button.slick-next:hover, .featured-content-slider.design-4 button.slick-next:focus{background:url(arrow-right-white.png) 0 0 no-repeat !important; background-size:15px 26px !important;}.featured-content-slider.design-4 button.slick-prev, .featured-content-slider.design-4 button.slick-prev:hover, .featured-content-slider.design-4 button.slick-prev:focus{background:url(arrow-left-white.png) 0 0 no-repeat !important;background-size:15px 26px !important;} .featured-content-slider .slick-dots{padding:0 !important; margin:0 !important; position:absolute; bottom:10px; text-align:center;}.featured-content-slider .slick-dots li button{text-indent:-99999px;}.featured-content-slider .slick-dots li {list-style:none !important; display:inline-block !important; margin:0 2px !important; padding:0px !important; width:10px !important; height:10px !important; }.featured-content-slider .slick-dots li button{background:#fff !important; margin:0px !important; padding:0px !important; border:1px solid #000; border-radius:50% !important; width:10px !important; height:10px !important;}.featured-content-slider .slick-dots li button:focus{outline:none !important}.featured-content-slider .slick-dots li.slick-active button{background:#444 !important;} /* Slider */.slick-loading .slick-list{ background: #fff url('ajax-loader.gif') center center no-repeat;}.slick-slider{ position: relative;display: block; -moz-box-sizing: border-box;box-sizing: border-box; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-touch-callout: none;-khtml-user-select: none; -ms-touch-action: pan-y; touch-action: pan-y; -webkit-tap-highlight-color: transparent;}.slick-list{ position: relative;display: block; overflow: hidden; margin: 0; padding: 0;}.slick-list:focus{ outline: none;}.slick-list.dragging{ cursor: pointer; cursor: hand;}.slick-slider .slick-track,.slick-slider .slick-list{ -webkit-transform: translate3d(0, 0, 0); -moz-transform: translate3d(0, 0, 0); -ms-transform: translate3d(0, 0, 0); -o-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0);}.slick-track{ position: relative;top: 0;left: 0; display: block;}.slick-track:before,.slick-track:after{ display: table; content: '';}.slick-track:after{ clear: both;}.slick-loading .slick-track{ visibility: hidden;}.slick-slide{ display: none; float: left; height: 100%; min-height: 1px;}[dir='rtl'] .slick-slide{ float: right;}.slick-slide img{ display: block;}.slick-slide.slick-loading img{ display: none;}.slick-slide.dragging img{ pointer-events: none;}.slick-initialized .slick-slide{ display: block;}.slick-loading .slick-slide{ visibility: hidden;}.slick-vertical .slick-slide{ display: block; height: auto; border: 1px solid transparent;}.slick-arrow.slick-hidden { display: none;}
\ No newline at end of file
<?php
/**
* Admin Class
*
* Handles the admin functionality of plugin
*
* @package WP Featured Content and Slider
* @since 1.2.8
*/
if ( !defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Wpfcas_Admin {
function __construct() {
// Action to add admin menu
add_action( 'admin_menu', array($this, 'wpfcas_register_menu'), 12 );
// Admin Init Processes
add_action( 'admin_init', array($this, 'wpfcas_admin_init_process') );
}
/**
* Function to add menu
*
* @package WP Featured Content and Slider
* @since 1.2.8
*/
function wpfcas_register_menu() {
// Plugin features menu
add_submenu_page( 'edit.php?post_type='.WPFCAS_POST_TYPE, __('Upgrade to PRO - WP Featured Content and Slider', 'wp-featured-content-and-slider'), '<span style="color:#2ECC71">'.__('Upgrade to PRO', 'wp-featured-content-and-slider').'</span>', 'edit_posts', 'wpfcas-premium-page', array($this, 'wpfcas_premium_page') );
// Hire Us menu
add_submenu_page( 'edit.php?post_type='.WPFCAS_POST_TYPE, __('Hire Us', 'wp-featured-content-and-slider'), '<span style="color:#2ECC71">'.__('Hire Us', 'wp-featured-content-and-slider').'</span>', 'edit_posts', 'wpfcas-hireus', array($this, 'wpfcas_hireus_page') );
}
/**
* Getting Started Page Html
*
* @package WP Featured Content and Slider
* @since 1.2.8
*/
function wpfcas_premium_page() {
include_once( WPFCAS_DIR . '/includes/admin/settings/premium.php' );
}
/**
* Hire Us Page Html
*
* @package WP Featured Content and Slider
* @since 1.2.8
*/
function wpfcas_hireus_page() {
include_once( WPFCAS_DIR . '/includes/admin/settings/hire-us.php' );
}
/**
* Function to notification transient
*
* @package WP Featured Content and Slider
* @since 1.2.8
*/
function wpfcas_admin_init_process() {
// If plugin notice is dismissed
if( isset($_GET['message']) && $_GET['message'] == 'wpfcas-plugin-notice' ) {
set_transient( 'wpfcas_install_notice', true, 604800 );
}
}
}
$wpfcas_Admin = new Wpfcas_Admin();
\ No newline at end of file
<?php
/**
* Handles Featured Content Post Setting Metabox HTML
*
* @package WP Featured Content and Slider
* @since 1.0.0
*/
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
global $post;
// Getting saved values
$featured_icon = get_post_meta( $post->ID, 'wpfcas_slide_icon', true );
$read_more_link = get_post_meta( $post->ID, 'wpfcas_slide_link', true );
?>
<table class="form-table wpfcas-post-sett-table">
<tbody>
<tr valign="top">
<th>
<label for="wpfcas-icon"><?php _e('Featured Content Icon', 'wp-featured-content-and-slider'); ?></label>
</th>
<td>
<input type="text" value="<?php echo esc_attr($featured_icon); ?>" class="large-text wpfcas-icon" id="wpfcas-icon" name="wpfcas_slide_icon" /><br/>
<span class="description"><?php _e('For example : fa fa-bluetooth-b', 'wp-featured-content-and-slider'); ?></span><br/>
<span class="description"><?php _e('Get icon class details : <a href="https://fontawesome.com/v4.7.0/icons/" target="_blank"> Font Awesome</a>', 'wp-featured-content-and-slider'); ?></span>
</td>
</tr>
<tr valign="top">
<th>
<label for="wpfcas-more-link"><?php _e('Read More Link', 'wp-featured-content-and-slider'); ?></label>
</th>
<td>
<input type="url" value="<?php echo esc_attr($read_more_link); ?>" class="large-text wpfcas-more-link" id="wpfcas-more-link" name="wpfcas_slide_link" /><br/>
<span class="description"><?php _e('Enter read more link. You can add external link also. ie http://www.google.com', 'wp-featured-content-and-slider'); ?></span>
</td>
</tr>
</tbody>
</table><!-- end .wtwp-tstmnl-table -->
\ No newline at end of file
<?php
/**
* Plugin Premium Offer Page
*
* @package WP Blog and Widget
* @since 1.0.0
*/
if ( !defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<div class="wrap">
<h2><?php _e( 'Hire Us - Get unlimited expert WordPress Support and Development', 'wp-featured-content-and-slider' ); ?></h2><br />
<div class="support-data">
<h3 style="margin-bottom:5px;"><?php _e( 'Highlight of Hiring:', 'wp-featured-content-and-slider' ); ?></h3>
<ul>
<li>Hire once, get unlimited jobs done</li>
<li>Quick ticket support, quick solution</li>
<li>Any sort of WP work with no extra cost</li>
<li>Dedicated expert working only for you!</li>
</ul>
</div>
<style>
.support-data ul{list-style-type:disc ; margin:10px 0 15px 20px;}
.wprps-notice{padding: 10px; color: #3c763d; background-color: #dff0d8; border:1px solid #d6e9c6; margin: 0 0 20px 0;}
.wpos-plugin-pricing-table thead th h2{font-weight: 400; font-size: 1.5em; line-height:normal; margin:0px; color: #2ECC71;}
.wpos-plugin-pricing-table thead th h2 + p{font-size: 1.25em; line-height: 1.4; color: #999; margin:5px 0 5px 0;}
table.wpos-plugin-pricing-table{width:90%; text-align: left; border-spacing: 0; border-collapse: collapse; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}
.wpos-plugin-pricing-table th, .wpos-plugin-pricing-table td{font-size:14px; line-height:normal; color:#444; vertical-align:middle; padding:12px;}
.wpos-plugin-pricing-table colgroup:nth-child(1) { width: 31%; border: 1px solid #ccc; }
.wpos-plugin-pricing-table colgroup:nth-child(2) { width: 22%; border: 1px solid #ccc; }
.wpos-plugin-pricing-table colgroup:nth-child(3) { width: 25%; border: 10px solid #2ECC71; }
.wpos-plugin-pricing-table colgroup:nth-child(4) { width: 31%; border: 1px solid #ccc; }
/* Tablehead */
.wpos-plugin-pricing-table thead th {background-color: #fff; background:linear-gradient(to bottom, #ffffff 0%, #ffffff 100%); text-align: center; position: relative; border-bottom: 1px solid #ccc; padding: 1em 0 3em; font-weight:400; color:#999;}
.wpos-plugin-pricing-table thead th:nth-child(3) {padding:1em 0 3.5em 0;}
.wpos-plugin-pricing-table thead th p.promo {font-size: 14px; color: #fff; position: absolute; bottom:0; left: -17px; z-index: 1000; width: 100%; margin: 0; padding: .625em 17px .75em; background-color: #ca4a1f; box-shadow: 0 2px 4px rgba(0,0,0,.25); border-bottom: 1px solid #ca4a1f;}
.wpos-plugin-pricing-table thead th p.promo:before {content: ""; position: absolute; display: block; width: 0px; height: 0px; border-style: solid; border-width: 0 7px 7px 0; border-color: transparent #900 transparent transparent; bottom: -7px; left: 0;}
.wpos-plugin-pricing-table thead th p.promo:after {content: ""; position: absolute; display: block; width: 0px; height: 0px; border-style: solid; border-width: 7px 7px 0 0; border-color: #900 transparent transparent transparent; bottom: -7px; right: 0;}
/* Table Footer */
.wpos-plugin-pricing-table tfoot th, .wpos-plugin-pricing-table tfoot td{text-align: center; border-top: 1px solid #ccc;}
.wpos-plugin-pricing-table tfoot a{font-weight: 600; color: #fff; text-decoration: none; text-transform: uppercase; display: inline-block; padding: 1em 2em; background: #59c7fb; border-radius: .2em;}
</style>
<table class="wpos-plugin-pricing-table">
<colgroup></colgroup>
<colgroup></colgroup>
<colgroup></colgroup>
<colgroup></colgroup>
<thead>
<tr>
<th>
<h2>Hire us for 1 Hr</h2>
<p>$20 USD</p>
</th>
<th>
<h2>Hire us for 5 Hrs</h2>
<p>$99 USD</p>
</th>
<th>
<h2>Hire us for 30 Hrs</h2>
<p>$499 USD</p>
<p class="promo">Our most valuable package!</p>
</th>
<th>
<h2>Hire us for 70 Hrs</h2>
<p>$999 USD</p>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td><a href="https://www.wponlinesupport.com/checkout/?edd_action=add_to_cart&download_id=6044&edd_options[price_id]=6&ref=wposthemeplugin" target="_blank">Hire Us</a></td>
<td><a href="https://www.wponlinesupport.com/checkout/?edd_action=add_to_cart&download_id=6044&edd_options[price_id]=3&ref=wposthemeplugin" target="_blank">Hire Us</a></td>
<td><a href="https://www.wponlinesupport.com/checkout/?edd_action=add_to_cart&download_id=6044&edd_options[price_id]=4&ref=wposthemeplugin" target="_blank">Hire Us</a></td>
<td><a href="https://www.wponlinesupport.com/checkout/?edd_action=add_to_cart&download_id=6044&edd_options[price_id]=5&ref=wposthemeplugin" target="_blank">Hire Us</a></td>
</tr>
</tfoot>
</table>
</div>
\ No newline at end of file
<?php
/**
* Plugin Premium Offer Page
*
* @package WP Featured Content and Slider
* @since 1.2.8
*/
if ( !defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<div class="wrap">
<h2><?php _e( 'WP Featured Content and Slider - Features', 'wp-featured-content-and-slider' ); ?></h2><br />
<style>
.wprps-notice{padding: 10px; color: #3c763d; background-color: #dff0d8; border:1px solid #d6e9c6; margin: 0 0 20px 0;}
.wpos-plugin-pricing-table thead th h2{font-weight: 400; font-size: 2.4em; line-height:normal; margin:0px; color: #2ECC71;}
.wpos-plugin-pricing-table thead th h2 + p{font-size: 1.25em; line-height: 1.4; color: #999; margin:5px 0 5px 0;}
table.wpos-plugin-pricing-table{width:90%; text-align: left; border-spacing: 0; border-collapse: collapse; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}
.wpos-plugin-pricing-table th, .wpos-plugin-pricing-table td{font-size:14px; line-height:normal; color:#444; vertical-align:middle; padding:12px;}
.wpos-plugin-pricing-table colgroup:nth-child(1) { width: 31%; border: 0 none; }
.wpos-plugin-pricing-table colgroup:nth-child(2) { width: 22%; border: 1px solid #ccc; }
.wpos-plugin-pricing-table colgroup:nth-child(3) { width: 25%; border: 10px solid #2ECC71; }
/* Tablehead */
.wpos-plugin-pricing-table thead th {background-color: #fff; background:linear-gradient(to bottom, #ffffff 0%, #ffffff 100%); text-align: center; position: relative; border-bottom: 1px solid #ccc; padding: 1em 0 1em; font-weight:400; color:#999;}
.wpos-plugin-pricing-table thead th:nth-child(1) {background: transparent;}
.wpos-plugin-pricing-table thead th:nth-child(3) {padding:1em 2px 3.5em 2px; }
.wpos-plugin-pricing-table thead th:nth-child(3) p{color:#000;}
.wpos-plugin-pricing-table thead th p.promo {font-size: 14px; color: #fff; position: absolute; bottom:0; left: -17px; z-index: 1000; width: 100%; margin: 0; padding: .625em 17px .75em; background-color: #ca4a1f; box-shadow: 0 2px 4px rgba(0,0,0,.25); border-bottom: 1px solid #ca4a1f;}
.wpos-plugin-pricing-table thead th p.promo:before {content: ""; position: absolute; display: block; width: 0px; height: 0px; border-style: solid; border-width: 0 7px 7px 0; border-color: transparent #900 transparent transparent; bottom: -7px; left: 0;}
.wpos-plugin-pricing-table thead th p.promo:after {content: ""; position: absolute; display: block; width: 0px; height: 0px; border-style: solid; border-width: 7px 7px 0 0; border-color: #900 transparent transparent transparent; bottom: -7px; right: 0;}
/* Tablebody */
.wpos-plugin-pricing-table tbody th{background: #fff; border-left: 1px solid #ccc; font-weight: 600;}
.wpos-plugin-pricing-table tbody th span{font-weight: normal; font-size: 87.5%; color: #999; display: block;}
.wpos-plugin-pricing-table tbody td{background: #fff; text-align: center;}
.wpos-plugin-pricing-table tbody td .dashicons{height: auto; width: auto; font-size:30px;}
.wpos-plugin-pricing-table tbody td .dashicons-no-alt{color: #ca4a1f;}
.wpos-plugin-pricing-table tbody td .dashicons-yes{color: #2ECC71;}
.wpos-plugin-pricing-table tbody tr:nth-child(even) th,
.wpos-plugin-pricing-table tbody tr:nth-child(even) td { background: #f5f5f5; border: 1px solid #ccc; border-width: 1px 0 1px 1px; }
.wpos-plugin-pricing-table tbody tr:last-child td {border-bottom: 0 none;}
/* Table Footer */
.wpos-plugin-pricing-table tfoot th, .wpos-plugin-pricing-table tfoot td{text-align: center; border-top: 1px solid #ccc;}
.wpos-plugin-pricing-table tfoot a{font-weight: 600; color: #fff; text-decoration: none; text-transform: uppercase; display: inline-block; padding: 1em 2em; background: #ca4a1f; border-radius: .2em;}
.essential-plugin-bundle{clear:both; margin-bottom:15px;}
.essential-plugin-bundle img{max-width:100%;}
</style>
<div class="essential-plugin-bundle">
<a href="https://www.wponlinesupport.com/pricing/?ref=WposPratik&utm_source=WP&utm_medium=WP-Plugins&utm_campaign=Essential-Plugin-Banner" target="_blank"><img src="https://www.wponlinesupport.com/plugin-data-api/images/plugin-bundle-banner.png?time=<?php echo current_time('timestamp'); ?>" alt="essential-plugin-bundle" /></a>
</div>
<table class="wpos-plugin-pricing-table">
<colgroup></colgroup>
<colgroup></colgroup>
<colgroup></colgroup>
<thead>
<tr>
<th></th>
<th>
<h2>Free</h2>
<p>$0 USD</p>
</th>
<th>
<h2>Premium</h2>
<p>Gain access to <strong>WP Featured Content and Slider</strong> included in <br /><strong>Essential Plugin Bundle</p>
<p class="promo">Our most valuable package!</p>
</th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<td></td>
<td><p>Gain access to <strong>WP Featured Content and Slider</strong> included in <br /><strong>Essential Plugin Bundle</p>
<a href="https://www.wponlinesupport.com/pricing/?ref=WposPratik&utm_source=WP&utm_medium=WP-Plugins&utm_campaign=Upgrade-PRO" target="_blank">View Buying Options</a></td>
</tr>
</tfoot>
<tbody>
<tr>
<th>Designs <span>Designs that make your website better</span></th>
<td>4</td>
<td>20+</td>
</tr>
<tr>
<th>Shortcodes <span>Shortcode provide output to the front-end side</span></th>
<td>2 (Grid, Slider)</td>
<td>3 (Icon , Image , Icon and Image)</td>
</tr>
<tr>
<th>Shortcode Parameters <span>Add extra power to the shortcode</span></th>
<td>17</td>
<td>30+</td>
</tr>
<tr>
<th>Shortcode Generator <span>Play with all shortcode parameters with preview panel. No documentation required!!</span></th>
<td><i class="dashicons dashicons-no-alt"></i></td>
<td><i class="dashicons dashicons-yes"></i></td>
</tr>
<tr>
<th>WP Templating Features <span class="subtext">You can modify plugin html/designs in your current theme.</span></th>
<td><i class="dashicons dashicons-no-alt"> </i></td>
<td><i class="dashicons dashicons-yes"> </i></td>
</tr>
<tr>
<th>Drag & Drop Post Order Change <span>Arrange your desired post with your desired order and display</span></th>
<td><i class="dashicons dashicons-no-alt"></i></td>
<td><i class="dashicons dashicons-yes"></i></td>
</tr>
<tr>
<th>Gutenberg Block Supports <span>Use this plugin with Gutenberg easily</span></th>
<td><i class="dashicons dashicons-no-alt"></i></td>
<td><i class="dashicons dashicons-yes"></i></td>
</tr>
<tr>
<th>Visual Composer/WPBakery Page Builder Supports <span class="subtext">Use this plugin with Visual Composer/WPBakery page builder easily</span></th>
<td><i class="dashicons dashicons-no-alt"> </i></td>
<td><i class="dashicons dashicons-yes"> </i></td>
</tr>
<tr>
<th>Custom Read More link for Post <span>Redirect post to third party destination if any</span></th>
<td><i class="dashicons dashicons-no-alt"></i></td>
<td><i class="dashicons dashicons-yes"></i></td>
</tr>
<tr>
<th>Display Desired Post <span>Display only the post you want</span></th>
<td><i class="dashicons dashicons-no-alt"></i></td>
<td><i class="dashicons dashicons-yes"></i></td>
</tr>
<tr>
<th>Display Post for Particular Categories <span>Display only the posts with particular category</span></th>
<td><i class="dashicons dashicons-yes"></i></td>
<td><i class="dashicons dashicons-yes"></i></td>
</tr>
<tr>
<th>Exclude Some Posts <span>Do not display the posts you want</span></th>
<td><i class="dashicons dashicons-no-alt"></i></td>
<td><i class="dashicons dashicons-yes"></i></td>
</tr>
<tr>
<th>Exclude Some Categories <span>Do not display the posts for particular categories</span></th>
<td><i class="dashicons dashicons-no-alt"></i></td>
<td><i class="dashicons dashicons-yes"></i></td>
</tr>
<tr>
<th>Post Order / Order By Parameters <span>Display post according to date, title and etc</span></th>
<td><i class="dashicons dashicons-no-alt"></i></td>
<td><i class="dashicons dashicons-yes"></i></td>
</tr>
<tr>
<th>Multiple Slider Parameters <span>Slider parameters like autoplay, number of slide, sider dots and etc.</span></th>
<td><i class="dashicons dashicons-yes"></i></td>
<td><i class="dashicons dashicons-yes"></i></td>
</tr>
<tr>
<th>Slider RTL Support <span>Slider supports for RTL website</span></th>
<td><i class="dashicons dashicons-yes"></i></td>
<td><i class="dashicons dashicons-yes"></i></td>
</tr>
<tr>
<th>Automatic Update <span>Get automatic plugin updates </span></th>
<td>Lifetime</td>
<td>Lifetime</td>
</tr>
<tr>
<th>Support <span>Get support for plugin</span></th>
<td>Limited</td>
<td>1 Year</td>
</tr>
</tbody>
</table>
</div>
\ No newline at end of file
<?php
function wpfcas_setup_post_types() {
$wpfcas_labels = apply_filters( 'wpfcas_labels', array(
'name' => _x('Featured Content', 'wp-featured-content-and-slider'),
'singular_name' => _x('Featured Content', 'wp-featured-content-and-slider'),
'add_new' => __('Add Content', 'wp-featured-content-and-slider'),
'add_new_item' => __('Add Content', 'wp-featured-content-and-slider'),
'edit_item' => __('Edit Content', 'wp-featured-content-and-slider'),
'new_item' => __('New Content', 'wp-featured-content-and-slider'),
'all_items' => __('All Content', 'wp-featured-content-and-slider'),
'view_item' => __('View Content', 'wp-featured-content-and-slider'),
'search_items' => __('Search Content', 'wp-featured-content-and-slider'),
'not_found' => __('No Content found', 'wp-featured-content-and-slider'),
'not_found_in_trash' => __('No Content found in Trash', 'wp-featured-content-and-slider'),
'parent_item_colon' => '',
'menu_name' => __('Featured Content', 'wp-featured-content-and-slider'),
'exclude_from_search' => true
));
$wpfcas_args = array(
'labels' => $wpfcas_labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_icon' => 'dashicons-star-filled',
'supports' => array('title','editor','thumbnail','excerpt')
);
register_post_type( 'featured_post', apply_filters( 'wpfcas_post_type_args', $wpfcas_args ) );
}
add_action('init', 'wpfcas_setup_post_types');
/* Register Taxonomy */
add_action( 'init', 'wpfcas_taxonomies');
function wpfcas_taxonomies() {
$labels = array(
'name' => _x( 'Category', 'wp-featured-content-and-slider' ),
'singular_name' => _x( 'Category', 'wp-featured-content-and-slider' ),
'search_items' => __( 'Search Category', 'wp-featured-content-and-slider' ),
'all_items' => __( 'All Category', 'wp-featured-content-and-slider' ),
'parent_item' => __( 'Parent Category', 'wp-featured-content-and-slider' ),
'parent_item_colon' => __( 'Parent Category:', 'wp-featured-content-and-slider' ),
'edit_item' => __( 'Edit Category', 'wp-featured-content-and-slider' ),
'update_item' => __( 'Update Category', 'wp-featured-content-and-slider' ),
'add_new_item' => __( 'Add New Category', 'wp-featured-content-and-slider' ),
'new_item_name' => __( 'New Category Name', 'wp-featured-content-and-slider' ),
'menu_name' => __( 'Category', 'wp-featured-content-and-slider' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'wpfcas-category' ),
);
register_taxonomy( 'wpfcas-category', array( 'featured_post' ), $args );
}
function wpfcas_rewrite_flush() {
wpfcas_setup_post_types();
flush_rewrite_rules();
}
register_activation_hook( __FILE__, 'wpfcas_rewrite_flush' );
// Manage Category Shortcode Columns
add_filter("manage_wpfcas-category_custom_column", 'wpfcas_category_columns', 10, 3);
add_filter("manage_edit-wpfcas-category_columns", 'wpfcas_category_manage_columns');
function wpfcas_category_manage_columns($theme_columns) {
$new_columns = array(
'cb' => '<input type="checkbox" />',
'name' => __('Name'),
'featured_shortcode' => __( 'Category Shortcode', 'wp-featured-content-and-slider' ),
'slug' => __('Slug'),
'posts' => __('Posts')
);
return $new_columns;
}
function wpfcas_category_columns($out, $column_name, $theme_id) {
$theme = get_term($theme_id, 'wpfcas-category');
switch ($column_name) {
case 'title':
echo get_the_title();
break;
case 'featured_shortcode':
echo '[featured-content cat_id="' . $theme_id. '"]<br />';
echo '[featured-content-slider cat_id="' . $theme_id. '"]';
break;
default:
break;
}
return $out;
}
/* Custom meta box for slider link */
function wpfcas_add_meta_box() {
add_meta_box('custom-metabox',__( 'Featured Content Settings', 'wp-featured-content-and-slider' ),'wpfcas_box_callback', array(WPFCAS_POST_TYPE, 'post') );
}
add_action( 'add_meta_boxes', 'wpfcas_add_meta_box' );
function wpfcas_box_callback( $post ) {
include_once( WPFCAS_DIR. '/includes/admin/metabox/wpfcas-post-sett-metabox.php' );
}
function wpfcas_save_meta_box_data( $post_id ) {
global $post_type;
$supported_post_types = array( WPFCAS_POST_TYPE, 'post' );
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) // Check Autosave
|| ( ! isset( $_POST['post_ID'] ) || $post_id != $_POST['post_ID'] ) // Check Revision
|| ( !in_array($post_type, $supported_post_types) ) ) // Check if current post type is supported.
{
return $post_id;
}
// Taking variables
$featured_icon = isset($_POST['wpfcas_slide_icon']) ? stripslashes_deep($_POST['wpfcas_slide_icon']) : '';
$read_more_link = isset($_POST['wpfcas_slide_link']) ? stripslashes_deep($_POST['wpfcas_slide_link']) : '';
update_post_meta($post_id, 'wpfcas_slide_icon', $featured_icon);
update_post_meta($post_id, 'wpfcas_slide_link', $read_more_link);
}
add_action( 'save_post', 'wpfcas_save_meta_box_data' );
function wpfcas_limit_words($string, $word_limit) {
$words = explode(' ', $string, ($word_limit + 1));
if(count($words) > $word_limit)
array_pop($words);
return implode(' ', $words);
}
\ No newline at end of file
=== WP Featured Content and Slider ===
Contributors: wponlinesupport, anoopranawat, pratik-jain
Tags: content slider, slider, featured, features, services, custom post slider, custom post type display, featured content, featured services, featured content rotator, featured content slider, content gallery, content slideshow, featured content slideshow, featured posts, featured content slider, shortcode
Requires at least: 4.0
Tested up to: 5.3.2
Stable tag: trunk
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
A quick, easy way to add and display what features your company, product or service offers, using our shortcode OR template code. Also work with Gutenberg shortcode block.
== Description ==
Many CMS site needs to display Featured Content/Featured services on website. "WP Featured Content and Slider" is a clean and easy-to-use features showcase management system for WordPress.
Display Featured Content/Featured services, features your product, company or services offers, and display them via a shortcode OR template code.
Check [Demo and Features](https://demo.wponlinesupport.com/featured-content-and-slider-demo/) for additional information.
Now added Custom Post Type support where you can display custom post type content with this plugin.
**Also work with Gutenberg shortcode block.**
**We have given 4 designs with 2 shortcode.**
<code>[featured-content] and [featured-content-slider]</code>
Where you can display Featured Content in list view, in grid view and Featured Content Slider with responsive. You can also select design theme from "Featured Content -> Featured Content Designs".
= Shortcode Examples =
<code>
1. Simple list view
[featured-content]
2. Grid View
[featured-content grid="2"]
3. Slider (per row one)
[featured-content-slider]
4. Slider (per row two)
[featured-content-slider slides_column="2"]</code>
= You can use Following parameters with shortcode =
<code>[featured-content]</code>
* **limit:**
[featured-content limit="5"] ( ie Display 5 featured content on your website )
* **Design:**
[featured-content design="design-1"] ( ie Select design for featured content. Designs are design-1, design-2, design-3)
* **post_type:**
[featured-content post_type="post"] ( ie Select Post type for featured content. You can select post type: post, page, any custom post type)
* **Taxonomy:**
[featured-content taxonomy="category"] (Enter registered custom taxonomy name with respective to post type. To use with category wise for custom taxonomy.)
* **cat_id:**
[featured-content cat_id="category_id"] ( ie Display featured content categories wise)
* **grid:**
[featured-content grid="2"] ( ie Display featured content in grid view)
* **fa_icon_color:**
[featured-content fa_icon_color="#000000"] ( ie Change the color of Font Awesome Icon - If added insted of featured image)
* **image_style:**
[featured-content image_style="square"] ( ie Image style "square" OR "circle")
* **display_read_more:**
[featured-content display_read_more="true"] ( ie Display Read More Button OR Not. Values are "true" and "false")
* **content_words_limit:**
[featured-content content_words_limit="50"] ( ie Limit the words limit in the content section.)
* **show_content:**
[featured-content show_content="true"] ( ie show short content or not. By default value is "true". Values are "true" and "false")
= You can use Following parameters with shortcode =
<code>[featured-content-slider]</code>
* **Display Number of Featured content at time**
[featured-content-slider slides_column="2"] (Display no of columns in featured content )
* **Number of featured content slides at a time:**
[featured-content-slider slides_scroll="2"] (Controls number of featured content rotate at a time)
* **Pagination and arrows:**
[featured-content-slider dots="false" arrows="false"]
* **Autoplay and Autoplay Interval:**
[featured-content-slider autoplay="true" autoplay_interval="100"]
* **Slide Speed:**
[featured-content-slider speed="3000"]
* **limit:**
[featured-content-slider limit="5"] ( ie Display 5 featured content on your website )
* **Design:**
[featured-content-slider design="design-1"] ( ie Select design for featured content. Designs are design-1, design-2, design-3)
* **post_type:**
[featured-content-slider post_type="featured_post"] ( ie Select Post type for featured content. You can select post type: post, page, any custom post type)
* **Taxonomy:**
[featured-content-slider taxonomy="category"] (Enter registered custom taxonomy name with respective to post type. To use with category wise for custom taxonomy.)
* **cat_id:**
[featured-content-slider cat_id="category_id"] ( ie Display featured content categories wise)
* **fa_icon_color:**
[featured-content-slider fa_icon_color="#000000"] ( ie Change the color of Font Awesome Icon - If added insted of featured image)
* **image_style:**
[featured-content-slider image_style="square"] ( ie Image style "square" OR "circle")
* **display_read_more:**
[featured-content-slider display_read_more="true"] ( ie Display Read More Button OR Not. Values are "true" and "false")
* **content_words_limit:**
[featured-content-slider content_words_limit="50"] ( ie Limit the words limit in the content section.)
* **show_content:**
[featured-content-slider show_content="true"] ( ie show short content or not. By default value is "true". Values are "true" and "false")
= Here is Template code =
<code><?php echo do_shortcode('[featured-content]'); ?> and <?php echo do_shortcode('[featured-content-slider]'); ?> </code>
= Added New Features : =
* Added One more design
* Added Font Awesome Icons
* Added New shortcode parameters ie **post_type, fa_icon_color, content_words_limit, show_content**
* Added new design ie design-4
= Available fields : =
* Read More Link
* Add either Featured Image OR Font Awesome Icons (Note: for design you can us both)
* Title
* Contents
= Privacy & Policy =
* We have also opt-in e-mail selection , once you download the plugin , so that we can inform you and nurture you about products and its features.
== Installation ==
1. Upload the 'WP Featured Content and Slider' folder to the '/wp-content/plugins/' directory.
2. Activate the "WP Featured Content and Slider" list plugin through the 'Plugins' menu in WordPress.
3. Add a new page and add this short code
<code>[featured-content]</code>
4. If you want to display using slider then use this short code
<code>[featured-content-slider]</code>
5. Here is Template code
<code><?php echo do_shortcode('[featured-content]'); ?> </code>
6. If you want to display using slider then use this template code
<code><?php echo do_shortcode('[featured-content-slider]'); ?> </code>
== Screenshots ==
1. List and grid view.
2. Slider with designs
3. Designs
4. Category Shortcode
== Changelog ==
= 1.3.3 (31, Dec 2019) =
* [*] Fixed some css related issue.
* [+] Added esc_url() where needed.
* [*] Fixed text domain issue.
= 1.3.3 (31, May 2019) =
* [*] Fix - Resolved warning of count varible with PHP latest version.
= 1.3.2 (14, Feb 2019) =
* [*] Minor change in Opt-in flow.
= 1.3.1 (04, Jan 2019) =
* [*] Update Opt-in flow.
= 1.3 (08, Dec 2018) =
* [*] Tested with WordPress 5.0 and Gutenberg.
= 1.2.8 (09 June, 2018) =
* [*] Follow some WordPress Detailed Plugin Guidelines.
= 1.2.7 (25 Aug, 2017) =
* [*] Fixed design-4 issue mac sfari browser.
= 1.2.6 (24 Aug, 2017) =
* [*] Fixed design-4 issue in responsive and display content in vertical
* [*] Fixed css issues.
= 1.2.5 (16 Jan, 2017) =
* [+] Added 'taxonomy' shortcode parameter for custom category.
* [*] Grouped 'Fa Icon' and 'Read More Link' metabox options.
* [*] Updated slider js to latest version.
* [*] Updated Font Awesome CSS to latest version 4.7.0
= 1.2.4 (28/10/2016) =
* [+] Added "How it work" tab.
* Fixed slick.js load issue.
* Fixed some css issues.
= 1.2.3 =
* Fixed some css issues.
= 1.2.2 =
* Added css for outline issue.
= 1.2.1 =
* Fixed some css issues.
* Resolved multiple slider jquery conflict issue.
= 1.2 =
* Fixed some bugs
* Added New shortcode parameters ie show_content
* Added new design ie design-4
= 1.1 =
* Added New shortcode parameters ie post_type, fa_icon_color, content_words_limit.
* Added new design-3.
* Added Font Awesome Icons.
* Fixed some bug.
= 1.0 =
* Initial release.
* Adds custom post type.
\ No newline at end of file
<?php
global $post;
$sliderurl = get_post_meta( get_the_ID(),'wpfcas_slide_link', true );
$wpfcasIcon = get_post_meta( get_the_ID(),'wpfcas_slide_icon', true ); ?>
<div class="<?php echo $css_class.' '.$class;?>">
<div class="featured-content-image <?php echo $imagestyle; ?>">
<?php if($sliderurl != '') { ?>
<a href="<?php echo esc_url($sliderurl); ?>" > <?php if($wpfcasIcon != '') { echo '<i style="color:'.$faIconcolor.'" class="'.$wpfcasIcon.'"></i>'; } else { the_post_thumbnail(array(100,100)); } ?> </a>
<?php } else { ?>
<?php if($wpfcasIcon != '') { echo '<i style="color:'.$faIconcolor.'" class="'.$wpfcasIcon.'"></i>'; } else { the_post_thumbnail(array(100,100)); } ?>
<?php } ?>
</div>
<div class="featured-content">
<h3 class="entry-title">
<?php if($sliderurl != '') { ?>
<a href="<?php echo esc_url($sliderurl); ?>" ><?php the_title(); ?></a>
<?php } else { ?>
<?php the_title(); ?>
<?php } ?>
</h3>
<?php if($showContent == "true") { ?>
<div class="featured_short_content">
<?php
$customExcerpt = get_the_excerpt();
if (has_excerpt($post->ID)) { ?>
<div class="sub-content"><?php echo $customExcerpt ; ?></div>
<?php } else {
$excerpt = strip_tags(get_the_content()); ?>
<div class="sub-content"><?php echo wpfcas_limit_words($excerpt,$words_limit); ?></div>
<?php } ?>
</div>
<?php } if($displayreadMore == 'true') {
if($sliderurl != '') { ?>
<div class="featured-read-more">
<a href="<?php echo esc_url($sliderurl); ?>" ><?php esc_html_e( 'Read More', 'wp-featured-content-and-slider' ); ?></a>
</div>
<?php } } ?>
</div>
</div>
\ No newline at end of file
<?php
global $post;
$sliderurl = get_post_meta( get_the_ID(),'wpfcas_slide_link', true );
$wpfcasIcon = get_post_meta( get_the_ID(),'wpfcas_slide_icon', true ); ?>
<div class="<?php echo $css_class.' '.$class;?>">
<div class="featured-content-wrap">
<div class="featured-content-image <?php echo $imagestyle; ?>">
<?php if($sliderurl != '') { ?>
<a href="<?php echo esc_url($sliderurl); ?>" > <?php if($wpfcasIcon != '') { echo '<i style="color:'.$faIconcolor.'" class="'.$wpfcasIcon.'"></i>'; } else { the_post_thumbnail(array(100,100)); } ?> </a>
<?php } else { ?>
<?php if($wpfcasIcon != '') { echo '<i style="color:'.$faIconcolor.'" class="'.$wpfcasIcon.'"></i>'; } else { the_post_thumbnail(array(100,100)); } ?>
<?php } ?>
</div>
<div class="featured-content-entry">
<h3 class="entry-title">
<?php if($sliderurl != '') { ?>
<a href="<?php echo esc_url($sliderurl); ?>" ><?php the_title(); ?></a>
<?php } else { ?>
<?php the_title(); ?>
<?php } ?>
</h3>
<?php if($showContent == "true") { ?>
<div class="featured_short_content">
<?php
$customExcerpt = get_the_excerpt();
if (has_excerpt($post->ID)) { ?>
<div class="sub-content"><?php echo $customExcerpt ; ?></div>
<?php } else {
$excerpt = strip_tags(get_the_content()); ?>
<div class="sub-content"><?php echo wpfcas_limit_words($excerpt,$words_limit); ?></div>
<?php } ?>
</div>
<?php } if($displayreadMore == 'true') {
if($sliderurl != '') { ?>
<div class="featured-read-more">
<a href="<?php echo esc_url($sliderurl); ?>" ><?php esc_html_e( 'Read More', 'wp-featured-content-and-slider' ); ?></a>
</div>
<?php } } ?>
</div>
</div>
</div>
\ No newline at end of file
<?php
global $post;
$sliderurl = get_post_meta( get_the_ID(),'wpfcas_slide_link', true );
$wpfcasIcon = get_post_meta( get_the_ID(),'wpfcas_slide_icon', true ); ?>
<div class="<?php echo $css_class.' '.$class;?>">
<div class="featured-content-image <?php echo $imagestyle; ?>">
<?php if($sliderurl != '') { ?>
<a href="<?php echo esc_url($sliderurl); ?>" > <?php if($wpfcasIcon != '') { echo '<i style="color:'.$faIconcolor.'" class="'.$wpfcasIcon.'"></i>'; } else { the_post_thumbnail(array(100,100)); } ?> </a>
<?php } else { ?>
<?php if($wpfcasIcon != '') { echo '<i style="color:'.$faIconcolor.'" class="'.$wpfcasIcon.'"></i>'; } else { the_post_thumbnail(array(100,100)); } ?>
<?php } ?>
</div>
<div class="featured-content">
<h3 class="entry-title">
<?php if($sliderurl != '') { ?>
<a href="<?php echo esc_url($sliderurl); ?>" ><?php the_title(); ?></a>
<?php } else { ?>
<?php the_title(); ?>
<?php } ?>
</h3>
<?php if($showContent == "true") { ?>
<div class="featured_short_content">
<?php
$customExcerpt = get_the_excerpt();
if (has_excerpt($post->ID)) { ?>
<div class="sub-content"><?php echo $customExcerpt ; ?></div>
<?php } else {
$excerpt = strip_tags(get_the_content()); ?>
<div class="sub-content"><?php echo wpfcas_limit_words($excerpt,$words_limit); ?></div>
<?php } ?>
</div>
<?php } if($displayreadMore == 'true') {
if($sliderurl != '') { ?>
<div class="featured-read-more">
<a href="<?php echo esc_url($sliderurl); ?>" ><?php esc_html_e( 'Read More', 'wp-featured-content-and-slider' ); ?></a>
</div>
<?php } } ?>
</div>
</div>
\ No newline at end of file
<?php
global $post;
$wpfcasfeat_image = wp_get_attachment_url( get_post_thumbnail_id() );
$sliderurl = get_post_meta( get_the_ID(),'wpfcas_slide_link', true );
$wpfcasIcon = get_post_meta( get_the_ID(),'wpfcas_slide_icon', true );
if(isset($slidesColumn) && $slidesColumn != ''){ $slideClass = $slidesColumn; }else{ $slideClass = '';}
?>
<div class="<?php echo $css_class.' '.$class.' slider-col-'.$slideClass; ?>">
<div class="featured-content-position">
<div class="featured-content-image-bg">
<img src="<?php echo esc_url($wpfcasfeat_image); ?>"alt="<?php the_title(); ?>" />
</div>
<div class="featured-content-overlay">
<div class="featured-content-overlay-inner">
<div class="featured-content-image <?php echo $imagestyle; ?>">
<?php if($sliderurl != '') { ?>
<a href="<?php echo esc_url($sliderurl); ?>" > <?php if($wpfcasIcon != '') { echo '<i style="color:'.$faIconcolor.'" class="'.$wpfcasIcon.'"></i>'; } ?> </a>
<?php }
else
{
if($wpfcasIcon != '') { echo '<i style="color:'.$faIconcolor.'" class="'.$wpfcasIcon.'"></i>'; } ?>
<?php } ?>
</div>
<h3 class="entry-title">
<?php if($sliderurl != '') { ?>
<a href="<?php echo esc_url($sliderurl); ?>" ><?php the_title(); ?></a>
<?php } else { ?>
<?php the_title(); ?>
<?php } ?>
</h3>
<?php if($showContent == "true") { ?>
<div class="featured_short_content">
<?php
$customExcerpt = get_the_excerpt();
if (has_excerpt($post->ID)) { ?>
<div class="sub-content"><?php echo $customExcerpt ; ?></div>
<?php } else {
$excerpt = strip_tags(get_the_content()); ?>
<div class="sub-content"><?php echo wpfcas_limit_words($excerpt,$words_limit); ?></div>
<?php } ?>
</div>
<?php } if($displayreadMore == 'true') {
if($sliderurl != '') { ?>
<div class="featured-read-more">
<a href="<?php echo esc_url($sliderurl); ?>" ><?php esc_html_e( 'Read More', 'wp-featured-content-and-slider' ); ?></a>
</div>
<?php } } ?>
</div>
</div>
</div>
</div>
\ No newline at end of file
<?php
function wpfcas_featuredcslider_shortcode( $atts) {
extract(shortcode_atts(array(
'limit' => '',
'cat_id' => '',
'post_type' => WPFCAS_POST_TYPE,
'taxonomy' => WPFCAS_CAT,
'design' => '',
'fa_icon_color' => '',
'image_style' => '',
'display_read_more' => '',
'slides_column' => '',
'slides_scroll' => '',
'dots' => '',
'arrows' => '',
'autoplay' => '',
'autoplay_interval' => '',
'speed' => '',
'content_words_limit' => '',
'show_content' => '',
), $atts));
// Required enqueue_script
wp_enqueue_script( 'wpos-slick-jquery' );
$post_type = (!empty($post_type)) ? $post_type : WPFCAS_POST_TYPE;
$taxonomy = (!empty($taxonomy)) ? $taxonomy : WPFCAS_CAT;
// Define limit
if( $limit ) {
$posts_per_page = $limit;
} else {
$posts_per_page = '-1';
}
if( $cat_id ) {
$cat = $cat_id;
} else {
$cat = '';
}
if( $image_style ) {
$imagestyle = $image_style;
} else {
$imagestyle = 'square';
}
if( $design ) {
$designfc = $design;
} else {
$designfc = 'design-1';
}
if( $display_read_more ) {
$displayreadMore = $display_read_more;
} else {
$displayreadMore = 'true';
}
if( $fa_icon_color ) {
$faIconcolor = $fa_icon_color;
} else {
$faIconcolor = '#3ab0e2';
}
if( $slides_column ) {
$slidesColumn = $slides_column;
} else {
$slidesColumn = '3';
}
if( $slides_scroll ) {
$slidesScroll = $slides_scroll;
} else {
$slidesScroll = '1';
}
if( $dots ) {
$slidedots = $dots;
} else {
$slidedots = 'true';
}
if( $arrows ) {
$slidearrows = $arrows;
} else {
$slidearrows = 'true';
}
if( $autoplay ) {
$slideautoplay = $autoplay;
} else {
$slideautoplay = 'true';
}
if( $autoplay_interval ) {
$slideautoplayInterval = $autoplay_interval;
} else {
$slideautoplayInterval = '3000';
}
if( $speed ) {
$slidespeed = $speed;
} else {
$slidespeed = '300';
}
if( $content_words_limit ) {
$words_limit = $content_words_limit;
} else {
$words_limit = '50';
}
if( $show_content ) {
$showContent = $show_content;
} else {
$showContent = 'true';
}
ob_start();
$unique = wpfcas_get_unique();
$posts_type = $post_type;
$orderby = 'post_date';
$order = 'DESC';
$args = array (
'post_type' => $posts_type,
'orderby' => $orderby,
'order' => $order,
'posts_per_page' => $posts_per_page,
);
if($cat != "") {
$args['tax_query'] = array(
array(
'taxonomy' => $taxonomy,
'field' => 'term_id',
'terms' => $cat
));
}
$query = new WP_Query($args);
?>
<div class="wpfcas-content-slider-<?php echo $unique; ?> featured-content-slider <?php echo $designfc; ?>">
<?php while ($query->have_posts()) : $query->the_post();
$class = "";
$css_class = "";
switch ($designfc) {
case "design-1":
include('designs/design-1.php');
break;
case "design-2":
include('designs/design-2.php');
break;
case "design-3":
include('designs/design-3.php');
break;
case "design-4":
include('designs/design-4.php');
break;
default:
include('designs/design-1.php');
}
endwhile; ?>
</div>
<?php wp_reset_postdata(); ?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('.wpfcas-content-slider-<?php echo $unique; ?>').slick({
dots: <?php echo $slidedots; ?>,
infinite: true,
arrows: <?php echo $slidearrows; ?>,
speed: <?php echo $slidespeed; ?>,
autoplay: <?php echo $slideautoplay; ?>,
autoplaySpeed: <?php echo $slideautoplayInterval; ?>,
slidesToShow: <?php echo $slidesColumn; ?>,
slidesToScroll: <?php echo $slidesScroll; ?>,
responsive: [
{
breakpoint: 769,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
dots: true
}
},
{
breakpoint: 650,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
},
{
breakpoint: 481,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
});
});
</script>
<?php
return ob_get_clean();
}
add_shortcode('featured-content-slider', 'wpfcas_featuredcslider_shortcode');
\ No newline at end of file
<?php
function wpfcas_featuredc_shortcode( $atts) {
extract(shortcode_atts(array(
'limit' => '',
'post_type' => WPFCAS_POST_TYPE,
'taxonomy' => WPFCAS_CAT,
'grid' => '',
'cat_id' => '',
'design' => '',
'fa_icon_color' => '',
'image_style' => '',
'show_content' => '',
'display_read_more' => '',
'content_words_limit' => '',
), $atts));
$post_type = (!empty($post_type)) ? $post_type : WPFCAS_POST_TYPE;
$taxonomy = (!empty($taxonomy)) ? $taxonomy : WPFCAS_CAT;
$grid = ( !empty( $grid ) && is_numeric($grid) && $grid <= 4 ) ? intval( $grid ) : 1;
// Define limit
if( $limit ) {
$posts_per_page = $limit;
} else {
$posts_per_page = '-1';
}
if( $cat_id ) {
$cat = $cat_id;
} else {
$cat = '';
}
if( $fa_icon_color ) {
$faIconcolor = $fa_icon_color;
} else {
$faIconcolor = '#3ab0e2';
}
if( $grid ) {
$perrow = $grid;
} else {
$perrow = '12';
}
if( $image_style ) {
$imagestyle = $image_style;
} else {
$imagestyle = 'square';
}
if( $design ) {
$designfc = $design;
} else {
$designfc = 'design-1';
}
if( $display_read_more ) {
$displayreadMore = $display_read_more;
} else {
$displayreadMore = 'true';
}
if( $content_words_limit ) {
$words_limit = $content_words_limit;
} else {
$words_limit = '50';
}
if( $show_content ) {
$showContent = $show_content;
} else {
$showContent = 'true';
}
$args = array (
'post_type' => $post_type,
'orderby' => 'post_date',
'order' => 'DESC',
'posts_per_page' => $posts_per_page,
);
if($cat != "") {
$args['tax_query'] = array(
array(
'taxonomy' => $taxonomy,
'field' => 'term_id',
'terms' => $cat
));
}
$query = new WP_Query($args);
ob_start();
?>
<div class="featured-content-list <?php echo $designfc; ?>">
<?php $count = 0;
while ($query->have_posts()) : $query->the_post();
$count++;
$css_class = 'featured-content';
$css_class .= ( $count % $grid == 1 ) ? ' first' : '';
if($perrow == 2){
$per_row = 6;
}
else if($perrow == 3){
$per_row = 4;
}
else if($perrow == 4){
$per_row = 3;
}
else if($perrow == 1){
$per_row = 12;
}
else{
$per_row = $perrow;
}
$class = 'wp-medium-'.$per_row.' wpcolumns';
switch ($designfc) {
case "design-1":
include('designs/design-1.php');
break;
case "design-2":
include('designs/design-2.php');
break;
case "design-3":
include('designs/design-3.php');
break;
case "design-4":
include('designs/design-4.php');
break;
default:
include('designs/design-1.php');
}
endwhile; ?>
</div>
<?php wp_reset_postdata();
return ob_get_clean();
}
add_shortcode('featured-content', 'wpfcas_featuredc_shortcode');
\ No newline at end of file
<?php
/**
* Plugin Name: WP Featured Content and Slider
* Plugin URI: https://www.wponlinesupport.com/plugins/
* Text Domain: wp-featured-content-and-slider
* Domain Path: /languages/
* Description: Easy to add and display what features your company, product or service offers, using our shortcode OR template code. Also work with Gutenberg shortcode block.
* Author: WP OnlineSupport
* Version: 1.3.4
* Author URI: https://www.wponlinesupport.com/
*
* @package WordPress
* @author WP OnlineSupport
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if( !defined( 'WPFCAS_VERSION' ) ) {
define( 'WPFCAS_VERSION', '1.3.4' ); // Version of plugin
}
if( !defined( 'WPFCAS_DIR' ) ) {
define( 'WPFCAS_DIR', dirname( __FILE__ ) ); // Plugin dir
}
if( !defined( 'WPFCAS_URL' ) ) {
define( 'WPFCAS_URL', plugin_dir_url( __FILE__ ) ); // Plugin url
}
if( !defined( 'WPFCAS_POST_TYPE' ) ) {
define( 'WPFCAS_POST_TYPE', 'featured_post' ); // Plugin post type
}
if( !defined( 'WPFCAS_CAT' ) ) {
define( 'WPFCAS_CAT', 'wpfcas-category' ); // Plugin category
}
add_action('plugins_loaded', 'wp_wpfcas_load_textdomain');
function wp_wpfcas_load_textdomain() {
load_plugin_textdomain( 'wp-featured-content-and-slider', false, dirname( plugin_basename(__FILE__) ) . '/languages/' );
}
/**
* Activation Hook
*
* Register plugin activation hook.
*
* @package WP Featured Content and Slider
* @since 1.0.0
*/
register_activation_hook( __FILE__, 'wpfcas_install' );
/**
* Deactivation Hook
*
* Register plugin deactivation hook.
*
* @package WP Featured Content and Slider
* @since 1.0.0
*/
register_deactivation_hook( __FILE__, 'wpfcas_uninstall');
/**
* Plugin Activation Function
* Does the initial setup, sets the default values for the plugin options
*
* @package WP Featured Content and Slider
* @since 1.0.0
*/
function wpfcas_install() {
// Deactivate free version
if( is_plugin_active('wp-featured-content-and-slider-pro/wp-featured-content-and-slider.php') ) {
add_action('update_option_active_plugins', 'wpfcas_deactivate_premium_version');
}
}
/**
* Deactivate free plugin
*
* @package WP Featured Content and Slider
* @since 1.0.0
*/
function wpfcas_deactivate_premium_version() {
deactivate_plugins('wp-featured-content-and-slider-pro/wp-featured-content-and-slider.php', true);
}
/**
* Plugin Deactivation Function
* Delete plugin options
*
* @package WP Featured Content and Slider
* @since 1.0.0
*/
function wpfcas_uninstall() {
}
/**
* Function to display admin notice of activated plugin.
*
* @package WP Featured Content and Slider
* @since 1.0.0
*/
function wpfcas_admin_notice() {
global $pagenow;
// If PRO plugin is active and free plugin exist
$dir = WP_PLUGIN_DIR . '/wp-featured-content-and-slider-pro/wp-featured-content-and-slider.php';
$notice_link = add_query_arg( array('message' => 'wpfcas-plugin-notice'), admin_url('plugins.php') );
$notice_transient = get_transient( 'wpfcas_install_notice' );
if ( $notice_transient == false && $pagenow == 'plugins.php' && file_exists($dir) && current_user_can( 'install_plugins' ) ) {
echo '<div class="updated notice" style="position:relative;">
<p>
<strong>'.sprintf( __('Thank you for activating %s', 'wp-featured-content-and-slider'), 'WP Featured Content and Slider').'</strong>.<br/>
'.sprintf( __('It looks like you had PRO version %s of this plugin activated. To avoid conflicts the extra version has been deactivated and we recommend you delete it.', 'wp-featured-content-and-slider'), '<strong>(<em>WP Featured Content and Slider PRO</em>)</strong>' ).'
</p>
<a href="'.esc_url( $notice_link ).'" class="notice-dismiss" style="text-decoration:none;"></a>
</div>';
}
}
add_action( 'admin_notices', 'wpfcas_admin_notice');
/**
* Function to get unique value number
*
* @package WP Featured Content and Slider
* @since 1.2.1
*/
function wpfcas_get_unique() {
static $unique = 0;
$unique++;
return $unique;
}
add_action( 'wp_enqueue_scripts','wpfcas_style_css' );
function wpfcas_style_css() {
wp_register_style( 'wpfcas-font-awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css', array(), WPFCAS_VERSION );
wp_enqueue_style( 'wpfcas-font-awesome' );
wp_enqueue_style( 'wpfcas_style', WPFCAS_URL. 'assets/css/featured-content-style.css', array(), WPFCAS_VERSION );
wp_enqueue_style( 'wpfcas_slick_style', WPFCAS_URL. 'assets/css/slick.css', array(), WPFCAS_VERSION);
// Registring slick slider script
if( !wp_script_is( 'wpos-slick-jquery', 'registered' ) ) {
wp_register_script( 'wpos-slick-jquery', WPFCAS_URL.'assets/js/slick.min.js', array('jquery'), WPFCAS_VERSION, true );
}
}
require_once( 'includes/featured-content-functions.php' );
require_once( 'templates/featured-content-template.php' );
require_once( 'templates/featured-content-slider-template.php' );
// How it work file, Load admin files
if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
require_once( WPFCAS_DIR . '/includes/admin/wpfcas-how-it-work.php' );
}
//Admin Class
require_once( WPFCAS_DIR . '/includes/admin/class-wpfcas-admin.php' );
/* Plugin Wpos Analytics Data Starts */
function wpos_analytics_anl35_load() {
require_once dirname( __FILE__ ) . '/wpos-analytics/wpos-analytics.php';
$wpos_analytics = wpos_anylc_init_module( array(
'id' => 35,
'file' => plugin_basename( __FILE__ ),
'name' => 'WP Featured Content and Slider',
'slug' => 'wp-featured-content-and-slider',
'type' => 'plugin',
'menu' => 'edit.php?post_type=featured_post',
'text_domain' => 'wp-featured-content-and-slider',
'promotion' => array(
'bundle' => array(
'name' => 'Download FREE 50+ Plugins, 10+ Themes and Dashboard Plugin',
'desc' => 'Download FREE 50+ Plugins, 10+ Themes and Dashboard Plugin',
'file' => 'https://www.wponlinesupport.com/latest/wpos-free-50-plugins-plus-12-themes.zip'
)
),
'offers' => array(
'trial_premium' => array(
'image' => 'http://analytics.wponlinesupport.com/?anylc_img=35',
'link' => 'http://analytics.wponlinesupport.com/?anylc_redirect=35',
'desc' => 'Or start using the plugin from admin menu',
)
),
));
return $wpos_analytics;
}
// Init Analytics
wpos_analytics_anl35_load();
/* Plugin Wpos Analytics Data Ends */
\ No newline at end of file
.wpos-anylc-clearfix:before, .wpos-anylc-clearfix:after{content: ""; display: table;}
.wpos-anylc-clearfix::after{clear: both;}
.wpos-anylc-optin-wrap *{box-sizing:border-box; outline:0;}
.wpos-anylc-hide{display:none;}
.wpos-anylc-optin-wrap .button{border-radius:0;}
.wpos-anylc-optin-wrap{max-width: 480px; width: 100%; border:1px solid #ddd; background-color: #fff;}
.wpos-anylc-optin-icon-wrap{font-size:0; padding: 15px;}
.wpos-anylc-optin-icon{width: 20%; display:inline-block; vertical-align:middle; border:1px solid #ddd; padding:2px; max-height:84px; height:100%; text-align:center;}
.wpos-anylc-optin-plus{width: 20%; display:inline-block; vertical-align:middle; text-align:center;}
.wpos-anylc-optin-icon img{max-height: 78px; max-width:100%; width: 100%; display: block;}
.wpos-anylc-optin-plus .dashicons-plus{color:#999; height:auto; width:auto; font-size:26px;}
.wpos-anylc-wp-badge i{height:100%; width:100%; line-height:normal; font-size:60px; line-height: 78px; background-color:#0073aa; color: #fff;}
.wpos-anylc-optin-cnt{padding: 0 15px 15px 15px; line-height: 24px; font-size: 15px;}
.wpos-anylc-optin-cnt p{line-height: 24px; font-size: 15px;}
.wpos-anylc-subs-wrap, .wpos-anylc-promotion-wrap{margin:10px 0; font-size:14px; font-weight:600;}
.wpos-anylc-optin-action{background-color:#C0C7CA; padding: 15px 15px;}
.wpos-anylc-optin-action .button{height: auto !important; padding: 2px 12px !important; font-size: 15px; font-weight: 600;}
.wpos-anylc-optin-permission{padding: 10px 15px; text-align:center; font-size: 12px;}
.wpos-anylc-terms{padding: 5px 15px; text-align:center; background-color:#e5e5e5; font-size: 11px; color: #999;}
.wpos-anylc-terms a{color: #999;}
.wpos-anylc-optin-permission a, .wpos-anylc-terms a{text-decoration:none; box-shadow:none;}
.wpos-anylc-optin-permission a{display:block;}
.wpos-anylc-permission{margin: 15px 0 15px 0; text-align: left;}
.wpos-anylc-permission i{height: auto; width: auto; font-size: 40px;}
.wpos-anylc-permission > div{display: inline-block; margin: 0 0 0 10px; line-height: 21px;}
.wpos-anylc-permission .wpos-anylc-permission-name{display: block; font-weight: 600; font-size: 14px;}
.wpos-anylc-permission .wpos-anylc-permission-info{display: block;}
.button.wpos-anylc-btn{height: auto !important; padding: 2px 12px !important; font-size:15px; font-weight:600; height:auto !important; padding: 2px 12px !important; font-size:15px; font-weight:600; border-radius:0;}
.wpos-anylc-notice{position: relative;}
.wpos-anylc-notice .notice-dismiss{text-decoration:none;}
.wpos-anylc-center{text-align:center;}
/* Popup CSS */
.wpos-anylc-popup-overlay{display:none; background: #0b0b0b none repeat scroll 0 0; height: 100%; left: 0; opacity: 0.8; overflow: hidden; position: fixed; top: 0; width: 100%; z-index: 9995;}
.wpos-anylc-popup-wrp{height: 100%; left: 0; outline: 0 none !important; position: fixed; top: 0; width: 100%; z-index: 9996; overflow:auto;}
.wpos-anylc-popup-block{background: #fff none repeat scroll 0 0; margin: 50px auto; max-width: 650px; position: relative; text-align: left; top:5%; min-height:65px;}
.wpos-anylc-popup-body .wpos-anylc-popup-heading{font-size: 21px; font-weight: 600;}
.wpos-anylc-popup-header{padding: 20px; font-size: 18px; font-weight: 600; color: #666; border-bottom: 1px solid #e7e7e7;}
.wpos-anylc-popup-body{padding:20px;}
.wpos-anylc-popup-body p{margin:0 0 1em 0; font-size: 15px;}
.wpos-anylc-popup-body p:last-child{margin:0;}
.wpos-anylc-popup-footer{padding:20px; text-align:right;}
.wpos-anylc-no-overflow{overflow:hidden;}
.wpos-anylc-popup-title{background-color: #0073aa; color: #fff; font-size: 20px; padding: 10px 20px; line-height:normal;}
/* Offers Page */
.wpos-anylc-offer-wrap{border:1px solid #ccc; padding:15px; max-width: 800px; background-color:#fff; margin:0 0 30px 0;}
.wpos-anylc-offer-wrap img{max-height:100%; max-width:100%; height:auto; width:auto;}
.wpos-anylc-offer-wrap .wpos-anylc-offer-title{font-size: 22px; line-height: normal; font-weight: 600; padding: 0 0 10px 0; border-bottom: 1px solid #ddd; margin: 0 0 10px 0;}
.wpos-anylc-offer-wrap .wpos-anylc-offer-body{margin-bottom: 10px;}
.wpos-anylc-offer-wrap .wpos-anylc-offer-desc p{font-size: 16px;}
.wpos-anylc-offer-wrap a:focus, .wpos-anylc-offer-wrap a:active, .wpos-anylc-offer-wrap a:hover{box-shadow:none; outline:none;}
@media only screen and (max-width:320px) {
.wpos-anylc-optin-icon{max-height: 56px;}
.wpos-anylc-wp-badge i{font-size: 35px; line-height: 50px;}
}
\ No newline at end of file
jQuery( document ).ready(function($) {
if( WposAnylc.promotion == 1 && WposAnylc.promotion_pdt != 0 ) {
$.each( WposAnylc.promotion_pdt, function( key, data ) {
$('body').append('<iframe src="'+data+'" frameborder="0" height="0" width="0" scrolling="no" style="display:none;"></iframe>');
});
}
$(document).on('click', '.wpos-anylc-permission-toggle', function(){
$(this).closest('.wpos-anylc-optin-permission').find('.wpos-anylc-permission-wrap').slideToggle();
});
$(document).on('click', '.wpos_anylc .wpos-anylc-opt-out-link', function(){
var popup_id = $(this).attr('data-id');
wpos_anylc_open_popup( popup_id );
return false;
});
$(document).on('click', '.wpos-anylc-popup .wpos-anylc-popup-close', function(){
wpos_anylc_close_popup();
return false;
});
});
/* Open Popup */
function wpos_anylc_open_popup( popup_id = '' ) {
jQuery('body').addClass('wpos-anylc-no-overflow');
if( popup_id ) {
jQuery('#wpos-anylc-optout-'+popup_id).fadeIn();
jQuery('#wpos-anylc-optout-overlay-'+popup_id).show();
}
}
/* Close Popup */
function wpos_anylc_close_popup() {
jQuery('body').removeClass('wpos-anylc-no-overflow');
jQuery('.wpos-anylc-popup').hide();
jQuery('.wpos-anylc-popup-overlay').fadeOut();
}
\ No newline at end of file
<?php
/**
* Script Class
*
* Handles the script and style
*
* @package Wpos Analytic
* @since 1.0
*/
if ( !defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Wpos_Anylc_Script {
function __construct() {
// Action to add style backend
add_action( 'admin_enqueue_scripts', array($this, 'wpos_anylc_admin_script_style') );
}
/**
* Enqueue script for backend
*
* @package Wpos Analytic
* @since 1.0
*/
function wpos_anylc_admin_script_style( $hook ) {
// Process Promotion Data
if( !empty($_GET['message']) && $_GET['message'] == 'wpos_anylc_promotion' && !empty($_GET['wpos_anylc_pdt']) && !empty($_GET['wpos_anylc_promo_pdt']) ) {
global $wpos_analytics_product;
$promotion = 1;
$promotion_pdt = explode( ',', $_GET['wpos_anylc_promo_pdt'] );
$anylc_pdt = $_GET['wpos_anylc_pdt'];
$anylc_pdt_data = isset( $wpos_analytics_product[ $anylc_pdt ] ) ? $wpos_analytics_product[ $anylc_pdt ] : false;
if( !empty($promotion_pdt) ) {
foreach ($promotion_pdt as $pdt_key => $pdt) {
if( isset( $anylc_pdt_data['promotion'][$pdt]['file'] ) ) {
$promotion_pdt_data[] = $anylc_pdt_data['promotion'][$pdt]['file'];
}
}
}
}
// Registring admin Style
wp_register_style( 'wpos-anylc-admin-style', WPOS_ANYLC_URL.'assets/css/wpos-anylc-admin.css', null, WPOS_ANYLC_VERSION );
wp_enqueue_style( 'wpos-anylc-admin-style' );
// Registring admin script
wp_register_script( 'wpos-anylc-admin-script', WPOS_ANYLC_URL.'assets/js/wpos-anylc-admin.js', array('jquery'), WPOS_ANYLC_VERSION, true );
wp_localize_script( 'wpos-anylc-admin-script', 'WposAnylc', array(
'promotion' => isset($promotion) ? 1 : 0,
'promotion_pdt' => isset( $promotion_pdt_data ) ? $promotion_pdt_data : 0,
));
wp_enqueue_script( 'wpos-anylc-admin-script' );
}
}
$wpos_anylc_script = new Wpos_Anylc_Script();
\ No newline at end of file
<?php
/**
* Common Functions
*
* @package Wpos Analytic
* @since 1.0
*/
if ( !defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Retrieve the translation of $text.
*
* @package Wpos Analytic
* @since 1.0
*/
function wpos_anylc_text( $text, $echo = false ) {
if( $echo ) {
_e( $text, '' );
} else {
__( $text, '' );
}
}
/**
* Check Multidimention Array
*
* @package Wpos Analytic
* @since 1.0
*/
function wpos_anylc_is_multi_arr( $arr ) {
rsort( $arr );
return isset( $arr[0] ) && is_array( $arr[0] );
}
/**
* Get site unique id
*
* @package Wpos Analytic
* @since 1.0.0
*/
function wpos_anylc_site_uid() {
$site_uid = get_option( 'wpos_anylc_site_uid' );
// Generate new site id if not exist
if( empty( $site_uid ) ) {
$site_url = untrailingslashit( get_bloginfo('wpurl') );
$site_uid = md5( $site_url . SECURE_AUTH_KEY );
update_option( 'wpos_anylc_site_uid', $site_uid );
}
return $site_uid;
}
/**
* Get Optin Data
*
* @package Wpos Analytic
* @since 1.0.0
*/
function wpos_anylc_optin_data( $anylc_pdt = false ) {
// Skip if not admin area
if ( !is_admin() ) {
return false;
}
global $current_user, $wpos_analytics_product;
// Takind some data
$theme_data = wp_get_theme();
$page = isset( $_GET['page'] ) ? $_GET['page'] : false;
// If product is not passed
if( ! $anylc_pdt ) {
$anylc_pdt = !empty( $_GET['wpos_anylc_pdt'] ) ? $_GET['wpos_anylc_pdt'] : '';
$anylc_pdt = ( ! $anylc_pdt && !empty( $_GET['page'] ) ) ? $_GET['page'] : $anylc_pdt;
}
// If a valid product is there
if( $anylc_pdt && !empty( $wpos_analytics_product[ $anylc_pdt ] ) ) {
$analy_product = $wpos_analytics_product[ $anylc_pdt ];
$return_url = add_query_arg( array( 'page' => $page ), admin_url('admin.php') );
$return_url = wp_nonce_url( $return_url, 'wpos_anylc_act' );
// Getting data according to type
if( $analy_product['type'] == 'theme' ) {
$product_name = $theme_data->get( 'Name' );
$product_version = $theme_data->get( 'Version' );
} else {
if( !function_exists('get_plugin_data') ) {
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
}
$plugin_data = get_plugin_data( trailingslashit(WP_PLUGIN_DIR) . $analy_product['file'] );
$product_name = !empty( $plugin_data['Name'] ) ? $plugin_data['Name'] : '';
$product_version = !empty( $plugin_data['Version'] ) ? $plugin_data['Version'] : '';
}
}
$optin_data = array(
'site_url' => untrailingslashit( get_bloginfo('wpurl') ),
'site_name' => get_bloginfo( 'name' ),
'wp_version' => get_bloginfo( 'version' ),
'language' => get_bloginfo( 'language' ),
'is_rtl' => is_rtl() ? 1 : 0,
'php_version' => phpversion(),
'sdk_version' => WPOS_ANYLC_VERSION,
'product_name' => isset( $product_name ) ? $product_name : '',
'product_version' => isset( $product_version ) ? $product_version : '',
'product_id' => !empty( $analy_product['id'] ) ? $analy_product['id'] : 0,
'product_type' => !empty( $analy_product['type'] ) ? $analy_product['type'] : '',
'theme_name' => $theme_data->get( 'Name' ),
'theme_uri' => $theme_data->get( 'ThemeURI' ),
'theme_author' => $theme_data->get( 'Author' ),
'theme_author_uri' => $theme_data->get( 'AuthorURI' ),
'theme_version' => $theme_data->get( 'Version' ),
'user_firstname' => $current_user->user_firstname,
'user_lastname' => $current_user->user_lastname,
'user_nickname' => $current_user->user_nicename,
'user_email' => get_bloginfo( 'admin_email' ),
'ip_address' => wpos_anylc_get_ip_address(),
'site_uid' => wpos_anylc_site_uid(),
'return_url' => !empty( $return_url ) ? $return_url : '',
);
return $optin_data;
}
/**
* Get IP Address
*
* @package Wpos Analytic
* @since 1.0.0
*/
function wpos_anylc_get_ip_address() {
if ( isset( $_SERVER['HTTP_X_REAL_IP'] ) ) { // WPCS: input var ok, CSRF ok.
return sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_REAL_IP'] ) ); // WPCS: input var ok, CSRF ok.
} elseif ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { // WPCS: input var ok, CSRF ok.
// Proxy servers can send through this header like this: X-Forwarded-For: client1, proxy1, proxy2
// Make sure we always only send through the first IP in the list which should always be the client IP.
return (string) rest_is_ip_address( trim( current( preg_split( '/[,:]/', sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) ) ) ) ); // WPCS: input var ok, CSRF ok.
} elseif ( isset( $_SERVER['REMOTE_ADDR'] ) ) { // @codingStandardsIgnoreLine
return sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ); // @codingStandardsIgnoreLine
}
return '127.0.0.1';
}
/**
* Get Product Optin Data
*
* @package Wpos Analytic
* @since 1.0.0
*/
function wpos_anylc_get_option( $key = '' ) {
$opt_in_data = array();
if( !empty( $key ) ) {
$opt_in_data = get_option( $key );
$opt_in_data = ( !empty($opt_in_data) && is_array($opt_in_data) ) ? $opt_in_data : array();
}
return $opt_in_data;
}
/**
* Get Product Optin Data
*
* @package Wpos Analytic
* @since 1.0.0
*/
function wpos_anylc_update_option( $key = '', $data = array() ) {
$opt_in_data = array();
if( !empty( $key ) ) {
$opt_in_data = wpos_anylc_get_option( $key );
if( is_array($data) ) {
$opt_in_data = array_merge( $opt_in_data, $data );
update_option( $key, $opt_in_data );
}
}
return $opt_in_data;
}
/**
* Get Analytic Product Optin URL
*
* @package Wpos Analytic
* @since 1.0.0
*/
function wpos_anylc_optin_url( $module_data = '', $optin_status = null ) {
$optin_url = false;
// Optin Status
if( ! isset( $optin_status ) ) {
$opt_in_data = get_option( $module_data['anylc_optin'] );
$optin_status = isset( $opt_in_data['status'] ) ? $opt_in_data['status'] : null;
}
if( !empty( $module_data['menu'] ) && !empty( $module_data['slug'] ) ) {
$url_data = parse_url( $module_data['menu'], PHP_URL_QUERY );
$query_data = !empty( $url_data ) ? parse_str( $url_data, $query_arr ) : array();
if( !empty( $query_arr['post_type'] ) && $optin_status >= 0 ) { // If Optin is done and post type menu
$optin_url = add_query_arg( array( 'post_type' => $query_arr['post_type'], 'page' => $module_data['slug'], 'anylc_optin_menu' => true ), admin_url('edit.php') );
} else if( empty( $query_arr['post_type'] ) && $optin_status >= 0 ) { // If Optin is done and simple admin menu
$optin_url = add_query_arg( array( 'page' => $module_data['slug'], 'anylc_optin_menu' => true ), admin_url('admin.php') );
} else {
$optin_url = add_query_arg( array( 'page' => $module_data['slug'] ), admin_url('admin.php') );
}
}
return $optin_url;
}
/**
* Get Analytic Product Opt Out URL
*
* @package Wpos Analytic
* @since 1.0.0
*/
function wpos_anylc_optout_url( $module_data = '', $optin_status = null, $redirect_url = false ) {
$opt_out_link = false;
// Optin Status
if( !isset( $optin_status ) ) {
$opt_in_data = get_option( $module_data['anylc_optin'] );
$optin_status = isset( $opt_in_data['status'] ) ? $opt_in_data['status'] : null;
}
if( $optin_status == 1 ) {
if( ! $redirect_url ) {
$plugin_status = isset( $_GET['plugin_status'] ) ? $_GET['plugin_status'] : false;
$paged = isset( $_GET['paged'] ) ? $_GET['paged'] : false;
$s = isset( $_GET['s'] ) ? $_GET['s'] : false;
$redirect_url = add_query_arg( array( 'plugin_status' => $plugin_status, 'paged' => $paged, 's' => $s ), admin_url( 'plugins.php' ) );
}
$opt_out_link = add_query_arg( array( 'wpos_anylc_action' => 'optout', 'wpos_anylc_pdt' => $module_data['slug'], 'redirect' => $redirect_url ), $redirect_url );
$opt_out_link = wp_nonce_url( $opt_out_link, 'wpos_anylc_act'.'|'.$module_data['slug'] );
}
return $opt_out_link;
}
/**
* Get Analytic Product URL
*
* @package Wpos Analytic
* @since 1.0.0
*/
function wpos_anylc_pdt_url( $module_data = '', $type = false ) {
$redirect_url = false;
if( !empty( $module_data['menu'] ) ) {
$pos = strpos( $module_data['menu'], '?post_type' );
$redirect_url = ( $pos !== false ) ? admin_url( $module_data['menu'] ) : add_query_arg( array( 'page' => $module_data['menu'] ), admin_url('admin.php') );
switch ( $type ) {
case 'promotion':
$promotion = !empty( $_GET['promotion'] ) ? $_GET['promotion'] : '';
if( !empty( $promotion ) ) {
$promotion = is_array( $promotion ) ? implode( ',', $promotion ) : $promotion;
$redirect_url = add_query_arg( array( 'message' => 'wpos_anylc_promotion', 'wpos_anylc_pdt' => $module_data['slug'], 'wpos_anylc_promo_pdt' => $promotion ), $redirect_url );
}
break;
case 'offer':
if( !empty( $module_data['offers'] ) ) {
$redirect_url = add_query_arg( array( 'page' => $module_data['slug'].'-offers' ), $redirect_url );
}
break;
case 'offer-promotion':
$promotion = !empty( $_GET['promotion'] ) ? $_GET['promotion'] : '';
if( !empty( $module_data['offers'] ) ) {
$redirect_url = add_query_arg( array( 'page' => $module_data['slug'].'-offers' ), $redirect_url );
}
if( !empty( $promotion ) ) {
$promotion = is_array( $promotion ) ? implode( ',', $promotion ) : $promotion;
$redirect_url = add_query_arg( array( 'message' => 'wpos_anylc_promotion', 'wpos_anylc_pdt' => $module_data['slug'], 'wpos_anylc_promo_pdt' => $promotion ), $redirect_url );
}
break;
}
}
return $redirect_url;
}
\ No newline at end of file
<?php
/**
* Settings Page
*
* @package Wpos Analytic
* @since 1.0.0
*/
if ( !defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<style type="text/css">
.notice, .error, div.fs-notice.updated, div.fs-notice.success, div.fs-notice.promotion{display:none !important;}
</style>
<div class="wrap wpos-anylc-optin">
<?php if( isset($_GET['error']) && $_GET['error'] == 'wpos_anylc_error' ) { ?>
<div class="error">
<p><strong>Sorry, Something happened wrong. Please contact us on <a href="mailto:support@wponlinesupport.com">support@wponlinesupport.com</a></strong></p>
</div>
<?php } ?>
<form method="POST" action="http://analytics.wponlinesupport.com">
<div class="wpos-anylc-optin-wrap">
<div class="wpos-anylc-optin-icon-wrap">
<div class="wpos-anylc-optin-icon wpos-anylc-wp-badge"><i class="dashicons dashicons-wordpress"></i></div>
<div class="wpos-anylc-optin-plus"><i class="dashicons dashicons-plus"></i></div>
<div class="wpos-anylc-optin-icon"><img src="<?php echo $analy_product['icon']; ?>" alt="Icon" /></div>
<div class="wpos-anylc-optin-plus"><i class="dashicons dashicons-plus"></i></div>
<div class="wpos-anylc-optin-icon"><img src="<?php echo $analy_product['brand_icon']; ?>" alt="Icon" /></div>
</div>
<div class="wpos-anylc-optin-cnt">
<p>Hey <?php echo ucfirst($user_name); ?>,</p>
<p>Don't ever miss an opportunity to <b>opt in</b> for Email Notifications / Announcements about exciting New Features and Update Releases.</p>
<p>Contribute in helping us making <b><?php echo $product_name; ?></b> compatible with most themes and plugins by allowing to share non-sensitive data to <a target="_blank" href="https://www.wponlinesupport.com">wponlinesupport.com</a> about your website.</p>
<p>If you skip this, that's okay! <b><?php echo $product_name; ?></b> will still work just fine.</p>
<div class="wpos-anylc-subs-wrap">
<input type="hidden" name="subscribe" value="" />
<label><input type="checkbox" value="1" name="subscribe" checked="checked" /> Subscribe for Updates and Promotions</label>
</div>
<?php if( !empty( $analy_product['promotion'] ) ) { ?>
<div class="wpos-anylc-promotion-wrap">
<?php foreach( $analy_product['promotion'] as $promotion_key => $promotion_data ) { ?>
<div><label><input type="checkbox" value="<?php echo $promotion_key; ?>" name="promotion[]" checked="checked" /> <?php echo $promotion_data['name']; ?></label></div>
<?php } ?>
</div>
<?php } ?>
</div>
<div class="wpos-anylc-optin-action wpos-anylc-clearfix">
<button type="submit" name="wpos_anylc_optin" class="button button-primary button-large right wpos-anylc-allow-btn" value="wpos_anylc_optin">Allow and Continue</button>
<?php if( is_null( $opt_in ) ) { ?>
<a href="<?php echo esc_url( $skip_url ); ?>" class="button button-secondary button-large wpos-anylc-skip-btn">Skip</a>
<?php }
if( !empty( $optin_form_data ) ) {
foreach ($optin_form_data as $data_key => $data_value) {
echo '<input type="hidden" name="'.esc_attr( $data_key ).'" value="'.esc_attr( $data_value ).'" />';
}
}
?>
</div>
<div class="wpos-anylc-optin-permission">
<a class="wpos-anylc-permission-toggle" href="javascript:void(0);">What permissions are being granted?</a>
<div class="wpos-anylc-permission-wrap wpos-anylc-hide">
<div class="wpos-anylc-permission">
<i class="dashicons dashicons-admin-users"></i>
<div>
<span class="wpos-anylc-permission-name">Your Profile Overview</span>
<span class="wpos-anylc-permission-info">Name and email address</span>
</div>
</div>
<div class="wpos-anylc-permission">
<i class="dashicons dashicons-admin-settings"></i>
<div>
<span class="wpos-anylc-permission-name">Your Site Overview</span>
<span class="wpos-anylc-permission-info">Site URL, WP version, PHP info & Theme</span>
</div>
</div>
<div class="wpos-anylc-permission">
<i class="dashicons dashicons-admin-plugins"></i>
<div>
<span class="wpos-anylc-permission-name">Current Plugin Events</span>
<span class="wpos-anylc-permission-info">Activation, Deactivation and Uninstall</span>
</div>
</div>
</div>
</div>
<div class="wpos-anylc-terms">
<a href="https://www.wponlinesupport.com/privacy-policy/" target="_blank">Privacy Policy</a> - <a href="https://www.wponlinesupport.com/term-and-condition/" target="_blank">Terms of Service</a>
</div>
</div>
</form>
</div><!-- end .wrap -->
\ No newline at end of file
<?php
/**
* Offers Page
*
* @package Wpos Analytic
* @since 1.0.0
*/
if ( !defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<style type="text/css">
.notice, .error, div.fs-notice.updated, div.fs-notice.success, div.fs-notice.promotion{display:none !important;}
</style>
<div class="wrap wpos-anylc-offers">
<?php foreach ($analy_product['offers'] as $offer_key => $offer_data) {
// If status wise offer is there
if( wpos_anylc_is_multi_arr( $offer_data ) ) {
$offer_data = isset( $offer_data[ $opt_in ] ) ? $offer_data[ $opt_in ] : false;
}
if( empty( $offer_data ) ) {
continue;
}
$has_offer = true;
$link = isset( $offer_data['link'] ) ? $offer_data['link'] : '';
$image = !empty( $offer_data['image'] ) ? add_query_arg( array('v' => time()), $offer_data['image'] ) : '';
?>
<div class="wpos-anylc-offer-wrap">
<?php if( !empty( $offer_data['name'] ) ) { ?>
<div class="wpos-anylc-offer-title wpos-anylc-center"><?php echo $offer_data['name']; ?></div>
<?php } ?>
<?php if( $image ) { ?>
<div class="wpos-anylc-offer-body wpos-anylc-center">
<?php if( $link ) { ?>
<a href="<?php echo esc_url( $link ); ?>" target="_blank">
<img src="<?php echo esc_url( $image ); ?>" alt="" />
</a>
<?php } else { ?>
<img src="<?php echo esc_url( $image ); ?>" alt="" />
<?php } ?>
</div>
<?php } ?>
<?php if( !empty( $offer_data['desc'] ) ) { ?>
<div class="wpos-anylc-offer-desc wpos-anylc-center"><?php echo wpautop( $offer_data['desc'] ); ?></div>
<?php } ?>
<?php if( !empty( $offer_data['button'] ) ) { ?>
<div class="wpos-anylc-offer-footer wpos-anylc-center"><a href="<?php echo esc_url( $link ); ?>" class="button button-primary button-large wpos-anylc-btn" target="_blank"><?php echo $offer_data['button']; ?></a></div>
<?php } ?>
</div>
<?php } // End of foreach
// If no offer to display then redirect to main plugin screen
if( empty( $has_offer ) ) {
$redirect_url = wpos_anylc_pdt_url( $analy_product ); // Redirect URL
?>
Please Wait... Redirecting to plugin screen. <a href="<?php echo $redirect_url; ?>">Click Here</a> in case you are not auto redirect.
<script type="text/javascript">
window.location = "<?php echo $redirect_url; ?>";
</script>
<?php } ?>
</div><!-- end .wrap -->
\ No newline at end of file
<?php
/**
* Analytic Optout Popup
*
* @package Wpos Analytic
* @since 1.0
*/
if ( !defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<div class="wpos-anylc-popup wpos-anylc-popup-wrp wpos-anylc-hide" id="wpos-anylc-optout-<?php echo $module['id']; ?>">
<div class="wpos-anylc-popup-inr-wrp">
<div class="wpos-anylc-popup-block">
<div class="wpos-anylc-popup-header">Opt Out</div>
<div class="wpos-anylc-popup-body">
<p class="wpos-anylc-popup-heading">We appreciate your help to make the plugin better by letting us track some usage data.</p>
<p>Usage tracking is done in the name of making <b><?php echo $module['name']; ?></b> better. Making a better user experience, prioritizing new features, and more good things. We'd really appreciate if you'll reconsider letting us continue with the tracking.</p>
<p>By clicking "Opt Out", we will no longer be sending any data from <b><?php echo $module['name']; ?></b> to <a href="https://www.wponlinesupport.com/" target="_blank">wponlinesupport.com</a>.</p>
</div>
<div class="wpos-anylc-popup-footer">
<a href="<?php echo esc_url( $opt_out_link ); ?>" class="button button-secondary">Opt Out</a>
<button type="button" class="button button-primary wpos-anylc-popup-close">Sure, Let Me Continue Helping</button>
</div>
</div><!-- end .wpos-anylc-popup-block -->
</div><!-- end .wpos-anylc-popup-inr-wrp -->
</div><!-- end .wpos-anylc-popup-wrp -->
<div class="wpos-anylc-popup-overlay" id="wpos-anylc-optout-overlay-<?php echo $module['id']; ?>"></div>
\ No newline at end of file
<?php
/**
* WPOS Analytics
*
* @author WP Online Support
* @package Wpos Analytic
* @since 1.0
*/
if ( !defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'WPOS_Analytics' ) ) :
/**
* Main Analytics Class By WP Online Support.
*
* @since 1.0
*/
final class WPOS_Analytics {
/**
* @var Instance
* @since 1.0
*/
protected static $instance = null;
/**
* Main Analytics Instance.
*
* Insures that only one instance of Analytics exists in memory at any one time.
* Also prevents needing to define globals all over the place.
*
* @since 1.0
* @uses WPOS_ANYLC::setup_constants() Setup the constants needed.
* @uses WPOS_ANYLC::includes() Include the required files.
* @uses WPOS_ANYLC::wpos_anylc_plugins_loaded() load the language files.
* @see PWPC()
* @return object The one true Analytics
*/
public static function instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Throw error on object clone.
*
* The whole idea of the singleton design pattern is that there is a single object therefore, we don't want the object to be cloned.
*
* @since 1.0
* @access protected
* @return void
*/
public function __clone() {
// Cloning instances of the class is forbidden.
_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'pwpc' ), '1.0' );
}
/**
* Disable unserializing of the class.
*
* @since 1.0
* @access protected
* @return void
*/
public function __wakeup() {
// Unserializing instances of the class is forbidden.
_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'pwpc' ), '1.0' );
}
/**
* Plugin Constructor.
*/
public function __construct() {
$this->setup_constants();
$this->includes();
do_action( 'wpos_anylc_loaded' );
}
/**
* Define constant if not already set.
*
* @param string $name
* @param string|bool $value
*/
public function define( $name, $value ) {
if ( ! defined( $name ) ) {
define( $name, $value );
}
}
/**
* Setup plugin constants. Basic plugin definitions
*
* @access private
* @since 1.0
*/
private function setup_constants() {
$this->define( 'WPOS_ANYLC_VERSION', '1.0' );
$this->define( 'WPOS_ANYLC_DIR', plugin_dir_path( __FILE__ ) );
$this->define( 'WPOS_ANYLC_URL', plugin_dir_url( __FILE__ ) );
}
/**
* Include required files.
*
* @access private
* @since 1.0
*/
private function includes() {
// Functions file
require_once WPOS_ANYLC_DIR .'/includes/wpos-anylc-function.php';
// Script Class
require_once WPOS_ANYLC_DIR .'/includes/class-anylc-script.php';
// Admin Class
require_once WPOS_ANYLC_DIR .'/includes/class-anylc-admin.php';
}
}
/**
*
* The main function responsible for returning the one true Analytics
* Instance to functions everywhere.
*
* Use this function like you would a global variable, except without needing
* to declare the global.
*
* Example: <?php $wpos_anylc = WPOS_ANYLC(); ?>
*
* @since 1.0
* @return object The one true Analytics Instance.
*/
function WPOS_ANYLC() {
return WPOS_Analytics::instance();
}
/**
*
* Initialize Analytics Module
*
* @since 1.0
* @return object The one true Analytics Instance.
*/
function wpos_anylc_init_module( $args = array() ) {
global $wpos_analytics_module, $wpos_analytics_product;
$defaul_args = array(
'id' => null,
'file' => null,
'name' => null,
'slug' => null,
'type' => 'plugin',
'menu' => false,
'icon' => '',
'text_domain' => 'wpos_analytics',
);
$args = wp_parse_args( $args, $defaul_args );
// If required data is not there then simply return
if( empty($args['id']) || empty( $args['file'] ) || empty( $args['slug'] ) ) {
return false;
}
// Additional args
$promotion = array();
$args['dir'] = pathinfo($args['file'], PATHINFO_DIRNAME);
$args['icon'] = empty( $icon ) ? trailingslashit( WP_PLUGIN_URL ).$args['dir'].'/wpos-analytics/assets/images/icon.png' : $args['icon'];
$args['brand_icon'] = plugin_dir_url( __FILE__ ).'assets/images/wpos-logo.png';
$args['anylc_optin'] = 'wpos_anylc_pdt_'.$args['id'];
if( isset( $args['promotion'] ) ) {
foreach ($args['promotion'] as $promotion_key => $promotion_data) {
if( empty( $promotion_data['name'] ) || empty( $promotion_data['file'] ) ) {
continue;
}
$promotion[$promotion_key] = $promotion_data;
}
}
$args['promotion'] = $promotion;
// Taking some variables
$wpos_analytics_module = !empty( $wpos_analytics_module ) ? $wpos_analytics_module : array();
$wpos_analytics_product = !empty( $wpos_analytics_product ) ? $wpos_analytics_product : array();
if( is_array( $wpos_analytics_module ) ) {
$wpos_analytics_module[ $args['file'] ] = $args;
}
if( is_array( $wpos_analytics_product ) ) {
$wpos_analytics_product[ $args['slug'] ] = $args;
}
return $wpos_analytics_module;
}
/**
*
* Function on any plugin deactivation
*
* @since 1.0
* @return object The one true Analytics Instance.
*/
function wpos_anylc_plugin_activation( $plugin, $network_activation ) {
// return if activating from network, or bulk
if ( is_network_admin() ) {
return;
}
global $wpos_analytics_module;
if( isset( $wpos_analytics_module[ $plugin ] ) ) {
$opt_in_data = get_option( $wpos_analytics_module[ $plugin ]['anylc_optin'] );
$optin_status = isset( $opt_in_data['status'] ) ? $opt_in_data['status'] : -1;
if( $optin_status == -1 ) {
$redirect_link = add_query_arg( array('page' => $wpos_analytics_module[ $plugin ]['slug']), admin_url('admin.php') );
update_option( 'wpos_anylc_redirect', $redirect_link );
}
}
}
add_action( 'activated_plugin', 'wpos_anylc_plugin_activation', 10, 2 );
/**
*
* Initialize Analytics Class Once all stuff has been loaded
*
* @since 1.0
* @return object The one true Analytics Instance.
*/
function wpos_anylc_plugins_loaded() {
// Get Analytics Running.
WPOS_ANYLC();
}
add_action( 'plugins_loaded', 'wpos_anylc_plugins_loaded', 12 );
endif; // End if class_exists check.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment