Get the thumbnail

@param \WP_Post $the_post The post.
@param array    $args	 The query args.
@return array
507599
public static function get_thumbnail( $the_post, $args ) {
		$thumbnail = [
			'src' 		=> '',
			'width'		=> '',
			'height'	=> '',
			'alt'		=> '',
		];

		if ( has_post_thumbnail( $the_post->ID ) ) {
			$size = apply_filters( Filter::THUMBNAIL_SIZE, 'thumbnail', $the_post, $args );

			$attachment_id = get_post_thumbnail_id( $the_post->ID );

			$src = wp_get_attachment_image_src( $attachment_id, $size );

			$alt = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true );

			$thumbnail = [
				'src' 		=> $src[0],
				'width'		=> $src[1],
				'height'	=> $src[2],
				'alt'		=> $alt ? $alt : $the_post->post_title,
			];
		}

		return $thumbnail;
	}
231738
protected function getThumbnailParams($viewMode = null)
    {
        $result = [
            'mode' => 'crop',
            'ext' => 'png'
        ];

        if ($viewMode) {
            if ($viewMode == self::VIEW_MODE_LIST) {
                $result['width'] = 75;
                $result['height'] = 75;
            }
            else {
                $result['width'] = 165;
                $result['height'] = 165;
            }
        }

        return $result;
    }
1024306
protected function postsArgs() {
		global $wp_query, $wp_rewrite;

		// Setting up default values based on the current URL.
		$pagenum_link    = html_entity_decode( get_pagenum_link() );
		$this->url_parts = explode( '?', $pagenum_link );

		// Get total number of pages.
		$total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;

		// Get the current page.
		$current = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;

		// Append the format placeholder to the base URL.
		$base = trailingslashit( $this->url_parts[0] ) . '%_%';

		// URL base depends on permalink settings.
		$format  = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
		$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';

		return [
			'base'    => $base,
			'format'  => $format,
			'total'   => $total,
			'current' => $current
		];
	}
356109
public static function displayItems ($post_type = 'any', array $args = array(), $callback = null, array $params = array())
    {
        $query = new \WP_Query(array_merge(array(
            'post_type' => $post_type
        ), $args));
        if ($query->have_posts()) {
            global $post;
            while ($query->have_posts()) {
                $query->the_post();
                if ($callback !== null)
                    call_user_func_array($callback, array_merge(array($post), $params));
            }
            wp_reset_postdata();
        }
        return $query;
    }
681289
protected function getThumbnail()
    {
        if (!$this->_thumbnail) {
            $types = $this->thumbnailTypes;

            if ($this->thumbnailType !== 'auto') {
                array_unshift($types, $this->thumbnailType);
            }

            foreach ($types as $type) {
                $thumb = $this->get('thumbnails.' . $type, false);

                if ($thumb) {
                    $thumb = $thumb instanceof ThumbnailImageMedium ? $thumb : MediumFactory::fromFile($thumb, ['type' => 'thumbnail']);
                    $thumb->parent = $this;
                }

                if ($thumb) {
                    $this->_thumbnail = $thumb;
                    break;
                }
            }
        }

        return $this->_thumbnail;
    }
590437
public function get_check( $arg ) {
		$item = $this->get( $arg );

		if ( ! $item ) {
			\WP_CLI::error( sprintf( $this->msg, $arg ) );
		}

		return $item;
	}
374972
public function callback($post, $args)
    {
        // If autosave...
        if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
            return isset($post->ID) ? $post->ID : null;
        }

        // Get field
        $fields = isset($args['args']) ? $args['args'] : null;

        // Check if fields are defined
        if (!$fields || empty($fields)) {
            throw new MetaboxException(Translate::t('metabox.errors.no_type_is_defined'));
        }

        $vars = [];

        // Display fields
        foreach ($fields as $field) {
            if (!$field) {
                continue;
            }

            $vars['fields'][] = $field->render([], [
                'template' => 'metabox',
                'post' => $post,
            ], false);
        }

        // Render view
        Render::view('metabox.html.twig', $vars, 'metabox');

        // Return post if it is asked
        return isset($post->ID) ? $post->ID : null;
    }
489613
public static function getPageCount($args = array())
    {
        $instance = Post\Factory::create(get_called_class());

        $posts_per_page = $instance->getPostsPerPage();
        $criteria = array(
            'post_type'=>$instance->getPostType(),
            'posts_per_page'=>-1
        );
        $criteria = array_merge($criteria, $args);

        $query = new \WP_Query($criteria);
        $n = 0;
        while ($query->have_posts()) {
            $n++;
            $query->next_post();
        }

        return ceil($n / $posts_per_page);
    }
1070934
protected function get_field( \WP_Post $post ){
        $fields = [];
        foreach( $this->get_field_arguments() as $key => $val ){
            $fields[] = sprintf('%s="%s"', $key, esc_attr($val));
        }
        return $this->build_input($this->get_data($post), $fields);
    }
889911
public function getFeaturedImage()
    {
        if ($this->featuredImage === null) {
            if ($imgId = get_post_thumbnail_id((int) $this->getId())) {
                $this->featuredImage = $this->postFactory->create(get_post($imgId));
            } else {
                $this->featuredImage = false;
            }
        }

        return $this->featuredImage;
    }
931044
public function get( $arg ) {
		$comment_id = (int) $arg;
		$comment    = get_comment( $comment_id );

		if ( null === $comment ) {
			return false;
		}

		return $comment;
	}
63297
public function getPostsForArgs($args, $postClass = '\TimberPost', $collection = false)
    {
        return $this->getTimberBridge()->getPosts($args, $postClass, $collection);
    }
350337
function meta_box_input( $post, $args )
	{
		// extract $args
		extract( $args );
		
		
		// classes
		$class = 'acf_postbox ' . $args['field_group']['options']['layout'];
		$toggle_class = 'acf_postbox-toggle';
		
		
		if( ! $args['show'] )
		{
			$class .= ' acf-hidden';
			$toggle_class .= ' acf-hidden';
		}
		
		
		// HTML
		if( $args['show'] )
		{
			$fields = apply_filters('acf/field_group/get_fields', array(), $args['field_group']['id']);
	
			do_action('acf/create_fields', $fields, $args['post_id']);
		}
		else
		{
			echo '<div class="acf-replace-with-fields"><div class="acf-loading"></div></div>';
		}
		
		
		// nonce
		echo '<div style="display:none">';
			echo '<input type="hidden" name="acf_nonce" value="' . wp_create_nonce( 'input' ) . '" />';
			?>
<script type="text/javascript">
(function($) {
	
	$('#<?php echo $id; ?>').addClass('<?php echo $class; ?>').removeClass('hide-if-js');
	$('#adv-settings label[for="<?php echo $id; ?>-hide"]').addClass('<?php echo $toggle_class; ?>');
	
})(jQuery);	
</script>
			<?php
		echo '</div>';
	}
452700
public function recount( $args ) {
		foreach ( $args as $id ) {
			wp_update_comment_count( $id );
			$post = get_post( $id );
			if ( $post ) {
				WP_CLI::log( "Updated post {$post->ID} comment count to {$post->comment_count}." );
			} else {
				WP_CLI::warning( "Post {$post->ID} doesn't exist." );
			}
		}
	}
1223829
public function update_archive_slug( $args, $post_type ) {
		if ( $post_type !== $this->post_type ) {
			return $args;
		}

		$args['has_archive'] = trim(
			wp_make_link_relative( get_permalink( $this->post_id ) ),
			'/'
		);

		return $args;
	}
574017
public static function get_post_twitter_image( $post ) {
		$image = get_post_meta( $post->ID, '_yoast_wpseo_twitter-image', true );

		if ( empty( $image ) ) {
			$image = self::get_fallback_image( $post );
		}

		return $image;
	}
69186
protected function get_post_id( $post = null ) {

		return is_a( 'WP_Post', $post ) ? $post->ID : ( is_numeric( $post ) ? absint( $post ) : get_queried_object_id() );

	}