storing wp_head in a variable?
This function doesn’t take any params, so there is no nice way of doing it. But of course you can do this PHP way using output buffering 😉 ob_start(); wp_head(); $var = ob_get_clean();
This function doesn’t take any params, so there is no nice way of doing it. But of course you can do this PHP way using output buffering 😉 ob_start(); wp_head(); $var = ob_get_clean();
Its not safe and not recommended. Thats action that read all Javascripts, CSS from other plugins or theme. Hide your footer with css or theme option. #footer,footer{display:none!important}
It is not possible to override header/footer via hooks in respective get_header()/get_header() functions. However it is often overlooked that these function allow input and loading different headers. For example get_header( ‘nested/header’ ); will look for header-nested/header.php in theme’s folder. It’s kind of a hack in regards to subdirectory use, but it works. 🙂
If you look at the source code, you can see that wp_enqueue_style( ‘crayon’ ) is called in Crayon::enqueue_resources() which itself is called either from either Crayon::the_content() or Crayon::wp_head(). The code in Crayon::wp_head is: if (!CrayonGlobalSettings::val(CrayonSettings::EFFICIENT_ENQUEUE) || CrayonGlobalSettings::val(CrayonSettings::TAG_EDITOR_FRONT)) { CrayonLog::debug(‘head: force enqueue’); // Efficient enqueuing disabled, always load despite enqueuing or not in the_post self::enqueue_resources(); } … Read more
First a bit of advise (since the solution is based on it) – always “enqueue” your scripts, don’t just add them in the footer. Read this, for example . Now the solution for loading scripts on specific template, since this is what you asked for: function enqueue_themescrits() { if ( is_page_template(‘contact.php’) ) { //the file … Read more
There’s an in_footer parameter that you can pass to wp_enqueue_scripts – does that work? I would hook to admin_enqueue_scripts, check the $page for location, and enqueue your script there, with ‘in_footer’ as true. Example: add_action( ‘admin_enqueue_scripts’, ‘enqueue_my_script’ ); function enqueue_my_script( $page ) { if ($page !== ‘edit.php’) return; wp_enqueue_script( ‘my-script’, ‘http://path/to/my/local/script’, null, null, true ); … Read more
Move jQuery and Migrate to footer?
This could be multiple things. I’m not sure what the credits do. However, the chance is quite big that the search field is being created by a widget, shown in the get_sidebar(‘main’). Under “Appearance” > “Widgets”, you should be able to find more information. The template being called is probably sidebar-main.php. If it is a … Read more
You can use the script_loader_tag hook function enqueue_validation_script() { wp_register_script( ‘validation’, ‘https://www.asd.in/script.php?id=3ff00a469474bbe71a9218a7f0377518’, array( ‘jquery’ ) ); wp_enqueue_script( ‘validation’ ); } add_action(‘wp_enqueue_scripts’, ‘enqueue_validation_script’); function add_id_to_validation_script( $tag, $handle, $src ) { if ( ‘validation’ === $handle ) { $tag = ‘<script type=”text/javascript” id=”3ff00a469474bbe71a9218a7f0377518″ src=”‘.$src.'”></script>’; } return $tag; } add_filter( ‘script_loader_tag’, ‘add_id_to_validation_script’, 10, 3 );
What may be easier (if you don’t necessarily want all the same menu items to appear in the footer) is to: Create a new menu, “Footer Menu” for example Add-in whatever links (pages) are needed there Add a widget (called Custom Menu) to a footer widget position (if your current theme supports it). Let me … Read more