From c67cfaebf6489332eb9a7ffa8264527d5c8bf70b Mon Sep 17 00:00:00 2001 From: Rushi Date: Wed, 4 Apr 2018 11:43:07 +0530 Subject: [PATCH 1/6] Read me file updated --- README.md | 24 ++++++++++++++++++++++-- readme.txt | 14 ++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 670c9e2..2bb9c60 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,11 @@ The selected custom template will replace default LearnDash course template for ## Description ## -This plugin will help you replace default LearnDash course template for non-enrolled students with a custom template. You can design the custom template with any page builder of your choice. +To convert more visitors into students, you need a real sales page for your LearnDash courses. However, most sites just use the default LeanDash page that is not very friendly for conversions. That is because, making a custom sales page is difficult and requires a ton of custom development. But not anymore! -Convert the default LearnDash course template that appears for non enrolled students into a custom designed, sales or landing page. +Now with this plugin, you will be able to design your own conversion friendly, custom sales page for your courses with any page builder. The page will be displayed to only non enrolled students, who have not bought the course. + +In nutshell, transform the default LearnDash course template that appears for non enrolled students into a custom designed, sales or landing page and convert more visitors into students! ## Installation ## @@ -31,6 +33,24 @@ Convert the default LearnDash course template that appears for non enrolled stud This plugin currently works best with the Astra Theme. +## Screenshots ## + +### 1. Add a new Custom Template. ### +![Add a new Custom Template.](http://ps.w.org/custom-template-for-learndash/assets/screenshot-1.png) + +### 2. Create Template with Any Page Builder of your choice! ### +![Create Template with Any Page Builder of your choice!](http://ps.w.org/custom-template-for-learndash/assets/screenshot-2.png) + +### 3. Select the Template for courses. ### +![Select the Template for courses.](http://ps.w.org/custom-template-for-learndash/assets/screenshot-3.png) + +### 4. Selected Template for non - enrolled students. ### +![Selected Template for non - enrolled students.](http://ps.w.org/custom-template-for-learndash/assets/screenshot-4.png) + +### 5. For enrolled students, the normal course page appears. ### +![For enrolled students, the normal course page appears.](http://ps.w.org/custom-template-for-learndash/assets/screenshot-5.png) + + ## Changelog ## ### 1.0.1 ### diff --git a/readme.txt b/readme.txt index 179deae..3f109e5 100644 --- a/readme.txt +++ b/readme.txt @@ -13,9 +13,11 @@ The selected custom template will replace default LearnDash course template for == Description == -This plugin will help you replace default LearnDash course template for non-enrolled students with a custom template. You can design the custom template with any page builder of your choice. +To convert more visitors into students, you need a real sales page for your LearnDash courses. However, most sites just use the default LeanDash page that is not very friendly for conversions. That is because, making a custom sales page is difficult and requires a ton of custom development. But not anymore! -Convert the default LearnDash course template that appears for non enrolled students into a custom designed, sales or landing page. +Now with this plugin, you will be able to design your own conversion friendly, custom sales page for your courses with any page builder. The page will be displayed to only non enrolled students, who have not bought the course. + +In nutshell, transform the default LearnDash course template that appears for non enrolled students into a custom designed, sales or landing page and convert more visitors into students! == Installation == @@ -31,6 +33,14 @@ Convert the default LearnDash course template that appears for non enrolled stud This plugin currently works best with the Astra Theme. +== Screenshots == + +1. Add a new Custom Template. +2. Create Template with Any Page Builder of your choice! +3. Select the Template for courses. +4. Selected Template for non - enrolled students. +5. For enrolled students, the normal course page appears. + == Changelog == = 1.0.1 = From c86ed646400870f5c3c36a9a451f2df0003daa0c Mon Sep 17 00:00:00 2001 From: Rushi Date: Wed, 4 Apr 2018 12:51:55 +0530 Subject: [PATCH 2/6] Fixed: If Custom tempate is not selected then gets fatal error --- classes/class-ctlearndash.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/classes/class-ctlearndash.php b/classes/class-ctlearndash.php index d54c64f..7d84fc6 100644 --- a/classes/class-ctlearndash.php +++ b/classes/class-ctlearndash.php @@ -284,14 +284,13 @@ public function override_template_include() { */ public function render( $content ) { - $content = '
'; $template = get_course_meta_setting( get_the_id(), 'learndash_course_template' ); - - if ( $template ) { + if ( 'none' != $template ) { + $content = '
'; $content .= $this->get_action_content( $template ); + $content .= '
'; } - $content .= '
'; return $content; } From 69b3c29cde8082eba8d8664d8e53a8f25c409097 Mon Sep 17 00:00:00 2001 From: Rushi Date: Wed, 4 Apr 2018 13:55:59 +0530 Subject: [PATCH 3/6] Version 1.0.2 bumped --- README.md | 7 +++++-- custom-template-learndash.php | 4 ++-- languages/custom-template-learndash.pot | 4 ++-- package.json | 2 +- readme.txt | 7 +++++-- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2bb9c60..c625205 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ **Tags:** liftlms, course, page-buider, beaver builder, elementor, visual composer **Requires at least:** 4.4 **Requires PHP:** 5.3 -**Tested up to:** 4.9.4 -**Stable tag:** 1.0.1 +**Tested up to:** 4.9.5 +**Stable tag:** 1.0.2 **License:** GPLv2 or later **License URI:** https://www.gnu.org/licenses/gpl-2.0.html @@ -53,6 +53,9 @@ This plugin currently works best with the '; $content .= $this->get_action_content( $template ); $content .= ''; From 3c3151106bfcd9d9a67ce0f0b8523ae35f562c9d Mon Sep 17 00:00:00 2001 From: Rushi Date: Wed, 4 Apr 2018 18:33:56 +0530 Subject: [PATCH 5/6] Flush rewrite rule after plugin is activated --- admin/class-ctlearndash-admin.php | 17 ++++++++--------- classes/class-ctlearndash-loader.php | 1 - custom-template-learndash.php | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/admin/class-ctlearndash-admin.php b/admin/class-ctlearndash-admin.php index e107c04..7f0986e 100644 --- a/admin/class-ctlearndash-admin.php +++ b/admin/class-ctlearndash-admin.php @@ -43,8 +43,7 @@ public static function get_instance() { public function __construct() { // Activation hook. - register_activation_hook( CTLEARNDASH_FILE, array( $this, 'rewrite_rules' ) ); - register_deactivation_hook( CTLEARNDASH_FILE, 'flush_rewrite_rules' ); + add_action( 'admin_init',array( $this, 'ctlearndash_initialize' ) ); add_action( 'parent_file', array( $this, 'remove_unwanted_tabs' ) ); add_action( 'init', array( $this, 'learndash_course_landing_page_post_type' ) ); @@ -116,18 +115,18 @@ public function help_meta_box_callback() { ); } + /** - * Reset write rules. + * Reset write rules when plugin is activated. * * @since 1.0.2 * @return void */ - public function rewrite_rules() { - - $this->learndash_course_landing_page_post_type(); - - // flush rewrite rules. - flush_rewrite_rules(); + public function ctlearndash_initialize() { + if( is_admin() && get_option( 'ctlearndash_activation' ) == 'is-activated' ) { + delete_option( 'ctlearndash_activation' ); + flush_rewrite_rules(); + } } /** diff --git a/classes/class-ctlearndash-loader.php b/classes/class-ctlearndash-loader.php index 5d8000d..4aa7f44 100644 --- a/classes/class-ctlearndash-loader.php +++ b/classes/class-ctlearndash-loader.php @@ -62,4 +62,3 @@ private function includes() { } add_action( 'plugins_loaded', 'CTLearnDash_Loader::get_instance' ); - diff --git a/custom-template-learndash.php b/custom-template-learndash.php index 27adfe5..6b591db 100644 --- a/custom-template-learndash.php +++ b/custom-template-learndash.php @@ -12,6 +12,19 @@ * @package Custom Template for LearnDash */ +// Set Option to flush the rewrite rule after activation of plugin. +register_activation_hook( __FILE__, 'ctlearndash_activation' ); + +/** + * Set option that states plugin is activated. + * + * @since 1.0.2 + * @return void + */ +function ctlearndash_activation() { + add_option( 'ctlearndash_activation','is-activated' ); +} + define( 'CTLEARNDASH_VER', '1.0.2' ); define( 'CTLEARNDASH_FILE', __FILE__ ); define( 'CTLEARNDASH_DIR', plugin_dir_path( __FILE__ ) ); @@ -19,3 +32,4 @@ define( 'CTLEARNDASH_PATH', plugin_basename( __FILE__ ) ); require_once CTLEARNDASH_DIR . 'classes/class-ctlearndash-loader.php'; + From 0ed7247e2469855639841411e0f523baab9e144e Mon Sep 17 00:00:00 2001 From: Rushi Date: Wed, 4 Apr 2018 18:37:46 +0530 Subject: [PATCH 6/6] Phpcs fixes --- admin/class-ctlearndash-admin.php | 8 ++++---- classes/class-ctlearndash.php | 15 +++++++-------- custom-template-learndash.php | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/admin/class-ctlearndash-admin.php b/admin/class-ctlearndash-admin.php index 7f0986e..027707c 100644 --- a/admin/class-ctlearndash-admin.php +++ b/admin/class-ctlearndash-admin.php @@ -43,7 +43,7 @@ public static function get_instance() { public function __construct() { // Activation hook. - add_action( 'admin_init',array( $this, 'ctlearndash_initialize' ) ); + add_action( 'admin_init', array( $this, 'ctlearndash_initialize' ) ); add_action( 'parent_file', array( $this, 'remove_unwanted_tabs' ) ); add_action( 'init', array( $this, 'learndash_course_landing_page_post_type' ) ); @@ -123,10 +123,10 @@ public function help_meta_box_callback() { * @return void */ public function ctlearndash_initialize() { - if( is_admin() && get_option( 'ctlearndash_activation' ) == 'is-activated' ) { + if ( is_admin() && get_option( 'ctlearndash_activation' ) === 'is-activated' ) { delete_option( 'ctlearndash_activation' ); flush_rewrite_rules(); - } + } } /** @@ -320,7 +320,7 @@ public function save_course_landing_page( $post_id ) { update_post_meta( $post_id, 'course_template', $landing_page_id ); } } -} // End if(). +} /** * Kicking this off by calling 'get_instance()' method diff --git a/classes/class-ctlearndash.php b/classes/class-ctlearndash.php index 4727f59..6a7affc 100644 --- a/classes/class-ctlearndash.php +++ b/classes/class-ctlearndash.php @@ -86,7 +86,7 @@ public function astra_page_layout( $sidebar ) { $template = self::get_template(); - if ( 'none' != $template && $template ) { + if ( 'none' !== $template && $template ) { $template_sidebar = get_post_meta( $template, 'site-sidebar-layout', true ); if ( ! empty( $template_sidebar ) && 'default' !== $template_sidebar ) { $sidebar = $template_sidebar; @@ -105,7 +105,7 @@ public function astra_page_layout( $sidebar ) { public function content_layout( $layout ) { $template = self::get_template(); - if ( 'none' != $template && $template ) { + if ( 'none' !== $template && $template ) { $template_layout = get_post_meta( $template, 'site-content-layout', true ); if ( ! empty( $template_layout ) && 'default' !== $template_layout ) { $layout = $template_layout; @@ -124,7 +124,7 @@ public function content_layout( $layout ) { public function page_title( $status ) { $template = self::get_template(); - if ( 'none' != $template && $template ) { + if ( 'none' !== $template && $template ) { $template_status = get_post_meta( $template, 'site-post-title', true ); if ( ! empty( $template_status ) ) { $status = ( 'disabled' === $template_status ) ? false : true; @@ -143,7 +143,7 @@ public function page_title( $status ) { public function featured_image( $status ) { $template = self::get_template(); - if ( 'none' != $template && $template && is_singular() ) { + if ( 'none' !== $template && $template && is_singular() ) { $template_status = get_post_meta( $template, 'ast-featured-img', true ); if ( ! empty( $template_status ) ) { $status = ( 'disabled' === $template_status ) ? false : true; @@ -200,7 +200,7 @@ public function enqueue_scripts() { } $template = get_course_meta_setting( get_the_id(), 'learndash_course_template' ); - if ( 'none' != $template && $template ) { + if ( 'none' !== $template && $template ) { if ( class_exists( '\Elementor\Post_CSS_File' ) ) { if ( self::is_elementor_activated( $template ) ) { @@ -287,13 +287,12 @@ public function override_template_include() { public function render( $content ) { $template = get_course_meta_setting( get_the_id(), 'learndash_course_template' ); - if ( 'none' != $template && $template ) { - $content = '
'; + if ( 'none' !== $template && $template ) { + $content = '
'; $content .= $this->get_action_content( $template ); $content .= '
'; } - return $content; } diff --git a/custom-template-learndash.php b/custom-template-learndash.php index 6b591db..29c069a 100644 --- a/custom-template-learndash.php +++ b/custom-template-learndash.php @@ -22,7 +22,7 @@ * @return void */ function ctlearndash_activation() { - add_option( 'ctlearndash_activation','is-activated' ); + add_option( 'ctlearndash_activation', 'is-activated' ); } define( 'CTLEARNDASH_VER', '1.0.2' );