__( 'Custom widget for recent posts with image and description', 'artfolio' ), ) ); } // Open code for widget public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['title'] ); $number = apply_filters( 'widget_number', absint( $instance['number'] )); echo $args['before_widget']; if ( !empty( $title ) ) { echo $args['before_title'] . $title . $args['after_title']; } $art_recent_posts = new WP_Query(); $art_recent_posts->query('showposts='.$number); while ( $art_recent_posts->have_posts() ) { $art_recent_posts->the_post(); ?>
tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); add_image_size( 'artfolio-recent-thumbnails', 100, 100, true ); // Sets Recent Posts Thumbnails add_image_size( 'large-thumbnails', 1280, 220, true ); // Sets Large post thumbnails for header in single post section add_image_size( 'small-thumbnails', 780, 300, true ); // Sets Small post thumbnails for posts in index post section // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary', 'artfolio' ), 'social' => __( 'Social Menu', 'artfolio'), 'landing' => __( 'Landing Menu', 'artfolio' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); /* * Enable support for Post Formats. * See https://developer.wordpress.org/themes/functionality/post-formats/ */ add_theme_support( 'post-formats', array( 'aside' ) ); /* * Enable support for Custom logo. * See http://codex.wordpress.org/Function_Reference/add_theme_support#Custom_Logo */ add_theme_support( 'custom-logo', array( 'height' => 130, 'width' => 130, 'flex-width' => false, ) ); } endif; add_action( 'after_setup_theme', 'artfolio_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function artfolio_content_width() { $GLOBALS['content_width'] = apply_filters( 'artfolio_content_width', 700 ); } add_action( 'after_setup_theme', 'artfolio_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function artfolio_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'artfolio' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'artfolio' ), 'before_widget' => '', 'before_title' => '