diff --git a/archive.php b/archive.php index a6c77dc..a7ae8e7 100644 --- a/archive.php +++ b/archive.php @@ -42,7 +42,7 @@
- +
diff --git a/author.php b/author.php index edd9ae5..a4f0273 100644 --- a/author.php +++ b/author.php @@ -42,7 +42,7 @@
- +
diff --git a/comments.php b/comments.php index ad35491..49afcca 100644 --- a/comments.php +++ b/comments.php @@ -60,44 +60,44 @@ ); ?> -
- -
- ID)->approved; + $comments_count = wp_count_comments($post->ID)->approved; ?> -
-

Comments

+
+

- + - 1 && get_option('page_comments')) : - ?> - - + 1 && get_option('page_comments')) : + ?> + + -
+
- comment_status) : ?> - - - - - + comment_status) : ?> + + + + + + +
+ +
diff --git a/footer.php b/footer.php index bb57c7e..aef5741 100644 --- a/footer.php +++ b/footer.php @@ -108,18 +108,6 @@ - -
- -
- - - - diff --git a/functions.php b/functions.php index 8dbb50b..bf28dea 100644 --- a/functions.php +++ b/functions.php @@ -250,11 +250,6 @@ function mtminimag_skip_link_focus_fix() { */ require get_template_directory() . '/inc/sanitize-functions.php'; -/** - * Advertisement Manager - */ -require get_template_directory() . '/inc/customizer/ad-manager.php'; - /** * Customizer Menu Options */ diff --git a/header.php b/header.php index c54d016..31712a9 100644 --- a/header.php +++ b/header.php @@ -18,8 +18,6 @@ - - + #i', $content, $matches, PREG_SET_ORDER+PREG_OFFSET_CAPTURE); - $middleParagraph = floor($totalParagraphs / 2); - - if( getOption('defaults', 'ads_posts') ) { - if (is_single() && ! is_admin()) { - return mtminimag_insert_after_paragraphs($content, $insertion, array($middleParagraph)); - } - } - - if( getOption('defaults', 'ads_pages') ) { - if (is_page() && ! is_admin()) { - return mtminimag_insert_after_paragraphs($content, $insertion, array($middleParagraph)); - } - } - - return $content; - } - } - - /* Advertisement before the last paragraph */ - if ( getOption('defaults', 'ad_before_last_paragraph') ) { - add_filter('the_content', 'mtminimag_insert_ads_before_last'); - - function mtminimag_insert_ads_before_last($content) { - $insertion = getOption('defaults', 'ad_before_last_paragraph'); - - $totalParagraphs = preg_match_all('#

#i', $content, $matches, PREG_SET_ORDER+PREG_OFFSET_CAPTURE); - $lastParagraph = floor($totalParagraphs - 1); - - if( getOption('defaults', 'ads_posts') ) { - if (is_single() && ! is_admin()) { - return mtminimag_insert_after_paragraphs($content, $insertion, array($lastParagraph)); - } - } - - if( getOption('defaults', 'ads_pages') ) { - if (is_page() && ! is_admin()) { - return mtminimag_insert_after_paragraphs($content, $insertion, array($lastParagraph)); - } - } - - return $content; - } - } - - /* Advertisement after the numbered paragraph */ - if ( getOption('defaults', 'paragraph_number') && getOption('defaults', 'ad_after_numbered_paragraph') ) { - add_filter('the_content', 'mtminimag_insert_ads_after_number'); - function mtminimag_insert_ads_after_number($content) { - $insertion = getOption('defaults', 'ad_after_numbered_paragraph'); - - $paragraphNumber = (int) getOption('defaults', 'paragraph_number'); - - if( getOption('defaults', 'ads_posts') ) { - if (is_single() && ! is_admin()) { - return mtminimag_insert_after_paragraphs($content, $insertion, array($paragraphNumber)); - } - } - - if( getOption('defaults', 'ads_pages') ) { - if (is_page() && ! is_admin()) { - return mtminimag_insert_after_paragraphs($content, $insertion, array($paragraphNumber)); - } - } - - return $content; - } - } - - // Function that makes the magic happen correctly - function findMatches($match) - { - return $match[0][1] + 4; // return string offset + length of

Tag - } - - function mtminimag_insert_after_paragraphs($content, $insertion, $paragraph_indexes) { - // find all paragraph ending offsets - preg_match_all('#

#i', $content, $matches, PREG_SET_ORDER+PREG_OFFSET_CAPTURE); - - // reduce matches to offset positions - /* Compatible with PHP v5 */ - $matches = array_map("findMatches", $matches); - - /* Compatible with PHP v7 */ - // $matches = array_map(function($match) { - // return $match[0][1] + 4; // return string offset + length of

Tag - // }, $matches); - - // cycle through and insert on demand - foreach ($paragraph_indexes as $paragraph_index) { - if ($paragraph_index <= count($matches)) { - $offset_position = $matches[$paragraph_index-1]; - $content = substr($content, 0, $offset_position) . $insertion . substr($content, $offset_position); - } - } - - return $content; - } -} diff --git a/inc/customizer/controls.php b/inc/customizer/controls.php index c2e5d13..be0dc69 100644 --- a/inc/customizer/controls.php +++ b/inc/customizer/controls.php @@ -588,6 +588,21 @@ function mtminimag_customize_register($wp_customize) ) ) ); + $wp_customize->add_setting('color_anchor', array ( + 'default' => $defaultColors['color_anchor'], + 'transport' => 'postMessage', + 'sanitize_callback' => 'sanitize_hex_color' + )); + $wp_customize->add_control( + new WP_Customize_Color_Control( + $wp_customize, + 'color_anchor', + array( + 'label' => __( 'Link Color', 'mtminimag' ), + 'section' => 'main_colors', + ) ) + ); + // Logo Color $wp_customize->add_section('logo_colors', array ( 'title' => __('Logo Color', 'mtminimag'), @@ -3194,128 +3209,7 @@ function mtminimag_customize_register($wp_customize) 'section' => 'header_style' ) )); - // - // ─── AD MANAGEMENT ────────────────────────────────────────────────────────────── - // - $wp_customize->add_panel('ad_mgt', array( - 'title' => __( 'Ad Management', 'mtminimag' ), - )); - - // Enable/Disable Adverts - $wp_customize->add_section('ad_appearance', array ( - 'title' => __('Appearance', 'mtminimag'), - 'description' => 'Enable/Disable Ads on your site.', - 'panel' => 'ad_mgt', - )); - $wp_customize->add_setting( 'ads_posts', array( - 'default' => $defaults['ads_posts'], - 'transport' => 'refresh', - 'sanitize_callback' => 'mtminimag_sanitize_checkbox' - )); - $wp_customize->add_control( - new MightyThemes_Toggle_Switch_Custom_control( - $wp_customize, - 'ads_posts', - array( - 'label' => __( 'Posts', 'mtminimag' ), - 'section' => 'ad_appearance' - ) - )); - - $wp_customize->add_setting( 'ads_pages', array( - 'default' => $defaults['ads_pages'], - 'transport' => 'refresh', - 'sanitize_callback' => 'mtminimag_sanitize_checkbox' - )); - $wp_customize->add_control( - new MightyThemes_Toggle_Switch_Custom_control( - $wp_customize, - 'ads_pages', - array( - 'label' => __( 'Pages', 'mtminimag' ), - 'section' => 'ad_appearance' - ) - )); - - // Adverts on position - $wp_customize->add_section('adverts_position', array ( - 'title' => __('Assign Position', 'mtminimag'), - 'description' => 'Code for showing ad in the specified position.', - 'panel' => 'ad_mgt', - )); - // Adverts on Beginning of Post/Page - $wp_customize->add_setting('ad_code_post_begin', array ( - 'default' => $defaults['ad_code_post_begin'], - 'transport' => 'refresh', - 'sanitize_callback' => 'mtminimag_sanitize_textarea' - )); - $wp_customize->add_control( 'ad_code_post_begin', array( - 'label' => __('Code of advert at the Beginning of Post/Page.', 'mtminimag'), - 'section' => 'adverts_position', - 'type' => 'textarea', - )); - // Adverts on Middle of Post/Page - $wp_customize->add_setting('ad_code_post_middle', array ( - 'default' => $defaults['ad_code_post_middle'], - 'transport' => 'refresh', - 'sanitize_callback' => 'mtminimag_sanitize_textarea' - )); - $wp_customize->add_control( 'ad_code_post_middle', array( - 'label' => __('Code of advert at the Middle of Post/Page.', 'mtminimag'), - 'section' => 'adverts_position', - 'type' => 'textarea', - )); - // Adverts on End of Post/Page - $wp_customize->add_setting('ad_code_post_end', array ( - 'default' => $defaults['ad_code_post_end'], - 'transport' => 'refresh', - 'sanitize_callback' => 'mtminimag_sanitize_textarea' - )); - $wp_customize->add_control( 'ad_code_post_end', array( - 'label' => __('Code of advert at the End of Post/Page.', 'mtminimag'), - 'section' => 'adverts_position', - 'type' => 'textarea', - )); - // Adverts on Right before the last paragraph - $wp_customize->add_setting('ad_before_last_paragraph', array ( - 'default' => $defaults['ad_before_last_paragraph'], - 'transport' => 'refresh', - 'sanitize_callback' => 'mtminimag_sanitize_textarea' - )); - $wp_customize->add_control( 'ad_before_last_paragraph', array( - 'label' => __('Code of advert before the last paragraph.', 'mtminimag'), - 'section' => 'adverts_position', - 'type' => 'textarea', - )); - // Adverts on [number] paragraph - $wp_customize->add_setting('paragraph_number', array ( - 'default' => $defaults['paragraph_number'], - 'transport' => 'refresh', - 'sanitize_callback' => 'mtminimag_sanitize_number' - )); - $wp_customize->add_control( 'paragraph_number', array( - 'label' => __('Paragraph Number', 'mtminimag'), - 'section' => 'adverts_position', - 'type' => 'number', - 'input_attrs' => array( - 'min' => 1, - 'max' => 200, - 'step' => 1, - ), - )); - - $wp_customize->add_setting('ad_after_numbered_paragraph', array ( - 'default' => $defaults['ad_after_numbered_paragraph'], - 'transport' => 'refresh', - 'sanitize_callback' => 'mtminimag_sanitize_textarea' - )); - $wp_customize->add_control( 'ad_after_numbered_paragraph', array( - 'label' => __('Code of advert after the [number] paragraph.', 'mtminimag'), - 'section' => 'adverts_position', - 'type' => 'textarea', - )); - // // ─── MISCELLANEOUS ────────────────────────────────────────────────────────────── // @@ -3804,48 +3698,6 @@ function mtminimag_customize_register($wp_customize) 'type' => 'text' )); - // - // ─── CUSTOM CODE ──────────────────────────────────────────────────────────── - // - // Custom Code Section - $wp_customize->add_section( 'custom_code', array( - 'title' => __('Custom Code', 'mtminimag'), - 'description' => '', - )); - - // Custom Code Controls - $wp_customize->add_setting('tracking_code', array ( - 'default' => $defaults['tracking_code'], - 'transport' => 'refresh', - 'sanitize_callback' => 'mtminimag_sanitize_textarea' - )); - $wp_customize->add_control( 'tracking_code', array( - 'label' => __('Tracking Code', 'mtminimag'), - 'section' => 'custom_code', - 'type' => 'textarea', - )); - - $wp_customize->add_setting('space_before_head', array ( - 'default' => $defaults['space_before_head'], - 'transport' => 'refresh', - 'sanitize_callback' => 'mtminimag_sanitize_textarea' - )); - $wp_customize->add_control( 'space_before_head', array( - 'label' => __('Space Before ', 'mtminimag'), - 'section' => 'custom_code', - 'type' => 'textarea', - )); - - $wp_customize->add_setting('space_before_body', array ( - 'default' => $defaults['space_before_body'], - 'transport' => 'refresh', - 'sanitize_callback' => 'mtminimag_sanitize_textarea' - )); - $wp_customize->add_control( 'space_before_body', array( - 'label' => __('Space Before ', 'mtminimag'), - 'section' => 'custom_code', - 'type' => 'textarea', - )); } add_action('customize_register', 'mtminimag_customize_register'); diff --git a/inc/customizer/custom/controls/custom-controls.php b/inc/customizer/custom/controls/custom-controls.php index d861f4e..6d7246b 100644 --- a/inc/customizer/custom/controls/custom-controls.php +++ b/inc/customizer/custom/controls/custom-controls.php @@ -71,7 +71,7 @@ public function render_content() { link(); ?> value() ); ?>/>
- +
@@ -376,7 +376,7 @@ public function render_content() { - +

- MT Custom section - Press return or enter to open this section + +

diff --git a/inc/customizer/custom/separator.php b/inc/customizer/custom/separator.php index b34bb7c..b67c35f 100644 --- a/inc/customizer/custom/separator.php +++ b/inc/customizer/custom/separator.php @@ -34,23 +34,6 @@ public function json() { protected function render_template() { ?> -
diff --git a/inc/customizer/custom/widget/class-mt-category-posts.php b/inc/customizer/custom/widget/class-mt-category-posts.php index 1fefe36..02939bc 100644 --- a/inc/customizer/custom/widget/class-mt-category-posts.php +++ b/inc/customizer/custom/widget/class-mt-category-posts.php @@ -60,13 +60,13 @@ function mtminmag_category_posts($instance) { -
  • +
  • - ID )); ?> - ID )) == 1 ? ' min' : ' mins'?> read + ID ))); ?> + ID )) == 1 ? ' min' : ' mins')?> read
  • @@ -108,13 +108,13 @@ public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['title'] ); // before and after widget arguments - echo $args['before_widget']; + esc_html_e( $args['before_widget']); if ( ! empty( $title ) ) - echo $args['before_title'] . $title . $args['after_title']; + esc_html_e( $args['before_title'] . $title . $args['after_title']); // This is where you run the code and display the output mtminmag_category_posts( $instance ); - echo $args['after_widget']; + esc_html_e( $args['after_widget']); } // Updating widget replacing old instances with new diff --git a/inc/customizer/custom/widget/class-mt-popular-posts.php b/inc/customizer/custom/widget/class-mt-popular-posts.php index 5d871a4..0100dca 100644 --- a/inc/customizer/custom/widget/class-mt-popular-posts.php +++ b/inc/customizer/custom/widget/class-mt-popular-posts.php @@ -107,7 +107,7 @@ function mtminimag_popular_posts($instance) {
  • ID )); ?> - ID )) == 1 ? ' min' : ' mins'?> read + ID )) == 1 ? ' min' : ' mins'?>
  • @@ -190,29 +190,29 @@ public function form( $instance ) {
    -

    Customization Options:

    +

    id="get_field_id( 'showThumbnail' ); ?>" name="get_field_name( 'showThumbnail' ); ?>" /> - +

    id="get_field_id( 'showCategory' ); ?>" name="get_field_name( 'showCategory' ); ?>" /> - +

    id="get_field_id( 'showDate' ); ?>" name="get_field_name( 'showDate' ); ?>" /> - +

    id="get_field_id( 'showAuthor' ); ?>" name="get_field_name( 'showAuthor' ); ?>" /> - +

    id="get_field_id( 'showReadTime' ); ?>" name="get_field_name( 'showReadTime' ); ?>" /> - +

    ; --primary-color: ; + --anchor-color: ; --header-text-color: ; --body-bg-color: ; @@ -44,7 +45,11 @@ function mtminimag_customizer_css() --offcanvas-width: px; --offcanvas-text-color: ; --offcanvas-bg: ; - } + } + + a { + color: var(--anchor-color); + } body.custom-background { background-color: var(--body-bg-color); diff --git a/inc/defaults.php b/inc/defaults.php index 1ede878..165299f 100644 --- a/inc/defaults.php +++ b/inc/defaults.php @@ -47,14 +47,6 @@ function mt_get_defaults() { 'show_search' => true, 'show_search_mobile' => true, 'show_topbar' => true, - 'ads_posts' => false, - 'ads_pages' => false, - 'ad_code_post_begin' => '', - 'ad_code_post_middle' => '', - 'ad_code_post_end' => '', - 'ad_before_last_paragraph' => '', - 'paragraph_number' => '', - 'ad_after_numbered_paragraph' => '', 'pagination_type' => 'numbered', 'show_author' => true, 'show_readtime' => true, @@ -88,11 +80,7 @@ function mt_get_defaults() { 'messenger' => '', 'github' => '', 'whatsapp' => '', - 'telegram' => '', - - 'tracking_code' => '', - 'space_before_head' => '', - 'space_before_body' => '' + 'telegram' => '' ) ); } @@ -115,6 +103,7 @@ function mt_get_color_defaults() { 'color_primary' => '#646464', 'color_site' => '#737070', + 'color_anchor' => '#000', 'color_logo_text' => '#FF4642', 'color_header_text' => '#111111', 'color_background' => '#f8f9fa', diff --git a/inc/template-functions.php b/inc/template-functions.php index c5b8acc..160b6d7 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -447,7 +447,7 @@ function save_user_profile_fields( $user_id ) { function get_breadcrumb() { - echo ''; + echo ''; if( is_author() ) { echo "  /  "; the_author(' • '); @@ -480,14 +480,36 @@ function mtminimag_footer_info() { date( 'Y' ), get_bloginfo( 'name' ), esc_url( 'https://mightythemes.com/themes/' ), - _x( 'Powered by', 'MT Minimag', 'minimag' ), - __( 'MT Minimag', 'minimag' ) + _x( 'Powered by', 'MT Minimag', 'mtminimag' ), + __( 'MT Minimag', 'mtminimag' ) ); echo $copyright; // WPCS: XSS ok. } } +function mtminimag_customizer_styles() { ?> + +
    - +
    diff --git a/page.php b/page.php index ab4551a..96847ee 100644 --- a/page.php +++ b/page.php @@ -25,16 +25,6 @@ - -
    - -
    - -
    @@ -63,15 +53,6 @@ endwhile; // End of the loop. ?> - -
    - -
    -
    - +
    diff --git a/single.php b/single.php index 81f47fd..b59660f 100644 --- a/single.php +++ b/single.php @@ -50,11 +50,11 @@ $u_modified_time = get_the_modified_time('U'); if ($u_modified_time >= $u_time + 86400) { ?> - Updated on + - Updated on + @@ -85,14 +85,14 @@ @@ -116,18 +116,6 @@ - -
    - -
    - -
    @@ -141,16 +129,6 @@ - -
    - -
    - -