Add script to footer – on post editor

Hook into ‘admin_footer-post-new.php’ and ‘admin_footer-post.php’, check the global variable $post_type: add_action( ‘admin_footer-post-new.php’, ‘wpse_73692_script’ ); add_action( ‘admin_footer-post.php’, ‘wpse_73692_script’ ); function wpse_73692_script() { if ( ‘post’ !== $GLOBALS[‘post_type’] ) return; ?> <script>alert( ‘<?php echo $GLOBALS[‘post_type’];?>’ );</script> <?php }

How can I remove “Proudly powered by WordPress” from twentyeleven without modifying footer.php?

There are 3 methods. Somewhat weird but since this text is internationalized you can filter the output. This is just an example to remove the text, the link is still present in the source. add_filter(‘gettext’, ‘remove_powered_by’, 20, 3); function remove_powered_by( $translated_text, $untranslated_text, $domain ) { $custom_field_text=”Proudly powered by %s”; if ( !is_admin() && $untranslated_text === … Read more

How to remove “Proudly powered by WordPress” in Twenty Sixteen (2016) theme?

The quick and dirty way would be to either delete the two lines that are ‘resposible’ for the message, or wrap them by comments / comment-them-out. In your theme folder ‘twentysixteen’ look for the theme file ‘footer.php’ Around line 50 look for the following two lines: <span class=”site-title”><a href=”https://wordpress.stackexchange.com/questions/230348/<?php echo esc_url( home_url(“https://wordpress.stackexchange.com/” ) ); ?>” … Read more

How to add JS in footer

By Using wp_enqueue_script() You can add your scripts to a JS file and then enqueue it properly. I assume you have added your scripts to file.js. Here’s how you enqueue it in the footer: add_action(‘wp_enqueue_scripts’,’my_script_callback’); function my_script_callback(){ wp_enqueue_script( ‘my-script’, get_template_directory_uri().’/folder/file.js’, array(jquery), null, true ); } The last argument in wp_enqueue_script() determines whether your script should … Read more

wp_enqueue script my_javascript_file in the footer

You have true set in the 4th parameter (version), not the 5th. wp_enqueue_script( ‘my_javascript_file’, //slug get_template_directory_uri() . ‘/javascripts/app.js’, //path array(‘jquery’), //dependencies false, //version true //footer ); Also, as someone else mentioned, drop jquery enqueue, you’ve got it as a dependency, you don’t need to enqueue it as well. One last thing, your function name has … Read more

How to add code to just before closing body tag

If you’re just using a small script or other markup, you can hook a function to the wp_footer filter, which should be included in all properly-coded themes: add_action( ‘wp_footer’, function () { ?> <script language=”javascript” type=”text/javascript”> startcart() </script> <?php } ); However, if your JavaScript code is more substantial, or you wish to use built-in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)