Created
January 19, 2026 13:21
-
-
Save xlplugins/384b5a28ed22a627fcac8b6fb0f77168 to your computer and use it in GitHub Desktop.
Add JS code in header for specific sales page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'wp_head', 'wffn_custom_script_on_landing_option_page' ); | |
| function wffn_custom_script_on_landing_option_page() { | |
| global $post; | |
| if ( is_null( $post ) ) { | |
| return; | |
| } | |
| // Check if the post ID matches the specific sales page ID (replace 123 with your desired page ID) | |
| $target_page_id = 104; // Replace with the sales page ID where you want the script to run | |
| if ( $post->ID != $target_page_id ) { | |
| return; | |
| } | |
| // Check if the post type matches the desired types | |
| if ( ! in_array( $post->post_type, array( | |
| //'wfacp_checkout', | |
| //'wfocu_offer', | |
| 'wffn_landing', | |
| //'wffn_ty', | |
| //'wffn_optin', | |
| //'wffn_oty', | |
| ), true ) ) { | |
| return; | |
| } | |
| ?> | |
| <script type="text/javascript"> | |
| jQuery(document).ready(function () { | |
| alert("Page loaded successfully!"); | |
| }); | |
| </script> | |
| <?php | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment