I have a page that displays latest posts from specific category via gutenberg's block. Now I would like to add "New" label at the top left corner on the posts' images. I found inside
wp-includes/blocks/latest-posts.php
the code for this block and add a custom hook inside of it
add_action( 'da_custom_labels', 'render_block_core_latest_posts' );
After that, I wrote inside my functions.php the function for the hook:
add_filter('da_custom_labels','da_custom_labels_sales_posts');
function da_custom_labels_sales_posts() {
echo get_post_meta( get_the_ID(), 'new_real_estate', true ); //custom field
}
I tried many different things, but all the labels appear at one row.. Sothing like this:
NewNewNewNewNewNew
<ul>
<li> ... </li>
<li> ... </li>
<li> ... </li>
<li> ... </li>
</ul>
Thus, I would like to have the "New" label inside every li and not like that, so I could apply CSS and anything else necessary.
Any ideas how I could accomplise that? Or any other work arround - solution?
thanks in advance
After some research, I could not find any proper hook or filter in order to add my own custom functions. Thus, best way to do this is by overwritting the block itself. Inside
functions.phpofchild themeI have add the below code:of course, it could be done via a custom plugin for better managing and organizing your files. Hope that helps