Support

Account

Home Forums Feature Requests Get custom field inside query loop block Reply To: Get custom field inside query loop block

  • @nicmare I apologize. Completely my mistake on the formatting.

    add_filter( 'render_block_core/post-title', function( $block_content, $block ) {
    	if(!empty($block["attrs"]["className"]) && $block["attrs"]["className"] == "duration") {
    		return sprintf("<div style='margin-bottom:%s'><strong>%s</strong></div>%s","10px",get_field("clip_duration"),$block_content);
    	} else if (!empty($block["attrs"]["className"]) && $block["attrs"]["className"] == "readAuthor") {
    		$author = get_field('author');
    		foreach( $author as $theAuthor ) {
    			$authorName = get_the_title( $theAuthor->ID );	
    		}
    		return sprintf("<h4>Read / %s</h4>",$authorName,$block_content);
    	} else {
    		return $block_content;
    	}
    }, 10, 2 );