HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/MvAlphen/va-bo.nl/wwwroot/wp-content/plugins/hattan-plugin/modules/VC_News.php
<?php

if (!class_exists('VC_News')) {

    class VC_News {

        private $shortcode_name = 'studiothemes_news';
        function __construct() {
            add_action('admin_init', array($this, 'studiothemes_shortcode_init'));
            add_shortcode( $this->shortcode_name, array( $this, 'studiothemes_shortcode' ) );
        }

        function studiothemes_shortcode_init() {
            if (function_exists('vc_map')) {
                vc_map(array(
                    "name" => "News",
                    "base" => $this->shortcode_name,
                    "category" => 'by Studio Themes',
                    "icon" => "",
                    "params" => array(
                        array(
                            "type" => "textfield",
                            "holder" => "",
                            "class" => "",
                            "heading" => __("Number Posts", 'hattan-plugin'),
                            "param_name" => "number_posts",
                            "value" => "4",
                            "description" => ""
                        )
                    )
                )
            );}
        }

        function studiothemes_shortcode($atts, $content = null) {
            $output = $number_posts ='';

            $args = array(
                'number_posts'=>''
            );
            extract(shortcode_atts($args, $atts));
            wp_reset_query();
            wp_reset_postdata();  
            $args = array( 'posts_per_page' => $number_posts);
            global $post;
            $myposts = get_posts( $args );

            foreach ( $myposts as $post ) : setup_postdata( $post ); 
                echo "<article class=\"post-blog\">
                    <header>
                        <h3><a href=\"".get_permalink()."\">".get_the_title()."</a></h3>
                        07 October 2014
                        <span>|</span>";
                         _e('Posted by ',EF1_THEME_NAME);
                        echo the_author_posts_link();
                        echo "<span>|</span>";
                        $format = get_post_format();
                        if ( false === $format ) { $format = 'Standard';}
                        echo $format;
                        echo "<span>|</span>";
                        $output .=" <a href=\"".get_comments_link()."\">".comments_number(__('No responses',EF1_THEME_NAME), __('1 Response',EF1_THEME_NAME), __('% Responses',EF1_THEME_NAME))."</a>";
                  echo " </header></article>";
            endforeach;
            wp_reset_postdata();
            wp_reset_query();

        }

    }

    // Finally initialize code
    new VC_News();
}