I have the following piece of PHP code as part of my site theme. Where I am stuck is, if the value of $sec_title contains an apostrophe, then the text doesn't display. But without an apostrophe, it contains fine. How can I amend this to prevent this issue?
<?php
if ( $sec_title ) {
echo do_shortcode( "[onex_section_header
title={$sec_title}
subtitle='{$sec_subtitle}']"
);
} ?>