inline short code
font awesome [my_year] test
[icon name=”heart” prefix=”fas”] heart
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
When a fixed inline shortcode (for example, Font Awesome Plugin) was inserted inside a block element, the shortcode was treated as a block so far, so the layout was broken. Changed to display inline if the HTML generated by the shortcode does not contain the block element.
Due to this change, if the return value of the shortcode does not include the html block element, you should place the shortcode inside the element such as a paragraph without using the shortcode block.
function my_current_year( ) {
return date('Y');
}
add_shortcode( 'my_year', 'my_current_year' );
front end
<span class="shortcode-wrapper wrap-my_year emulsion-current-color">2022</span>
function my_current_year2( ) {
return sprintf('<p>%1$s</p>', date('Y') );
}
front end
<div class="shortcode-wrapper wrap-my_year2 emulsion-current-color">
<p>2022</p>
</div>