<?php

if (!class_exists('hubsteel_Blog')) {

    class hubsteel_Blog
    {
        
        public function get_archive_meta() {
            $archive_author = hubsteel()->get_theme_opt( 'archive_author', true );
            $archive_tag = hubsteel()->get_theme_opt( 'archive_tag', true );
            $archive_comment = hubsteel()->get_theme_opt( 'archive_comment', true );
            if($archive_tag || $archive_author || $archive_comment ) : ?>
                <ul class="pxl-item--meta pxl-flex">
                    <?php if($archive_author) : ?>
                        <li class="pxl-item--author pxl-post-list pxl-mr-27">
                            <span class="pxl-icon pxl-mr-10">
                                <svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">
                                    <title>user</title>
                                    <style>
                                        .user-svg { fill: #000000 } 
                                    </style>
                                    <path class="user-svg" d="m230.9 212c-15.2-26.3-38.7-45.2-66.1-54.2 27.9-16.5 41.2-49.7 32.6-80.9-8.6-31.3-37-52.9-69.4-52.9-32.4 0-60.8 21.6-69.4 52.9-8.6 31.2 4.7 64.4 32.6 80.9-27.4 9-50.9 27.9-66.1 54.2-1.1 1.8-1.5 4.1-1 6.1 0.6 2.1 1.9 3.9 3.8 5 1.9 1.1 4.1 1.4 6.2 0.8 2-0.6 3.8-2 4.8-3.9 18.9-32.6 52.2-52 89.1-52 36.9 0 70.2 19.4 89.1 52 1 1.9 2.8 3.3 4.8 3.9 2.1 0.6 4.3 0.3 6.2-0.8 1.9-1.1 3.2-2.9 3.8-5 0.5-2 0.1-4.3-1-6.1zm-158.9-116c0-22.6 13.6-43.1 34.6-51.7 20.9-8.7 45-3.9 61 12.1 16 16 20.8 40.1 12.1 61-8.6 21-29.1 34.6-51.7 34.6-7.4 0-14.6-1.5-21.4-4.3-6.8-2.8-13-6.9-18.2-12.1-5.2-5.2-9.3-11.4-12.1-18.2-2.8-6.8-4.3-14-4.3-21.4z"/>
                                </svg>
                            </span>
                            <span class="pxl-name">
                                <?php 
                                    printf(
                                        esc_html__('By %s', 'hubsteel'), 
                                        get_the_author_posts_link()
                                    ); 
                                ?>
                            </span>
                        </li>
                    <?php endif; ?>
                    <?php if($archive_tag) : ?>
                        <?php if (get_the_tags()) : ?>
                            <li class="pxl-item--tags pxl-post-list pxl-mr-26">
                                <span class="pxl-icon pxl-mr-10">
                                    <svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">
                                        <title>tag-chevron</title>
                                        <style>
                                            .tags-svg { fill: #000000 } 
                                        </style>
                                        <path class="tags-svg" d="m246.7 123.6l-45.7-68.5q-1.1-1.6-2.6-2.9-1.4-1.4-3.1-2.3-1.8-0.9-3.7-1.4-1.9-0.5-3.9-0.5h-155.7c-1.4 0-2.9 0.4-4.1 1.1-1.3 0.8-2.3 1.8-3 3.1-0.6 1.3-1 2.7-0.9 4.2 0.1 1.4 0.5 2.8 1.3 4l45.1 67.6-45 67.6c-0.8 1.2-1.3 2.6-1.3 4-0.1 1.4 0.2 2.9 0.9 4.2 0.7 1.2 1.7 2.3 2.9 3 1.2 0.8 2.7 1.2 4.1 1.2h155.7q2 0 3.9-0.5 1.9-0.5 3.7-1.4 1.7-0.9 3.1-2.3 1.5-1.3 2.6-2.9l45.6-68.5q0.7-0.9 1-2.1 0.4-1.1 0.4-2.3 0-1.2-0.3-2.3-0.4-1.2-1-2.1zm-59 68.4h-140.7l39.7-59.6q0.7-0.9 1-2.1 0.4-1.1 0.4-2.3 0-1.2-0.4-2.3-0.3-1.2-1-2.1l-39.7-59.6h140.7l42.7 64z"/>
                                    </svg>
                                </span>
                                <?php 
                                    $tags = get_the_tags();
                                    if ($tags) {
                                        foreach ($tags as $tag) {
                                            echo '<a class="pxl-name" href="' . get_tag_link($tag->term_id) . '">' . $tag->name . '</a> ';
                                        }
                                    }
                                ?>
                            </li>
                        <?php endif; ?>
                    <?php endif; ?>
                    <?php if($archive_comment) : ?>
                        <li class="pxl-comment pxl-post-list">
                            <span class="pxl-icon pxl-mr-10">
                                <svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">
                                    <title>chat-teardrop</title>
                                    <style>
                                        .chat-svg { fill: #000000 } 
                                    </style>
                                    <path class="chat-svg" d="m132 24c-13.1 0-26.1 2.6-38.3 7.6-12.1 5.1-23.1 12.4-32.4 21.7-9.3 9.3-16.6 20.3-21.7 32.4-5 12.2-7.6 25.2-7.6 38.3v84c0 2.1 0.4 4.2 1.2 6.1 0.8 2 2 3.7 3.5 5.2 1.5 1.5 3.2 2.7 5.2 3.5 1.9 0.8 4 1.2 6.1 1.2h84c26.5 0 52-10.5 70.7-29.3 18.8-18.7 29.3-44.2 29.3-70.7 0-26.5-10.5-52-29.3-70.7-18.7-18.8-44.2-29.3-70.7-29.3zm0 184h-84v-84c0-34 20.5-64.6 51.9-77.6 31.3-13 67.5-5.8 91.5 18.2 24 24 31.2 60.2 18.2 91.5-13 31.4-43.6 51.9-77.6 51.9z"/>
                                </svg>
                            </span>
                            <a class="pxl-name" href="<?php the_permalink(); ?>#comments" class="pxl-item--comment pxl-item--flexnw">
                                <?php echo comments_number(esc_html__('No Comments', 'hubsteel'),esc_html__('1 Comment', 'hubsteel'),esc_html__('% Comments', 'hubsteel')); ?>
                            </a>
                        </li>
                    <?php endif; ?>
                </ul>
            <?php endif; 
        }

        public function get_archive_meta_2($post_id = 0) { ?>
            <div class="post-metas-2">
                <div class="meta-inner ">
                    <span class="post-date-category">
                        <span class="post-date-post"><?php echo get_the_date('d M'); ?> </span>
                        <span><?php the_terms( $post_id, 'category', '', ', ', '' ); ?></span>
                    </span>
                </div>
            </div>
        <?php }

        public function get_post_metas(){
            $post_author = hubsteel()->get_theme_opt( 'post_author', true );
            $post_comment = hubsteel()->get_theme_opt( 'post_comment', true );
            $post_tag = hubsteel()->get_theme_opt( 'post_tag', true );
            $post_date = hubsteel()->get_theme_opt( 'post_date', true );
            if($post_tag || $post_date || $post_comment || $post_view ) : ?>
                <ul class="pxl-item--meta pxl-flex">
                    <?php if($post_author) : ?>
                        <li class="pxl-item--author pxl-post-list pxl-mr-27">
                            <span class="pxl-icon pxl-mr-10">
                                <svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">
                                    <title>user</title>
                                    <style>
                                        .user-svg { fill: #000000 } 
                                    </style>
                                    <path class="user-svg" d="m230.9 212c-15.2-26.3-38.7-45.2-66.1-54.2 27.9-16.5 41.2-49.7 32.6-80.9-8.6-31.3-37-52.9-69.4-52.9-32.4 0-60.8 21.6-69.4 52.9-8.6 31.2 4.7 64.4 32.6 80.9-27.4 9-50.9 27.9-66.1 54.2-1.1 1.8-1.5 4.1-1 6.1 0.6 2.1 1.9 3.9 3.8 5 1.9 1.1 4.1 1.4 6.2 0.8 2-0.6 3.8-2 4.8-3.9 18.9-32.6 52.2-52 89.1-52 36.9 0 70.2 19.4 89.1 52 1 1.9 2.8 3.3 4.8 3.9 2.1 0.6 4.3 0.3 6.2-0.8 1.9-1.1 3.2-2.9 3.8-5 0.5-2 0.1-4.3-1-6.1zm-158.9-116c0-22.6 13.6-43.1 34.6-51.7 20.9-8.7 45-3.9 61 12.1 16 16 20.8 40.1 12.1 61-8.6 21-29.1 34.6-51.7 34.6-7.4 0-14.6-1.5-21.4-4.3-6.8-2.8-13-6.9-18.2-12.1-5.2-5.2-9.3-11.4-12.1-18.2-2.8-6.8-4.3-14-4.3-21.4z"/>
                                </svg>
                            </span>
                            <span class="pxl-name">
                                <?php 
                                    printf(
                                        esc_html__('By %s', 'hubsteel'), 
                                        get_the_author_posts_link()
                                    ); 
                                ?>
                            </span>
                        </li>
                    <?php endif; ?>
                    <?php if($post_date) : ?>
                        <li class="pxl-item--date pxl-post-list pxl-mr-27">
                            <span class="pxl-icon pxl-mr-11">
                                <svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">
                                    <title>calendar-dots</title>
                                    <style>
                                        .calendar-svg { fill: #000000 } 
                                    </style>
                                    <path class="calendar-svg" d="m208 32h-24v-8c0-2.1-0.8-4.2-2.3-5.7-1.5-1.5-3.6-2.3-5.7-2.3-2.1 0-4.2 0.8-5.7 2.3-1.5 1.5-2.3 3.6-2.3 5.7v8h-80v-8c0-2.1-0.8-4.2-2.3-5.7-1.5-1.5-3.6-2.3-5.7-2.3-2.1 0-4.2 0.8-5.7 2.3-1.5 1.5-2.3 3.6-2.3 5.7v8h-24c-2.1 0-4.2 0.4-6.1 1.2-2 0.8-3.7 2-5.2 3.5-1.5 1.5-2.7 3.2-3.5 5.2-0.8 1.9-1.2 4-1.2 6.1v160c0 2.1 0.4 4.2 1.2 6.1 0.8 2 2 3.7 3.5 5.2 1.5 1.5 3.2 2.7 5.2 3.5 1.9 0.8 4 1.2 6.1 1.2h160c2.1 0 4.2-0.4 6.1-1.2 2-0.8 3.7-2 5.2-3.5 1.5-1.5 2.7-3.2 3.5-5.2 0.8-1.9 1.2-4 1.2-6.1v-160c0-2.1-0.4-4.2-1.2-6.1-0.8-2-2-3.7-3.5-5.2-1.5-1.5-3.2-2.7-5.2-3.5-1.9-0.8-4-1.2-6.1-1.2zm-136 16v8c0 2.1 0.8 4.2 2.3 5.7 1.5 1.5 3.6 2.3 5.7 2.3 2.1 0 4.2-0.8 5.7-2.3 1.5-1.5 2.3-3.6 2.3-5.7v-8h80v8c0 2.1 0.8 4.2 2.3 5.7 1.5 1.5 3.6 2.3 5.7 2.3 2.1 0 4.2-0.8 5.7-2.3 1.5-1.5 2.3-3.6 2.3-5.7v-8h24v32h-160v-32zm136 160h-160v-112h160zm-68-76c0 4.9-2.9 9.2-7.4 11.1-4.5 1.8-9.7 0.8-13.1-2.6-3.4-3.4-4.4-8.6-2.6-13.1 1.9-4.5 6.2-7.4 11.1-7.4 1.6 0 3.1 0.3 4.6 0.9 1.4 0.6 2.8 1.5 3.9 2.6 1.1 1.1 2 2.5 2.6 3.9 0.6 1.5 0.9 3 0.9 4.6zm44 0c0 4.9-2.9 9.2-7.4 11.1-4.5 1.8-9.7 0.8-13.1-2.6-3.4-3.4-4.4-8.6-2.6-13.1 1.9-4.5 6.2-7.4 11.1-7.4 1.6 0 3.1 0.3 4.6 0.9 1.4 0.6 2.8 1.5 3.9 2.6 1.1 1.1 2 2.5 2.6 3.9 0.6 1.5 0.9 3 0.9 4.6zm-88 40c0 4.9-2.9 9.2-7.4 11.1-4.5 1.8-9.7 0.8-13.1-2.6-3.4-3.4-4.4-8.6-2.6-13.1 1.9-4.5 6.2-7.4 11.1-7.4 1.6 0 3.1 0.3 4.6 0.9 1.4 0.6 2.8 1.5 3.9 2.6 1.1 1.1 2 2.5 2.6 3.9 0.6 1.5 0.9 3 0.9 4.6zm44 0c0 4.9-2.9 9.2-7.4 11.1-4.5 1.8-9.7 0.8-13.1-2.6-3.4-3.4-4.4-8.6-2.6-13.1 1.9-4.5 6.2-7.4 11.1-7.4 1.6 0 3.1 0.3 4.6 0.9 1.4 0.6 2.8 1.5 3.9 2.6 1.1 1.1 2 2.5 2.6 3.9 0.6 1.5 0.9 3 0.9 4.6zm44 0c0 4.9-2.9 9.2-7.4 11.1-4.5 1.8-9.7 0.8-13.1-2.6-3.4-3.4-4.4-8.6-2.6-13.1 1.9-4.5 6.2-7.4 11.1-7.4 1.6 0 3.1 0.3 4.6 0.9 1.4 0.6 2.8 1.5 3.9 2.6 1.1 1.1 2 2.5 2.6 3.9 0.6 1.5 0.9 3 0.9 4.6z"/>
                                </svg>
                            </span>
                            <span class="pxl-name">
                                <?php echo get_the_date('d M Y'); ?>
                            </span>
                        </li>
                    <?php endif; ?>
                    <?php if($post_tag) : ?>
                        <?php if (get_the_tags()) : ?>
                            <li class="pxl-item--tags pxl-post-list pxl-mr-26">
                                <span class="pxl-icon pxl-mr-10">
                                    <svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">
                                        <title>tag-chevron</title>
                                        <style>
                                            .tags-svg { fill: #000000 } 
                                        </style>
                                        <path class="tags-svg" d="m246.7 123.6l-45.7-68.5q-1.1-1.6-2.6-2.9-1.4-1.4-3.1-2.3-1.8-0.9-3.7-1.4-1.9-0.5-3.9-0.5h-155.7c-1.4 0-2.9 0.4-4.1 1.1-1.3 0.8-2.3 1.8-3 3.1-0.6 1.3-1 2.7-0.9 4.2 0.1 1.4 0.5 2.8 1.3 4l45.1 67.6-45 67.6c-0.8 1.2-1.3 2.6-1.3 4-0.1 1.4 0.2 2.9 0.9 4.2 0.7 1.2 1.7 2.3 2.9 3 1.2 0.8 2.7 1.2 4.1 1.2h155.7q2 0 3.9-0.5 1.9-0.5 3.7-1.4 1.7-0.9 3.1-2.3 1.5-1.3 2.6-2.9l45.6-68.5q0.7-0.9 1-2.1 0.4-1.1 0.4-2.3 0-1.2-0.3-2.3-0.4-1.2-1-2.1zm-59 68.4h-140.7l39.7-59.6q0.7-0.9 1-2.1 0.4-1.1 0.4-2.3 0-1.2-0.4-2.3-0.3-1.2-1-2.1l-39.7-59.6h140.7l42.7 64z"/>
                                    </svg>
                                </span>
                                <?php 
                                    $tags = get_the_tags();
                                    if ($tags) {
                                        foreach ($tags as $tag) {
                                            echo '<a class="pxl-name" href="' . get_tag_link($tag->term_id) . '">' . $tag->name . '</a> ';
                                        }
                                    }
                                ?>
                            </li>
                        <?php endif; ?>
                    <?php endif; ?>
                    <?php if($post_comment) : ?>
                        <li class="pxl-comment pxl-post-list">
                            <span class="pxl-icon pxl-mr-10">
                                <svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">
                                    <title>chat-teardrop</title>
                                    <style>
                                        .chat-svg { fill: #000000 } 
                                    </style>
                                    <path class="chat-svg" d="m132 24c-13.1 0-26.1 2.6-38.3 7.6-12.1 5.1-23.1 12.4-32.4 21.7-9.3 9.3-16.6 20.3-21.7 32.4-5 12.2-7.6 25.2-7.6 38.3v84c0 2.1 0.4 4.2 1.2 6.1 0.8 2 2 3.7 3.5 5.2 1.5 1.5 3.2 2.7 5.2 3.5 1.9 0.8 4 1.2 6.1 1.2h84c26.5 0 52-10.5 70.7-29.3 18.8-18.7 29.3-44.2 29.3-70.7 0-26.5-10.5-52-29.3-70.7-18.7-18.8-44.2-29.3-70.7-29.3zm0 184h-84v-84c0-34 20.5-64.6 51.9-77.6 31.3-13 67.5-5.8 91.5 18.2 24 24 31.2 60.2 18.2 91.5-13 31.4-43.6 51.9-77.6 51.9z"/>
                                </svg>
                            </span>
                            <a class="pxl-name" href="<?php the_permalink(); ?>#comments" class="pxl-item--comment pxl-item--flexnw">
                                <?php echo comments_number(esc_html__('No Comments', 'hubsteel'),esc_html__('1 Comment', 'hubsteel'),esc_html__('% Comments', 'hubsteel')); ?>
                            </a>
                        </li>
                    <?php endif; ?>
                </ul>
            <?php endif; 
        }

        public function get_excerpt(){
            $archive_excerpt_length = hubsteel()->get_theme_opt('archive_excerpt_length', '50');
            $hubsteel_the_excerpt = get_the_excerpt();
            if(!empty($hubsteel_the_excerpt)) {
                echo wp_trim_words( $hubsteel_the_excerpt, $archive_excerpt_length, $more = null );
            } else {
                echo wp_kses_post($this->get_excerpt_more( $archive_excerpt_length ));
            }
        }

        public function get_excerpt_more( $post = null ) {
            $archive_excerpt_length = hubsteel()->get_theme_opt('archive_excerpt_length', '50');
            $post = get_post( $post );

            if ( empty( $post ) || 0 >= $archive_excerpt_length ) {
                return '';
            }

            if ( post_password_required( $post ) ) {
                return esc_html__( 'Post password required.', 'hubsteel' );
            }

            $content = apply_filters( 'the_content', strip_shortcodes( $post->post_content ) );
            $content = str_replace( ']]>', ']]&gt;', $content );

            $excerpt_more = apply_filters( 'hubsteel_excerpt_more', '&hellip;' );
            $excerpt      = wp_trim_words( $content, $archive_excerpt_length, $excerpt_more );

            return $excerpt;
        }

        public function hubsteel_set_post_views( $postID ) {
            $countKey = 'post_views_count';
            $count    = get_post_meta( $postID, $countKey, true );
            if ( $count == '' ) {
                $count = 0;
                delete_post_meta( $postID, $countKey );
                add_post_meta( $postID, $countKey, '0' );
            } else {
                $count ++;
                update_post_meta( $postID, $countKey, $count );
            }
        }

        public function get_tagged_in(){
            $tags_list = get_the_tag_list('', ' ');
            if ($tags_list) {
                echo '<div class="pxl--tags pxl-mr-15">';
                printf('%s', $tags_list);
                echo '</div>';
            }
        }

        public function get_socials_share() { 
            $img_url = '';
            if (has_post_thumbnail(get_the_ID()) && wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), false)) {
                $img_url = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), false);
            }
            $social_facebook = hubsteel()->get_theme_opt( 'social_facebook', true );
            $social_twitter = hubsteel()->get_theme_opt( 'social_twitter', true );
            $social_skype = hubsteel()->get_theme_opt( 'social_skype', true );
            $social_mail = hubsteel()->get_theme_opt( 'social_mail', true );
            ?>
            <div class="pxl--social">
                <label><?php echo esc_html__('Share:', 'hubsteel'); ?></label>
                <?php if($social_facebook) : ?>
                    <a class="fb-social" title="<?php echo esc_attr__('Facebook', 'hubsteel'); ?>" target="_blank" href="http://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>"><i class="fab fa-facebook-f" aria-hidden="true"></i></a>
                <?php endif; ?>
                <?php if($social_twitter) : ?>
                    <a class="tw-social" title="<?php echo esc_attr__('Twitter', 'hubsteel'); ?>" target="_blank" href="https://twitter.com/intent/tweet?url=<?php the_permalink(); ?>&text=<?php the_title(); ?>%20"><i class="fab fa-twitter" aria-hidden="true"></i></a>
                <?php endif; ?>
                <?php if($social_skype) : ?>
                    <a class="skype-social" title="<?php echo esc_attr__('Skype', 'hubsteel'); ?>" target="_blank" href="https://web.skype.com/"><i class="fab fa-skype" aria-hidden="true"></i></a>
                <?php endif; ?>
                <?php if($social_mail) : ?>
                    <a class="mail-social" title="<?php echo esc_attr__('Email', 'hubsteel'); ?>" href="mailto:your-email@example.com?subject=<?php the_title(); ?>&body=<?php the_permalink(); ?>"><i class="fas fa-envelope" aria-hidden="true"></i></a>
                <?php endif; ?>
            </div>
            <?php
        }

        public function get_socials_share_portfolio() { 
            $img_url = '';
            if (has_post_thumbnail(get_the_ID()) && wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), false)) {
                $img_url = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), false);
            }
            ?>
            <div class="pxl--social">
                <a class="fb-social" title="<?php echo esc_attr__('Facebook', 'hubsteel'); ?>" target="_blank" href="http://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>"><i class="caseicon-facebook"></i></a>
                <a class="tw-social" title="<?php echo esc_attr__('Twitter', 'hubsteel'); ?>" target="_blank" href="https://twitter.com/intent/tweet?url=<?php the_permalink(); ?>&text=<?php the_title(); ?>%20"><i class="caseicon-twitter"></i></a>
                <a class="pin-social" title="<?php echo esc_attr__('Pinterest', 'hubsteel'); ?>" target="_blank" href="http://pinterest.com/pin/create/button/?url=<?php the_permalink(); ?>&media=<?php echo esc_url($img_url[0]); ?>&description=<?php the_title(); ?>%20"><i class="caseicon-pinterest"></i></a>
                <a class="lin-social" title="<?php echo esc_attr__('LinkedIn', 'hubsteel'); ?>" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink(); ?>&title=<?php the_title(); ?>%20"><i class="caseicon-linkedin"></i></a>
            </div>
            <?php
        }

        public function get_post_nav() {
            global $post;
            $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
            $next     = get_adjacent_post( false, '', false );

            if ( ! $next && ! $previous )
                return;
            ?>
            <?php
            $next_post = get_next_post();
            $previous_post = get_previous_post();

            if( !empty($next_post) || !empty($previous_post) ) { 
                $page_for_posts = get_option( 'page_for_posts' );
                ?>
                <div class="pxl-post--navigation">
                    <div class="pxl--items pxl-flex-middle">
                        <div class="pxl--item pxl--item-prev">
                            <?php if ( is_a( $previous_post , 'WP_Post' ) && get_the_title( $previous_post->ID ) != '') { 
                                $prev_img_id = get_post_thumbnail_id($previous_post->ID);
                                $prev_img_url = wp_get_attachment_image_src($prev_img_id, 'hubsteel-thumb-xs');
                                ?>
                                <a class="pxl--label" href="<?php echo esc_url(get_permalink( $previous_post->ID )); ?>"><i class="caseicon-double-chevron-left"></i><span><?php echo esc_html__('Previous Post', 'hubsteel'); ?></span></a>
                                <div class="pxl--holder">
                                    <?php if(!empty($prev_img_id)) : ?>
                                        <div class="pxl--img">
                                            <a  href="<?php echo esc_url(get_permalink( $previous_post->ID )); ?>"><img src="<?php echo wp_kses_post($prev_img_url[0]); ?>" /></a>
                                        </div>
                                    <?php endif; ?>
                                    <div class="pxl--meta">
                                        <a  href="<?php echo esc_url(get_permalink( $previous_post->ID )); ?>"><?php echo get_the_title( $previous_post->ID ); ?></a>
                                    </div>
                                </div>
                            <?php } ?>
                        </div>
                        <?php if ( get_option( 'page_for_posts' ) ) {
                            $post_id = get_option( 'page_for_posts' ); ?>
                            <div class="pxl-item-button">
                                <a href="<?php echo esc_url(get_permalink( $post_id )); ?>"><i class="flaticon-menu-2"></i></a>
                            </div>
                        <?php } ?>
                        <div class="pxl--item pxl--item-next">
                            <?php if ( is_a( $next_post , 'WP_Post' ) && get_the_title( $next_post->ID ) != '') {
                                $next_img_id = get_post_thumbnail_id($next_post->ID);
                                $next_img_url = wp_get_attachment_image_src($next_img_id, 'hubsteel-thumb-xs');
                                ?>
                                <a class="pxl--label" href="<?php echo esc_url(get_permalink( $next_post->ID )); ?>"><span><?php echo esc_html__('Next Post', 'hubsteel'); ?></span><i class="caseicon-double-chevron-right"></i></a>
                                <div class="pxl--holder">
                                    <div class="pxl--meta">
                                        <a href="<?php echo esc_url(get_permalink( $next_post->ID )); ?>"><?php echo get_the_title( $next_post->ID ); ?></a>
                                    </div>
                                    <?php if(!empty($next_img_id)) : ?>
                                        <div class="pxl--img">
                                            <a href="<?php echo esc_url(get_permalink( $next_post->ID )); ?>"><img src="<?php echo wp_kses_post($next_img_url[0]); ?>" /></a>
                                        </div>
                                    <?php endif; ?>
                                </div>
                            <?php } ?>
                        </div>
                    </div><!-- .nav-links -->
                </div>
            <?php }
        }

        public function get_post_author_info() { ?>
            <div class="pxl-post--author-info pxl-item--flexnw">
                <div class="pxl-post--author-image pxl-mr-30"><?php echo get_avatar( get_the_author_meta( 'ID' ), 280 ); ?></div>
                <div class="pxl-post--author-meta">
                    <?php hubsteel_get_user_name(); ?>
                    <div class="pxl-post--author-description"><?php the_author_meta( 'description' ); ?></div>
                    <?php hubsteel_get_user_social(); ?>
                </div>
            </div>
        <?php }

        public function get_related_post(){
            $post_related_on = hubsteel()->get_theme_opt( 'post_related_on', false );

            if($post_related_on) {
                global $post;
                $current_id = $post->ID;
                $posttags = get_the_category($post->ID);
                if (empty($posttags)) return;

                $tags = array();

                foreach ($posttags as $tag) {

                    $tags[] = $tag->term_id;
                }
                $post_number = '6';
                $query_similar = new WP_Query(array('posts_per_page' => $post_number, 'post_type' => 'post', 'post_status' => 'publish', 'category__in' => $tags));
                if (count($query_similar->posts) > 1) {
                    wp_enqueue_script( 'swiper' );
                    wp_enqueue_script( 'pxl-swiper' );
                    $opts = [
                        'slide_direction'               => 'horizontal',
                        'slide_percolumn'               => '1', 
                        'slide_mode'                    => 'slide', 
                        'slides_to_show'                => 3, 
                        'slides_to_show_lg'             => 3, 
                        'slides_to_show_md'             => 2, 
                        'slides_to_show_sm'             => 2, 
                        'slides_to_show_xs'             => 1, 
                        'slides_to_scroll'              => 1, 
                        'slides_gutter'                 => 30, 
                        'arrow'                         => false,
                        'dots'                          => true,
                        'dots_style'                    => 'bullets'
                    ];
                    $data_settings = wp_json_encode($opts);
                    $dir           = is_rtl() ? 'rtl' : 'ltr';
                    ?>
                    <div class="pxl-related-post">
                        <h4 class="widget-title"><?php echo esc_html__('Related Posts', 'hubsteel'); ?></h4>
                        <div class="class" data-settings="<?php echo esc_attr($data_settings) ?>" data-rtl="<?php echo esc_attr($dir) ?>">
                            <div class="pxl-related-post-inner pxl-swiper-wrapper swiper-wrapper">
                            <?php foreach ($query_similar->posts as $post):
                                $thumbnail_url = '';
                                if (has_post_thumbnail(get_the_ID()) && wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), false)) :
                                    $thumbnail_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'pxl-blog-small', false);
                                endif;
                                if ($post->ID !== $current_id) : ?>
                                    <div class="pxl-swiper-slide swiper-slide grid-item">
                                        <div class="pxl-grid-item-inner">
                                            <?php if (has_post_thumbnail()) { ?>
                                                <div class="item-featured">
                                                    <a href="<?php the_permalink(); ?>"><img src="<?php echo esc_url($thumbnail_url[0]); ?>" /></a>
                                                </div>
                                            <?php } ?>
                                            <h3 class="item-title">
                                                <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                                            </h3>
                                        </div>
                                    </div>
                                <?php endif;
                            endforeach; ?>
                            </div>
                        </div>
                    </div>
                <?php }
            }

            wp_reset_postdata();
        }
    }
}
