FM

/home/u523506497/domains/mymelon.in/public_html/aggrigate/wp-includes/blocks UP

<?php
/**
 * Server-side rendering of the `core/post-template` block.
 *
 * @package WordPress
 */

/**
 * Determines whether a block list contains a block that uses the featured image.
 *
 * @since 6.0.0
 *
 * @param WP_Block_List $inner_blocks Inner block instance.
 *
 * @return bool Whether the block list contains a block that uses the featured image.
 */
function block_core_post_template_uses_featured_image( $inner_blocks ) {
	foreach ( $inner_blocks as $block ) {
		if ( 'core/post-featured-image' === $block->name ) {
			return true;
		}
		if (
			'core/cover' === $block->name &&
			! empty( $block->attributes['useFeaturedImage'] )
		) {
			return true;
		}
		if ( $block->inner_blocks && block_core_post_template_uses_featured_image( $block->inner_blocks ) ) {
			return true;
		}
	}

	return false;
}

/**
 * Renders the `core/post-template` block on the server.
 *
 * @since 6.3.0 Changed render_block_context priority to `1`.
 *
 * @global WP_Query $wp_query WordPress Query object.
 *
 * @param array    $attributes Block attributes.
 * @param string   $content    Block default content.
 * @param WP_Block $block      Block instance.
 *
 * @return string Returns the output of the query, structured using the layout defined by the block's inner blocks.
 */
function render_block_core_post_template( $attributes, $content, $block ) {
	$page_key            = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
	$enhanced_pagination = (bool) ( $block->context['enhancedPagination'] ?? false );
	$page                = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];

	// Use global query if needed.
	$use_global_query = (bool) ( $block->context['query']['inherit'] ?? false );
	if ( $use_global_query ) {
		global $wp_query;

		/*
		 * If already in the main query loop, duplicate the query instance to not tamper with the main instance.
		 * Since this is a nested query, it should start at the beginning, therefore rewind posts.
		 * Otherwise, the main query loop has not started yet and this block is responsible for doing so.
		 */
		if ( in_the_loop() ) {
			$query = clone $wp_query;
			$query->rewind_posts();
		} else {
			$query = $wp_query;
		}
	} else {
		$query_args = build_query_vars_from_query_block( $block, $page );
		$query      = new WP_Query( $query_args );
	}

	if ( ! $query->have_posts() ) {
		return '';
	}

	if ( block_core_post_template_uses_featured_image( $block->inner_blocks ) ) {
		update_post_thumbnail_cache( $query );
	}

	$classnames = '';
	if ( isset( $block->context['displayLayout'] ) && isset( $block->context['query'] ) ) {
		if ( isset( $block->context['displayLayout']['type'] ) && 'flex' === $block->context['displayLayout']['type'] ) {
			$classnames = "is-flex-container columns-{$block->context['displayLayout']['columns']}";
		}
	}
	if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
		$classnames .= ' has-link-color';
	}

	// Ensure backwards compatibility by flagging the number of columns via classname when using grid layout.
	if ( isset( $attributes['layout']['type'] ) && 'grid' === $attributes['layout']['type'] && ! empty( $attributes['layout']['columnCount'] ) ) {
		$classnames .= ' ' . sanitize_title( 'columns-' . $attributes['layout']['columnCount'] );
	}
	if ( isset( $attributes['layout']['type'] ) && 'grid' === $attributes['layout']['type'] && ! empty( $attributes['layout']['columnCount'] ) && ! empty( $attributes['layout']['minimumColumnWidth'] ) ) {
		$classnames .= ' has-native-responsive-grid';
	}

	$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => trim( $classnames ) ) );

	$content = '';
	while ( $query->have_posts() ) {
		$query->the_post();

		// Get an instance of the current Post Template block.
		$block_instance = $block->parsed_block;

		// Set the block name to one that does not correspond to an existing registered block.
		// This ensures that for the inner instances of the Post Template block, we do not render any block supports.
		$block_instance['blockName'] = 'core/null';

		$post_id              = get_the_ID();
		$post_type            = get_post_type();
		$filter_block_context = static function ( $context ) use ( $post_id, $post_type ) {
			$context['postType'] = $post_type;
			$context['postId']   = $post_id;
			return $context;
		};

		// Use an early priority to so that other 'render_block_context' filters have access to the values.
		add_filter( 'render_block_context', $filter_block_context, 1 );
		// Render the inner blocks of the Post Template block with `dynamic` set to `false` to prevent calling
		// `render_callback` and ensure that no wrapper markup is included.
		$block_content = ( new WP_Block( $block_instance ) )->render( array( 'dynamic' => false ) );
		remove_filter( 'render_block_context', $filter_block_context, 1 );

		// Wrap the render inner blocks in a `li` element with the appropriate post classes.
		$post_classes = implode( ' ', get_post_class( 'wp-block-post' ) );

		$inner_block_directives = $enhanced_pagination ? ' data-wp-key="post-template-item-' . $post_id . '"' : '';

		$content .= '<li' . $inner_block_directives . ' class="' . esc_attr( $post_classes ) . '">' . $block_content . '</li>';
	}

	/*
	 * Use this function to restore the context of the template tags
	 * from a secondary query loop back to the main query loop.
	 * Since we use two custom loops, it's safest to always restore.
	*/
	wp_reset_postdata();

	return sprintf(
		'<ul %1$s>%2$s</ul>',
		$wrapper_attributes,
		$content
	);
}

/**
 * Registers the `core/post-template` block on the server.
 *
 * @since 5.8.0
 */
function register_block_core_post_template() {
	register_block_type_from_metadata(
		__DIR__ . '/post-template',
		array(
			'render_callback'   => 'render_block_core_post_template',
			'skip_inner_blocks' => true,
		)
	);
}
add_action( 'init', 'register_block_core_post_template' );
accordion-
accordion-heading-
accordion-item-
accordion-item.php3052V
accordion-panel-
accordion.php1147V
archives-
archives.php4385V
audio-
avatar-
avatar.php5638V
block-
block.php3122V
blocks-json.php210661V
breadcrumbs-
breadcrumbs.php19057V
button-
button.php4211V
buttons-
calendar-
calendar.php6075V
categories-
categories.php4938V
code-
column-
columns-
comment-author-name-
comment-author-name.php2136V
comment-content-
comment-content.php2459V
comment-date-
comment-date.php1865V
comment-edit-link-
comment-edit-link.php1713V
comment-reply-link-
comment-reply-link.php2075V
comment-template-
comment-template.php4494V
comments-
comments-pagination-
comments-pagination-next-
comments-pagination-next.php1924V
comments-pagination-numbers-
comments-pagination-numbers.php1632V
comments-pagination-previous-
comments-pagination-previous.php1790V
comments-pagination.php1261V
comments-title-
comments-title.php2787V
comments.php6784V
cover-
cover.php7404V
details-
details.php1498V
embed-
file-
file.php1879V
footnotes-
footnotes.php3818V
freeform-
gallery-
gallery.php22345V
group-
heading-
heading.php1301V
home-link-
home-link.php4703V
html-
icon-
icon.php4374V
image-
image.php17642V
index.php5104V
latest-comments-
latest-comments.php5622V
latest-posts-
latest-posts.php10459V
legacy-widget-
legacy-widget.php4011V
list-
list-item-
list.php1273V
loginout-
loginout.php2123V
math-
media-text-
media-text.php4298V
missing-
more-
navigation-
navigation-link-
navigation-link.php16654V
navigation-overlay-close-
navigation-overlay-close.php1765V
navigation-submenu-
navigation-submenu.php11050V
navigation.php70892V
nextpage-
page-list-
page-list-item-
page-list-item.php361V
page-list.php13863V
paragraph-
paragraph.php1139V
pattern-
pattern.php1788V
playlist-
playlist-track-
playlist-track.php2487V
playlist.php6616V
post-author-
post-author-biography-
post-author-biography.php1524V
post-author-name-
post-author-name.php1962V
post-author.php2734V
post-comments-count-
post-comments-count.php1275V
post-comments-form-
post-comments-form.php2805V
post-comments-link-
post-comments-link.php2237V
post-content-
post-content.php2668V
post-date-
post-date.php3692V
post-excerpt-
post-excerpt.php4315V
post-featured-image-
post-featured-image.php9452V
post-navigation-link-
post-navigation-link.php4807V
post-template-
post-template.php5940V
post-terms-
post-terms.php3640V
post-time-to-read-
post-time-to-read.php6411V
post-title-
post-title.php2138V
preformatted-
pullquote-
query-
query-no-results-
query-no-results.php1847V
query-pagination-
query-pagination-next-
query-pagination-next.php3676V
query-pagination-numbers-
query-pagination-numbers.php4700V
query-pagination-previous-
query-pagination-previous.php3473V
query-pagination.php1176V
query-title-
query-title.php2771V
query-total-
query-total.php2471V
query.php5690V
quote-
read-more-
read-more.php1846V
require-dynamic-blocks.php5256V
require-static-blocks.php535V
rss-
rss.php4609V
search-
search.php25600V
separator-
shortcode-
shortcode.php735V
site-logo-
site-logo.php6334V
site-tagline-
site-tagline.php1203V
site-title-
site-title.php1864V
social-link-
social-link.php67602V
social-links-
spacer-
tab-list-
tab-list.php2322V
tab-panel-
tab-panel.php1669V
tab-panels-
table-
tabs-
tabs.php3949V
tag-cloud-
tag-cloud.php1586V
template-part-
template-part.php9964V
term-count-
term-count.php1843V
term-description-
term-description.php1770V
term-name-
term-name.php2038V
term-template-
term-template.php4518V
terms-query-
text-columns-
verse-
video-
video.php2733V
widget-group-
widget-group.php2438V
Career - My Melon - Digital Marketing & Creative Agency
Skip to content Skip to footer

We feel delighted to help people discover what they have been looking for!

Digital is the greatest platform for the ever-evolving Bharat. We are on the constant lookout for smarts who could help us improve the change. While working with us, you will help businesses, communities and changemakers unfold their business plans, big challenges, and harness success. So if work is your play and if you only choose to pursue what feels like a mind-boggling  f**k yes, then connect with our HR department.

Back - Career Page
Front - Career Page
There is no form selected or the form was deleted.