I am trying to add a content before checkout form in LearnPress so I created a custom checkout page inside child theme using the following code:
function custom_content_before_checkout() {
// Check if the current page has a post ID of 1463
if (is_page(1463)) {
echo '<div class="custom-content">';
echo '<table>';
echo '<tr><th>Header 1</th><th>Header 2</th></tr>';
echo '<tr><td>Data 1</td><td>Data 2</td></tr>';
echo '<tr><td>Data 3</td><td>Data 4</td></tr>';
echo '</table>';
echo '</div>';
}
}
add_action('learn_press_checkout_before_checkout_form', 'custom_content_before_checkout');
No content showed on the front-page.
I created the above-listed function code and I want to know what's wrong with the code
The original code I had though was good but did not work for what I was trying to do and it took me a day to figure out that it's just more simple than I thought.
Here is how I solved the problem:
The only problem I wish I could solve is to add the content via the editor but I am okay adding and styling the content inside the child theme code