Using a code editor, copy & paste the PHP code from the view raw link in the Gist to the end of your child themes functions file or custom functionality plugin.
Review Form Hooks
Using the comment form hooks native to WordPress, these are the hooks you can use to position your text for single product reviews:
comment_form_before
comment_form_top
comment_form
comment_form_after
Hook Positioning
Shows the exact position in the comment form the hook will output.
About The Code
- Uses the
comment_form_after
hook to control the positioning of the text beside the submit reviews button - Uses the
is_product()
conditional tag to print the output on single product pages only - Uses the
esc_html_e
function to print translated text that has been escaped for safe use in HTML output
Text Line Height – CSS
You can then add some CSS to the end of your child themes style sheet to position your text.
@media only screen and (min-width: 600px) {
.single-product .comment-form .submit-reviews-notice {
line-height: 2.2;
}}
And here’s the result displaying vertically inline with the submit button.
Leave a Reply
You must be logged in to post a comment.