ptrepka
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [Header Footer Code Manager] Add a script to the body of a pageHi!
There is a way around this “no hook issue”, though it needs a tiny bit of theme editing (and plugin for the time being).
1. First, edit you child theme header.php by finding the
<bodyopenning. This will show the plugin where to put the code.<body <?php body_class(); ?>> <?php do_action('hfcm_after_body_tag'); ?>2. Now, edit the plugin’s main file — 99robots-header-footer-code-manager.php by adding the following code past line 387
// Function to add snippets after BODY tag function hfcm_body_scripts() { hfcm_add_snippets( 'body' ); } add_action( 'hfcm_after_body_tag', 'hfcm_body_scripts' );3. Next enable the option in plugin panel by editing includes/hfcm-add-edit.php at line 250
250: $larray = array( 'header' => 'Header', 'body' => 'After BODY openning tag', 'before_content' => 'Before Content', 'after_content' => 'After Content', 'footer' => 'Footer' );and line 252
252: $larray = array( 'header' => 'Header', 'body' => 'After BODY opening tag', 'footer' => 'Footer' );4. And finally in includes/hfcm-list.php add the following after line 173 so you can see the location in the list view.
'body' => esc_html__( 'After BODY openning tag', '99robots-header-footer-code-manager' ),
Viewing 1 replies (of 1 total)