diff --git a/404.php b/404.php index 6d374c0..4625d5a 100644 --- a/404.php +++ b/404.php @@ -8,47 +8,80 @@ */ get_header(); ?> -
+
-

+
+

+ +
- - - - - -
-

-
    +
    +

    'count', - 'order' => 'DESC', - 'show_count' => 1, - 'title_li' => '', - 'number' => 10, - ) ); - ?> -
-
- + $custom_query = new WP_Query( apply_filters( '404_latest_posts_args', array( + 'post_type' => 'post', + 'posts_per_page' => 6, + 'post_status' => 'publish', + 'ignore_sticky_posts' => true + ) ) ); + $count = 0; + if ( $custom_query->have_posts() ) : + echo '
'; + echo '
'; + while ( $custom_query->have_posts() ) : $custom_query->the_post(); + $count++; + ?> +
> +
+ + '; + } + ?> + + term_id ).'">'.$category[0]->cat_name.''; + } + ?> +
+
+
+ ', esc_url( get_permalink() ) ), '' ); ?> + +
- ' . sprintf( esc_html__( 'Try looking in the monthly archives. %1$s', 'codilight-lite' ), convert_smilies( ':)' ) ) . '

'; - the_widget( 'WP_Widget_Archives', 'dropdown=1', "after_title=$archive_content" ); - ?> - - +
+ +
+
+
+ '; + echo '
'; + } + endwhile; + echo '
'; + echo '
'; + endif; + wp_reset_postdata(); // reset the query + ?> +
diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..755a48c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +==================================================================== +CHANGELOG +==================================================================== + +## 1.0.1 +* Add more widgets and blocks. +* Add editor style +* Add layout and sidebar settings to customizer. +* Update theme screenshot. + +## 1.0.0 +* Initial release diff --git a/README.md b/README.md index 42171a1..e91aacc 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,58 @@ -[![Build Status](https://travis-ci.org/Automattic/_s.svg?branch=master)](https://travis-ci.org/Automattic/_s) -_s -=== -Hi. I'm a starter theme called `_s`, or `underscores`, if you like. I'm a theme meant for hacking so don't use me as a Parent Theme. Instead try turning me into the next, most awesome, WordPress theme out there. That's what I'm here for. +Thank you for downloading our theme! -My ultra-minimal CSS might make me look like theme tartare but that means less stuff to get in your way when you're designing your awesome theme. Here are some of the other more interesting things you'll find here: -* A just right amount of lean, well-commented, modern, HTML5 templates. -* A helpful 404 template. -* A sample custom header implementation in `inc/custom-header.php` that can be activated by uncommenting one line in `functions.php` and adding the code snippet found in the comments of `inc/custom-header.php` to your `header.php` template. -* Custom template tags in `inc/template-tags.php` that keep your templates clean and neat and prevent code duplication. -* Some small tweaks in `inc/extras.php` that can improve your theming experience. -* A script at `js/navigation.js` that makes your menu a toggled dropdown on small screens (like your phone), ready for CSS artistry. It's enqueued in `functions.php`. -* 2 sample CSS layouts in `layouts/` for a sidebar on either side of your content. -* Smartly organized starter CSS in `style.css` that will help you to quickly get your design off the ground. -* Licensed under GPLv2 or later. :) Use it to make something cool. +==================================================================== +Description +==================================================================== +Codilight Lite is a news magazine style WordPress theme from FameThemes which is a perfect option to create any kind of +magazine or blog websites. -Getting Started ---------------- +==================================================================== +SUPPORT +==================================================================== +Support for this WordPress theme is conducted through the WordPress free theme support forum. +* FameThemes Website : http://www.famethemes.com +* Support Ticket: http://www.famethemes.com/dashboard/tickets/ +* Support Forum for free theme: https://wordpress.org/support/theme/codilight-lite -If you want to keep it simple, head over to http://underscores.me and generate your `_s` based theme from there. You just input the name of the theme you want to create, click the "Generate" button, and you get your ready-to-awesomize starter theme. +==================================================================== +DOCUMENTATION +==================================================================== -If you want to set things up manually, download `_s` from GitHub. The first thing you want to do is copy the `_s` directory and change the name to something else (like, say, `megatherium`), and then you'll need to do a five-step find and replace on the name in all the templates. +Go to http://docs.famethemes.com/category/30-codilight-lite for theme documentation & troubleshooting guides. -1. Search for `'_s'` (inside single quotations) to capture the text domain. -2. Search for `_s_` to capture all the function names. -3. Search for `Text Domain: _s` in style.css. -4. Search for  _s (with a space before it) to capture DocBlocks. -5. Search for `_s-` to capture prefixed handles. +==================================================================== +LICENSES +==================================================================== -OR +* Underscores +Based on Underscores http://underscores.me/, (C) 2012-2015 Automattic, Inc., [GPLv2 or later](https://www.gnu.org/licenses/gpl-2.0.html) -* Search for: `'_s'` and replace with: `'megatherium'` -* Search for: `_s_` and replace with: `megatherium_` -* Search for: `Text Domain: _s` and replace with: `Text Domain: megatherium` in style.css. -* Search for:  _s and replace with:  Megatherium -* Search for: `_s-` and replace with: `megatherium-` +* Normalize +normalize.css http://necolas.github.io/normalize.css/, (C) 2012-2015 Nicolas Gallagher and Jonathan Neal, [MIT](http://opensource.org/licenses/MIT) -Then, update the stylesheet header in `style.css` and the links in `footer.php` with your own information. Next, update or delete this readme. +* Google Fonts -Now you're ready to go! The next step is easy to say, but harder to do: make an awesome WordPress theme. :) +Source: https://www.google.com/fonts/specimen/Raleway +License: SIL Open Font License, 1.1 - scripts.sil.org/OFL -Good luck! +Source: https://www.google.com/fonts/specimen/Open+Sans +License: SIL Open Font License, 1.1 - scripts.sil.org/OFL + +* FitVids +Source: https://github.com/davatron5000/FitVids.js/blob/master/jquery.fitvids.js +License: Released under the WTFPL license - http://sam.zoy.org/wtfpl/ + +* FontAwesome +Source: https://fortawesome.github.io/Font-Awesome/ +License: GPL - https://fortawesome.github.io/Font-Awesome/license/ + +* Slickjs +Source: https://github.com/kenwheeler/slick +License: MIT: https://github.com/kenwheeler/slick/blob/master/LICENSE + +* Screenshot Images +Pixabay: https://pixabay.com/en/service/terms/ (http://creativecommons.org/publicdomain/zero/1.0 - CC0) +Pexels: https://www.pexels.com/photo-license/ (http://creativecommons.org/publicdomain/zero/1.0 - CC0) diff --git a/archive.php b/archive.php index ba62975..ec62e00 100644 --- a/archive.php +++ b/archive.php @@ -8,12 +8,13 @@ */ get_header(); ?> -
+
+ + + diff --git a/comments.php b/comments.php index 2d33217..89f1ee5 100644 --- a/comments.php +++ b/comments.php @@ -25,12 +25,11 @@ -

+

' . get_the_title() . '' + esc_html( _nx( '1 Comment', '%1$s comments', get_comments_number(), 'comments title', 'codilight-lite' ) ), + number_format_i18n( get_comments_number() ) ); ?>

diff --git a/footer.php b/footer.php index 31534e0..ecbcae3 100644 --- a/footer.php +++ b/footer.php @@ -8,7 +8,6 @@ * * @package Codilight_Lite */ - ?>
@@ -21,12 +20,20 @@
diff --git a/functions.php b/functions.php index 78fd32b..1c880c8 100644 --- a/functions.php +++ b/functions.php @@ -41,13 +41,15 @@ function codilight_lite_setup() { * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); + add_image_size( 'block_small', 90, 60, true ); // Archive List Posts add_image_size( 'block_1_medium', 250, 170, true ); // Archive List Posts add_image_size( 'block_2_medium', 325, 170, true ); // Archive Grid Posts - add_image_size( 'single_medium', 700, 9999, true ); // Archive Grid Posts + add_image_size( 'single_medium', 700, 350, true ); // Archive Grid Posts // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary Menu', 'codilight-lite' ), + 'footer' => esc_html__( 'Footer Menu', 'codilight-lite' ) ) ); /* @@ -64,9 +66,15 @@ function codilight_lite_setup() { // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'codilight_lite_custom_background_args', array( - 'default-color' => 'ffffff', + 'default-color' => 'f9f9f9', 'default-image' => '', ) ) ); + + /* + * This theme styles the visual editor to resemble the theme style. + */ + add_editor_style( array( 'assets/css/editor-style.css', codilight_lite_fonts_url() ) ); + } endif; // codilight_lite_setup add_action( 'after_setup_theme', 'codilight_lite_setup' ); @@ -79,7 +87,7 @@ function codilight_lite_setup() { * @global int $content_width */ function codilight_lite_content_width() { - $GLOBALS['content_width'] = apply_filters( 'codilight_lite_content_width', 640 ); + $GLOBALS['content_width'] = apply_filters( 'codilight_lite_content_width', 700 ); } add_action( 'after_setup_theme', 'codilight_lite_content_width', 0 ); @@ -90,14 +98,53 @@ function codilight_lite_content_width() { */ function codilight_lite_widgets_init() { register_sidebar( array( - 'name' => esc_html__( 'Sidebar', 'codilight-lite' ), + 'name' => esc_html__( 'Default Sidebar', 'codilight-lite' ), 'id' => 'sidebar-1', 'description' => '', 'before_widget' => '', - 'before_title' => '

', - 'after_title' => '

', + 'before_title' => '

', + 'after_title' => '

', + ) ); + + // Homepage Template + register_sidebar( array( + 'name' => esc_html__( 'Home 1', 'codilight-lite' ), + 'id' => 'home-1', + 'description' => '', + 'before_widget' => '', + 'before_title' => '

', + 'after_title' => '

', + ) ); + register_sidebar( array( + 'name' => esc_html__( 'Home 2', 'codilight-lite' ), + 'id' => 'home-2', + 'description' => '', + 'before_widget' => '', + 'before_title' => '

', + 'after_title' => '

', + ) ); + register_sidebar( array( + 'name' => esc_html__( 'Home 3', 'codilight-lite' ), + 'id' => 'home-3', + 'description' => '', + 'before_widget' => '', + 'before_title' => '

', + 'after_title' => '

', + ) ); + register_sidebar( array( + 'name' => esc_html__( 'Home 4', 'codilight-lite' ), + 'id' => 'home-4', + 'description' => '', + 'before_widget' => '', + 'before_title' => '

', + 'after_title' => '

', ) ); + } add_action( 'widgets_init', 'codilight_lite_widgets_init' ); @@ -114,6 +161,7 @@ function codilight_lite_scripts() { // Scripts wp_enqueue_script( 'jquery' ); + wp_enqueue_script( 'codilight-lite-libs-js', get_template_directory_uri() . '/assets/js/libs.js', array(), '20120206', true ); wp_enqueue_script( 'codilight-lite-theme-js', get_template_directory_uri() . '/assets/js/theme.js', array(), '20120206', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { @@ -165,6 +213,19 @@ function codilight_lite_fonts_url() { } endif; +if ( ! function_exists( 'codilight_lite_admin_scripts' ) ) : +/** + * Enqueue scripts for admin page only: Theme info page + */ +function codilight_lite_admin_scripts( $hook ) { + if ( $hook === 'widgets.php' || $hook === 'appearance_page_ft_codilight_lite' ) { + wp_enqueue_style('codilight-lite-admin-css', get_template_directory_uri() . '/assets/css/admin.css'); + } +} +endif; +add_action('admin_enqueue_scripts', 'codilight_lite_admin_scripts'); + + /** * Custom template tags for this theme. */ @@ -181,6 +242,14 @@ function codilight_lite_fonts_url() { require get_template_directory() . '/inc/customizer.php'; /** - * Load Jetpack compatibility file. + * Custom theme widgets. + */ +require get_template_directory() . '/inc/widgets/block_1_widget.php'; +require get_template_directory() . '/inc/widgets/block_2_widget.php'; +require get_template_directory() . '/inc/widgets/block_3_widget.php'; +require get_template_directory() . '/inc/widgets/block_4_widget.php'; + +/** + * Add theme info page */ -require get_template_directory() . '/inc/jetpack.php'; +require get_template_directory() . '/inc/dashboard.php'; diff --git a/header.php b/header.php index b3e559b..2d80bd3 100644 --- a/header.php +++ b/header.php @@ -23,7 +23,7 @@ >
- +
@@ -31,34 +31,41 @@ Menu
    - 'primary', 'container' => '', 'items_wrap' => '%3$s' ) ); ?> + 'primary', 'container' => '', 'items_wrap' => '%3$s', 'fallback_cb' => 'codilight_lite_link_to_menu_editor' ) ); ?>
+
+ +
+ + diff --git a/inc/customizer.php b/inc/customizer.php index d6f535a..1079f53 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -16,8 +16,8 @@ function codilight_lite_customize_register( $wp_customize ) { require_once get_template_directory() . '/inc/customizer-controls.php'; // Remove default sections - $wp_customize->remove_section('colors'); - $wp_customize->remove_section('background_image'); + //$wp_customize->remove_section('colors'); + //$wp_customize->remove_section('background_image'); // Remove default control. @@ -26,13 +26,14 @@ function codilight_lite_customize_register( $wp_customize ) { $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; /*------------------------------------------------------------------------*/ - /* Site Identity + /* Site Identity apply_filters('the_title', ' My Custom Title (tm) '); /*------------------------------------------------------------------------*/ $wp_customize->add_setting( 'codilight_lite_site_logo', array( 'sanitize_callback' => 'codilight_lite_sanitize_file_url', - 'default' => esc_url( get_template_directory_uri() . '/assets/images/logo.png' ) + // 'default' => esc_url( get_template_directory_uri() . '/assets/images/logo.png' ) + 'default' => apply_filters('customizer_default_logo', esc_url( get_template_directory_uri() . '/assets/images/logo.png' ) ) ) ); $wp_customize->add_control( new WP_Customize_Image_Control( @@ -47,139 +48,58 @@ function codilight_lite_customize_register( $wp_customize ) { ); /*------------------------------------------------------------------------*/ - /* Site Options + /* Layout /*------------------------------------------------------------------------*/ - $wp_customize->add_panel( 'codilight_lite_options', - array( - 'priority' => 22, - 'capability' => 'edit_theme_options', - 'theme_supports' => '', - 'title' => __( 'Site Options', 'codilight-lite' ), - 'description' => '', - ) - ); - - /* Global Settings - ----------------------------------------------------------------------*/ - $wp_customize->add_section( 'codilight_lite_global_settings' , - array( - 'priority' => 3, - 'title' => __( 'Global', 'codilight-lite' ), - 'description' => '', - 'panel' => 'codilight_lite_options', - ) - ); - - /* Social Settings - ----------------------------------------------------------------------*/ - $wp_customize->add_section( 'codilight_lite_social' , - array( - 'priority' => 6, - 'title' => __( 'Social Profiles', 'codilight-lite' ), - 'description' => '', - 'panel' => 'codilight_lite_options', - ) - ); - - // Order & Stlying - $wp_customize->add_setting( 'codilight_lite_social_footer_guide', - array( - 'sanitize_callback' => 'codilight_lite_sanitize_text' - ) - ); - $wp_customize->add_control( new Codilight_Lite_Misc_Control( $wp_customize, 'codilight_lite_social_footer_guide', - array( - 'section' => 'codilight_lite_social', - 'type' => 'custom_message', - 'description' => __( 'These social profiles setting below will display at the footer of your site.', 'codilight-lite' ) - ) - )); - // Footer Social Title - $wp_customize->add_setting( 'codilight_lite_social_footer_title', - array( - 'sanitize_callback' => 'sanitize_text_field', - 'default' => __( 'Keep Updated', 'codilight-lite' ), - ) - ); - $wp_customize->add_control( 'codilight_lite_social_footer_title', - array( - 'label' => __('Social Footer Title', 'codilight-lite'), - 'section' => 'codilight_lite_social', - 'description' => '' - ) - ); - - // Twitter - $wp_customize->add_setting( 'codilight_lite_social_twitter', - array( - 'sanitize_callback' => 'esc_url', - 'default' => 'https://twitter.com/famethemes', - ) - ); - $wp_customize->add_control( 'codilight_lite_social_twitter', - array( - 'label' => __('Twitter URL', 'codilight-lite'), - 'section' => 'codilight_lite_social', - 'description' => '' - ) - ); - // Facebook - $wp_customize->add_setting( 'codilight_lite_social_facebook', - array( - 'sanitize_callback' => 'esc_url', - 'default' => 'https://www.facebook.com/famethemes/', - ) - ); - $wp_customize->add_control( 'codilight_lite_social_facebook', - array( - 'label' => __('Faecbook URL', 'codilight-lite'), - 'section' => 'codilight_lite_social', - 'description' => '' - ) - ); - // Facebook - $wp_customize->add_setting( 'codilight_lite_social_google', - array( - 'sanitize_callback' => 'esc_url', - 'default' => '#', - ) - ); - $wp_customize->add_control( 'codilight_lite_social_google', - array( - 'label' => __('Google Plus URL', 'codilight-lite'), - 'section' => 'codilight_lite_social', - 'description' => '' - ) - ); - // Instagram - $wp_customize->add_setting( 'codilight_lite_social_instagram', - array( - 'sanitize_callback' => 'esc_url', - 'default' => '#', - ) - ); - $wp_customize->add_control( 'codilight_lite_social_instagram', - array( - 'label' => __('Instagram URL', 'codilight-lite'), - 'section' => 'codilight_lite_social', - 'description' => '' - ) - ); - // RSS - $wp_customize->add_setting( 'codilight_lite_social_rss', - array( - 'sanitize_callback' => 'esc_url', - 'default' => get_bloginfo('rss2_url'), - ) - ); - $wp_customize->add_control( 'codilight_lite_social_rss', - array( - 'label' => __('RSS URL', 'codilight-lite'), - 'section' => 'codilight_lite_social', - 'description' => '' - ) - ); - + $wp_customize->add_section( 'codilight_lite_layout' , + array( + 'priority' => 23, + 'title' => __( 'Site Layout', 'codilight-lite' ), + 'description' => '', + ) + ); + + $wp_customize->add_setting( 'layout_sidebar', array( + 'sanitize_callback' => 'codilight_lite_sanitize_layout_sidebar', + 'default' => 'right', + ) ); + $wp_customize->add_control( 'layout_sidebar', array( + 'label' => esc_html__( 'Default Sidebar Position', 'codilight-lite' ), + 'section' => 'codilight_lite_layout', + 'type' => 'radio', + 'choices' => array( + 'left' => 'Left Sidebar', + 'right' => 'Right Sidebar', + ), + ) ); + + $wp_customize->add_setting( 'layout_frontpage_posts', array( + 'sanitize_callback' => 'codilight_lite_sanitize_layout', + 'default' => 'grid', + ) ); + $wp_customize->add_control( 'layout_frontpage_posts', array( + 'label' => esc_html__( 'Front Page Posts Layout', 'codilight-lite' ), + 'section' => 'codilight_lite_layout', + 'type' => 'radio', + 'choices' => array( + 'list' => 'List', + 'grid' => 'Grid', + ), + ) ); + + $wp_customize->add_setting( 'layout_archive_posts', array( + 'sanitize_callback' => 'codilight_lite_sanitize_layout', + 'default' => 'grid', + ) ); + $wp_customize->add_control( 'layout_archive_posts', array( + 'label' => esc_html__( 'Archive Page Posts Layout', 'codilight-lite' ), + 'section' => 'codilight_lite_layout', + 'type' => 'radio', + 'choices' => array( + 'list' => 'List', + 'grid' => 'Grid', + ), + 'description' => esc_html__( 'Category, Tag, Author, Archive Page ...', 'codilight-lite' ), + ) ); } add_action( 'customize_register', 'codilight_lite_customize_register' ); @@ -202,6 +122,22 @@ function codilight_lite_sanitize_number( $input ) { return force_balance_tags( $input ); } +function codilight_lite_sanitize_layout_sidebar( $layout_sidebar ) { + if ( $layout_sidebar == 'left' ) { + return 'left'; + } else { + return 'right'; + } +} + +function codilight_lite_sanitize_layout( $layout ) { + if ( $layout == 'list' ) { + return 'list'; + } else { + return 'grid'; + } +} + function codilight_lite_sanitize_hex_color( $color ) { if ( $color === '' ) { return ''; diff --git a/inc/customizer_.php b/inc/customizer_.php deleted file mode 100644 index af0d251..0000000 --- a/inc/customizer_.php +++ /dev/null @@ -1,26 +0,0 @@ -get_setting( 'blogname' )->transport = 'postMessage'; - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; - $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; -} -add_action( 'customize_register', 'codilight_lite_customize_register' ); - -/** - * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. - */ -function codilight_lite_customize_preview_js() { - wp_enqueue_script( 'codilight_lite_customizer', get_template_directory_uri() . '/assets/js/customizer.js', array( 'customize-preview' ), '20130508', true ); -} -add_action( 'customize_preview_init', 'codilight_lite_customize_preview_js' ); diff --git a/inc/dashboard.php b/inc/dashboard.php new file mode 100644 index 0000000..713549b --- /dev/null +++ b/inc/dashboard.php @@ -0,0 +1,61 @@ +Name ), sprintf( esc_html__('%s', 'codilight-lite'), $theme_data->Name), 'edit_themes', 'ft_codilight_lite', 'codilight_lite_theme_info_page'); +} + +function codilight_lite_theme_info_page() { + + $theme_data = wp_get_theme(); ?> + +
+

Name, $theme_data->Version ); ?>

+
Patus is a personal blogging theme for WordPress and an effortlessly tool for publishers of all kind, cherished for its flexibility, clean layouts and speed.
+ FameThemes + + +
+
+
+ + + +
+ +
+ Theme Screenshot +
+
+
+ +
+ + diff --git a/inc/extras (kienthuongvus-MacBook-Air's conflicted copy 2015-11-12).php b/inc/extras (kienthuongvus-MacBook-Air's conflicted copy 2015-11-12).php deleted file mode 100644 index 6f4af61..0000000 --- a/inc/extras (kienthuongvus-MacBook-Air's conflicted copy 2015-11-12).php +++ /dev/null @@ -1,37 +0,0 @@ -'. $excerpt .'
'; } +endif; + +if ( ! function_exists( 'codilight_lite_sidebar_position' ) ) : +/** + * The site default sidebar position. + * + * @param string $characters + * @return string + */ +function codilight_lite_sidebar_position(){ + $layout_sidebar = get_theme_mod( 'layout_sidebar', 'right' ); + echo $layout_sidebar . '-sidebar'; +} +endif; + +/** + * Add a count class to category counter number. + * + * @param string $characters + * @return string + */ +add_filter('wp_list_categories', 'codilight_lite_cat_count_inline'); +function codilight_lite_cat_count_inline($links) { + $links = str_replace(' (', '', $links); + $links = str_replace(')', '', $links); + return $links; +} + +if ( ! function_exists( 'codilight_lite_link_to_menu_editor' ) ) : +/** + * Menu fallback. Link to the menu editor if that is useful. + * + * @param array $args + * @return string + */ +function codilight_lite_link_to_menu_editor( $args ) +{ + if ( ! current_user_can( 'manage_options' ) ) + { + return; + } + + // see wp-includes/nav-menu-template.php for available arguments + extract( $args ); + + $link = $link_before + . '
  • ' . $before . 'Add a menu' . $after . '
  • ' + . $link_after; + + // We have a list + if ( FALSE !== stripos( $items_wrap, ' 'main', - 'render' => 'codilight_lite_infinite_scroll_render', - 'footer' => 'page', - ) ); - - // Add theme support for Responsive Videos. - add_theme_support( 'jetpack-responsive-videos' ); -} // end function codilight_lite_jetpack_setup -add_action( 'after_setup_theme', 'codilight_lite_jetpack_setup' ); - -/** - * Custom render function for Infinite Scroll. - */ -function codilight_lite_infinite_scroll_render() { - while ( have_posts() ) { - the_post(); - get_template_part( 'template-parts/content', get_post_format() ); - } -} // end function codilight_lite_infinite_scroll_render diff --git a/inc/template-tags.php b/inc/template-tags.php index 4d4f080..5f07856 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -68,7 +68,8 @@ function codilight_lite_custom_paginate() { 'total' => $total_pages, 'before_page_number' => ''.$translated.' ' )); - echo 'Page '. $current_page .' of '. $total_pages .''; + //echo 'Page '. $current_page .' of '. $total_pages .''; + printf( ''. esc_html__( 'Page %1$s of %2$s', 'codilight-lite' ) .'', $current_page, $total_pages ); echo ''; } } @@ -189,7 +190,7 @@ function codilight_lite_comment( $comment, $args, $depth ) {

    -
    +
    diff --git a/inc/widgets/block_1_widget.php b/inc/widgets/block_1_widget.php new file mode 100644 index 0000000..641821b --- /dev/null +++ b/inc/widgets/block_1_widget.php @@ -0,0 +1,227 @@ + 'block1_widget', 'description' => esc_html__( "Display posts with list or grid style for use on homepage.", 'codilight-lite') ); + parent::__construct('ft_block1', esc_html__('FT Block 1 - Recent Posts', 'codilight-lite'), $widget_ops); + $this->alt_option_name = 'widget_block1'; + + add_action( 'save_post', array($this, 'flush_widget_cache') ); + add_action( 'deleted_post', array($this, 'flush_widget_cache') ); + add_action( 'switch_theme', array($this, 'flush_widget_cache') ); + } + + /** + * @param array $args + * @param array $instance + */ + public function widget( $args, $instance ) { + //extract( $args ); + $cache = array(); + if ( ! $this->is_preview() ) { + $cache = wp_cache_get( 'widget_block1', 'widget' ); + } + if ( ! is_array( $cache ) ) { + $cache = array(); + } + if ( ! isset( $args['widget_id'] ) ) { + $args['widget_id'] = $this->id; + } + if ( isset( $cache[ $args['widget_id'] ] ) ) { + echo $cache[ $args['widget_id'] ]; + return; + } + ob_start(); + + // Get values from the widget settings. + $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : ''; + $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); + $layout = ( ! empty( $instance['layout'] ) ) ? $instance['layout'] : 'grid'; + $featured_categories = ( ! empty( $instance['featured_categories'] ) ) ? $instance['featured_categories'] : ''; + $ignore_sticky = isset($instance['ignore_sticky']) ? $instance['ignore_sticky'] : 0; + $orderby = ( ! empty( $instance['orderby'] ) ) ? $instance['orderby'] : 'date'; + $number_posts = ( ! empty( $instance['number_posts'] ) ) ? absint( $instance['number_posts'] ) : 6; + if ( ! $number_posts ) $number_posts = 6; + + $custom_query_args = array( + 'post_type' => 'post', + 'posts_per_page' => $number_posts, + 'post_status' => 'publish', + 'ignore_sticky_posts' => $ignore_sticky, + 'category__in' => $featured_categories, + 'order' => 'DESC', + 'orderby' => $orderby, + ); + $custom_query = new WP_Query( apply_filters( 'widget_block1_posts_args', $custom_query_args ) ); + $count = 0; + if ( $custom_query->have_posts() ) : + + echo $args['before_widget']; + if ( $title ) echo $args['before_title'] . $title . $args['after_title']; + + if ( $layout == 'grid' ) : + echo '
    '; + echo '
    '; + while ( $custom_query->have_posts() ) : $custom_query->the_post(); + $count++; + ?> + + '; + echo '
    '; + } + endwhile; + echo '
    '; + echo '
    '; + else : + echo '
    '; + while ( $custom_query->have_posts() ) : $custom_query->the_post(); + get_template_part( 'template-parts/content-list' ); + endwhile; + echo '
    '; + endif; + + wp_reset_postdata(); // reset the query + endif; + ?> + + is_preview() ) { + $cache[ $args['widget_id'] ] = ob_get_flush(); + wp_cache_set( 'widget_block1', $cache, 'widget' ); + } else { + ob_end_flush(); + } + } + + /** + * @param array $new_instance + * @param array $old_instance + * @return array + */ + public function update( $new_instance, $old_instance ) { + $instance = $old_instance; + + $this->flush_widget_cache(); + $alloptions = wp_cache_get( 'alloptions', 'options' ); + if ( isset($alloptions['widget_recent_entries']) ) delete_option('widget_recent_entries'); + + $instance['title'] = strip_tags( $new_instance['title'] ); + $instance['ignore_sticky'] = isset($new_instance['ignore_sticky']) ? strip_tags($new_instance['ignore_sticky']) : ''; + $instance['layout'] = $new_instance['layout']; + $instance['featured_categories'] = $new_instance['featured_categories']; + $instance['number_posts'] = $new_instance['number_posts']; + $instance['orderby'] = $new_instance['orderby']; + + + + return $instance; + } + + /** + * @access public + */ + public function flush_widget_cache() { + wp_cache_delete('widget_block1', 'widget'); + } + + /** + * @param array $instance + */ + public function form( $instance ) { + + // Set default value. + $defaults = array( + 'title' => '', + 'layout' => 'grid', + 'featured_categories' => '', + 'ignore_sticky' => 0, + 'number_posts' => 6, + 'orderby' => 'date' + ); + $instance = wp_parse_args( (array) $instance, $defaults ); + $featured_categories = (array)$instance['featured_categories']; + $orderby = array( 'date', 'comment_count', 'rand' ); + $layout = array( 'list', 'grid' ); + + ?> +

    + + +

    +

    + + +

    + +

    + + +

    +

    + + +

    +

    + /> + +

    +

    + + +

    +

    + Upgrade To Pro: This is the Lite Version of this widget with only basic options. You can upgrade to Codilight Pro for more features and options.', 'codilight-lite' ), array( 'strong' => array(), 'a' => array( 'href' => array() ) ) ); ?>
    +

    + 'block2_widget', 'description' => esc_html__( "Slider posts widget for use on homepage.", 'codilight-lite') ); + parent::__construct('ft_block2', esc_html__('FT Block 2 - Slider', 'codilight-lite'), $widget_ops); + $this->alt_option_name = 'widget_block2'; + + add_action( 'save_post', array($this, 'flush_widget_cache') ); + add_action( 'deleted_post', array($this, 'flush_widget_cache') ); + add_action( 'switch_theme', array($this, 'flush_widget_cache') ); + } + + /** + * @param array $args + * @param array $instance + */ + public function widget( $args, $instance ) { + //extract( $args ); + $cache = array(); + if ( ! $this->is_preview() ) { + $cache = wp_cache_get( 'widget_block2', 'widget' ); + } + if ( ! is_array( $cache ) ) { + $cache = array(); + } + if ( ! isset( $args['widget_id'] ) ) { + $args['widget_id'] = $this->id; + } + if ( isset( $cache[ $args['widget_id'] ] ) ) { + echo $cache[ $args['widget_id'] ]; + return; + } + ob_start(); + + // Get values from the widget settings. + $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : ''; + $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); + $featured_categories = ( ! empty( $instance['featured_categories'] ) ) ? $instance['featured_categories'] : ''; + $ignore_sticky = isset($instance['ignore_sticky']) ? $instance['ignore_sticky'] : 1; + $orderby = ( ! empty( $instance['orderby'] ) ) ? $instance['orderby'] : 'comment_count'; + $number_posts = ( !empty( $instance['$number_posts'] ) ) ? absint( $instance['$number_posts'] ) : 5; + if ( ! $number_posts ) $number_posts = 5; + + $r = new WP_Query( apply_filters( 'widget_block2_posts_args', array( + 'post_type' => 'post', + 'posts_per_page' => $number_posts, + 'category__in' => $featured_categories, + 'no_found_rows' => true, + 'post_status' => 'publish', + 'order' => 'DESC', + 'meta_key' => '_thumbnail_id', + 'orderby' => $orderby, + 'ignore_sticky_posts' => '$ignore_sticky', + ) ) ); + + if ($r->have_posts()) : ?> + + + +
    + have_posts() ) : $r->the_post(); ?> + +
    +
    + + + +
    +
    + + term_id ).'">'.$category[0]->cat_name.''; + } + ?> + +

    + + + +

    +
    +
    +
    + +
    + + + + is_preview() ) { + $cache[ $args['widget_id'] ] = ob_get_flush(); + wp_cache_set( 'widget_block2', $cache, 'widget' ); + } else { + ob_end_flush(); + } + } + + /** + * @param array $new_instance + * @param array $old_instance + * @return array + */ + public function update( $new_instance, $old_instance ) { + $instance = $old_instance; + + $this->flush_widget_cache(); + $alloptions = wp_cache_get( 'alloptions', 'options' ); + if ( isset($alloptions['widget_recent_entries']) ) delete_option('widget_recent_entries'); + + $instance['title'] = strip_tags( $new_instance['title'] ); + $instance['ignore_sticky'] = isset($new_instance['ignore_sticky']) ? strip_tags($new_instance['ignore_sticky']) : ''; + $instance['featured_categories'] = $new_instance['featured_categories']; + $instance['number_posts'] = $new_instance['number_posts']; + $instance['orderby'] = $new_instance['orderby']; + + return $instance; + } + + /** + * @access public + */ + public function flush_widget_cache() { + wp_cache_delete('widget_block2', 'widget'); + } + + /** + * @param array $instance + */ + public function form( $instance ) { + + // Set default value. + $defaults = array( + 'title' => '', + 'featured_categories' => '', + 'ignore_sticky' => 1, + 'number_posts' => 5, + 'orderby' => 'comment_count' + ); + $instance = wp_parse_args( (array) $instance, $defaults ); + $featured_categories = (array)$instance['featured_categories']; + $orderby = array( 'date', 'comment_count', 'rand' ); + + ?> +

    + + +

    + +

    + + +

    +

    + + + +

    +

    + /> + +

    +

    + + +

    +

    + Upgrade To Pro: This is the Lite Version of this widget with only basic options. You can upgrade to Codilight Pro for more features and options.', 'codilight-lite' ), array( 'strong' => array(), 'a' => array( 'href' => array() ) ) ); ?>
    +

    + 'block3_widget', 'description' => esc_html__( "Display a list of posts based on one parent category", 'codilight-lite') ); + parent::__construct('ft_block3', esc_html__('FT Block 3', 'codilight-lite'), $widget_ops); + $this->alt_option_name = 'widget_block3'; + + add_action( 'save_post', array($this, 'flush_widget_cache') ); + add_action( 'deleted_post', array($this, 'flush_widget_cache') ); + add_action( 'switch_theme', array($this, 'flush_widget_cache') ); + } + + /** + * @param array $args + * @param array $instance + */ + public function widget( $args, $instance ) { + //extract( $args ); + $cache = array(); + if ( ! $this->is_preview() ) { + $cache = wp_cache_get( 'widget_block3', 'widget' ); + } + if ( ! is_array( $cache ) ) { + $cache = array(); + } + if ( ! isset( $args['widget_id'] ) ) { + $args['widget_id'] = $this->id; + } + if ( isset( $cache[ $args['widget_id'] ] ) ) { + echo $cache[ $args['widget_id'] ]; + return; + } + ob_start(); + + // Get values from the widget settings. + $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : ''; + $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); + $block_category = ( ! empty( $instance['block_category'] ) ) ? $instance['block_category'] : ''; + $ignore_sticky = isset($instance['ignore_sticky']) ? $instance['ignore_sticky'] : 1; + $orderby = ( ! empty( $instance['orderby'] ) ) ? $instance['orderby'] : 'date'; + $number_posts = ( ! empty( $instance['$number_posts'] ) ) ? absint( $instance['$number_posts'] ) : 4; + if ( ! $number_posts ) $number_posts = 4; + + $r = new WP_Query( apply_filters( 'widget_block3_posts_args', array( + 'post_type' => 'post', + 'posts_per_page' => $number_posts, + 'category__in' => $block_category, + 'no_found_rows' => true, + 'post_status' => 'publish', + 'orderby' => $orderby, + 'ignore_sticky_posts' => $ignore_sticky, + ) ) ); + + if ($r->have_posts()) : ?> + + + + + + +
    + have_posts() ) : $r->the_post(); ?> + +
    + +
    +

    + + + +

    +
    + +
    +
    +
    + + +
    + + + + is_preview() ) { + $cache[ $args['widget_id'] ] = ob_get_flush(); + wp_cache_set( 'widget_block3', $cache, 'widget' ); + } else { + ob_end_flush(); + } + } + + /** + * @param array $new_instance + * @param array $old_instance + * @return array + */ + public function update( $new_instance, $old_instance ) { + $instance = $old_instance; + + $this->flush_widget_cache(); + $alloptions = wp_cache_get( 'alloptions', 'options' ); + if ( isset($alloptions['widget_recent_entries']) ) delete_option('widget_recent_entries'); + + $instance['title'] = strip_tags( $new_instance['title'] ); + $instance['ignore_sticky'] = isset($new_instance['ignore_sticky']) ? strip_tags($new_instance['ignore_sticky']) : ''; + $instance['block_category'] = $new_instance['block_category']; + $instance['number_posts'] = $new_instance['number_posts']; + $instance['orderby'] = $new_instance['orderby']; + + return $instance; + } + + /** + * @access public + */ + public function flush_widget_cache() { + wp_cache_delete('widget_block3', 'widget'); + } + + /** + * @param array $instance + */ + public function form( $instance ) { + + // Set default value. + $defaults = array( + 'title' => '', + 'block_category' => '', + 'ignore_sticky' => 1, + 'number_posts' => 4, + 'orderby' => 'date' + ); + $instance = wp_parse_args( (array) $instance, $defaults ); + $block_category = $instance['block_category']; + $list_categories = get_categories(); + $orderby = array('date', 'comment_count', 'rand'); + ?> +

    + + +

    +

    + + +

    +

    + + +

    +

    + /> + +

    +

    + + +

    +

    + Upgrade To Pro: This is the Lite Version of this widget with only basic options. You can upgrade to Codilight Pro for more features and options.', 'codilight-lite' ), array( 'strong' => array(), 'a' => array( 'href' => array() ) ) ); ?>
    +

    + 'block3_widget block4_widget', 'description' => esc_html__( "Display a list of popular/lastest posts for use on sidebar.", 'codilight-lite') ); + parent::__construct('ft_block4', esc_html__('FT Block 4', 'codilight-lite'), $widget_ops); + $this->alt_option_name = 'widget_block4'; + + add_action( 'save_post', array($this, 'flush_widget_cache') ); + add_action( 'deleted_post', array($this, 'flush_widget_cache') ); + add_action( 'switch_theme', array($this, 'flush_widget_cache') ); + } + + /** + * @param array $args + * @param array $instance + */ + public function widget( $args, $instance ) { + //extract( $args ); + $cache = array(); + if ( ! $this->is_preview() ) { + $cache = wp_cache_get( 'widget_block4', 'widget' ); + } + if ( ! is_array( $cache ) ) { + $cache = array(); + } + if ( ! isset( $args['widget_id'] ) ) { + $args['widget_id'] = $this->id; + } + if ( isset( $cache[ $args['widget_id'] ] ) ) { + echo $cache[ $args['widget_id'] ]; + return; + } + ob_start(); + + // Get values from the widget settings. + $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : ''; + $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); + $featured_categories = ( ! empty( $instance['featured_categories'] ) ) ? $instance['featured_categories'] : ''; + $ignore_sticky = isset($instance['ignore_sticky']) ? $instance['ignore_sticky'] : 1; + $orderby = ( ! empty( $instance['orderby'] ) ) ? $instance['orderby'] : 'date'; + $number_posts = ( ! empty( $instance['$number_posts'] ) ) ? absint( $instance['$number_posts'] ) : 4; + if ( ! $number_posts ) $number_posts = 4; + + $r = new WP_Query( apply_filters( 'widget_block4_posts_args', array( + 'post_type' => 'post', + 'posts_per_page' => $number_posts, + 'category__in' => $featured_categories, + 'post_status' => 'publish', + 'orderby' => $orderby, + 'ignore_sticky_posts' => $ignore_sticky, + ) ) ); + + if ($r->have_posts()) : ?> + + + + +
    + have_posts() ) : $r->the_post(); ?> + +
    + +
    +

    + + + +

    +
    + +
    +
    +
    + + +
    + + + + is_preview() ) { + $cache[ $args['widget_id'] ] = ob_get_flush(); + wp_cache_set( 'widget_block4', $cache, 'widget' ); + } else { + ob_end_flush(); + } + } + + /** + * @param array $new_instance + * @param array $old_instance + * @return array + */ + public function update( $new_instance, $old_instance ) { + $instance = $old_instance; + + $this->flush_widget_cache(); + $alloptions = wp_cache_get( 'alloptions', 'options' ); + if ( isset($alloptions['widget_recent_entries']) ) delete_option('widget_recent_entries'); + + $instance['title'] = strip_tags( $new_instance['title'] ); + $instance['ignore_sticky'] = isset($new_instance['ignore_sticky']) ? strip_tags($new_instance['ignore_sticky']) : ''; + $instance['featured_categories'] = $new_instance['featured_categories']; + $instance['number_posts'] = $new_instance['number_posts']; + $instance['orderby'] = $new_instance['orderby']; + + return $instance; + } + + /** + * @access public + */ + public function flush_widget_cache() { + wp_cache_delete('widget_block4', 'widget'); + } + + /** + * @param array $instance + */ + public function form( $instance ) { + + // Set default value. + $defaults = array( + 'title' => '', + 'featured_categories' => '', + 'ignore_sticky' => 1, + 'number_posts' => 4, + 'orderby' => 'date' + ); + $instance = wp_parse_args( (array) $instance, $defaults ); + $featured_categories = (array)$instance['featured_categories']; + $list_categories = get_categories(); + $orderby = array('date', 'comment_count', 'rand'); + ?> +

    + + +

    + +

    + + +

    +

    + + +

    +

    + /> + +

    +

    + + +

    +

    + Upgrade To Pro: This is the Lite Version of this widget with only basic options. You can upgrade to Codilight Pro for more features and options.', 'codilight-lite' ), array( 'strong' => array(), 'a' => array( 'href' => array() ) ) ); ?>
    +

    + -