Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
functions.php
. Absolutely make sure you're using a child theme if you want to keep these changes in the long-term. If you don't, and then update your theme, you'll lose the changes.functions.php
file, you can add one of the following, where we understand that if you're trying to add it to a post, you use is_single()
and if trying to add it to a page, you use is_page()
. Also, within the parenthesis you will add the Post or Page ID for the correct page. It is a number like is_single(17)
. If you want to add the same code to multiple pages you can use an array like this: is_single(array(17,28,37))
/* For Adding Scripts to the Header on a Specific Post (using Page ID): */
function ryu_head_script() {
if ( is_single(17) ) {
echo ' your script goes in these quotations ';
}
}
add_action('wp_head', 'ryu_head_script');
/* For Adding Scripts to the Footer on a Specific Post (using Page ID): */
function ryu_foot_script() {
if ( is_single(17) ) {
echo ' your script goes in these quotations ';
}
}
add_action('wp_footer', 'ryu_foot_script');
/* For Adding Scripts After Body Tag Opens on a Specific Post (using Page ID): */
function ryu_body_script() {
if ( is_single(17) ) {
echo ' your script goes in these quotations ';
}
}
add_action('wp_body', 'ryu_body_script');
wp_body()
is new, really new. It's unlikely your theme has it integrated. But if so, or you have a child theme and want to add it yourself, it's fairly simple to use. You can place the hook <?php wp_body(); ?>
at the opening of the body tag or right before it closes, depending on your needs.