How to store wordpress functions (wp_head(),wp_footer()) in a javascript variable?
How to store wordpress functions (wp_head(),wp_footer()) in a javascript variable?
How to store wordpress functions (wp_head(),wp_footer()) in a javascript variable?
Okay, so after some more tinkering, I found another solution. This one works with or without the loop. So adding it in the template file or your single.php is fine, in the <head> of the HTML. <?php $tags = get_the_tags($post->ID); ?> <?php foreach($tags as $tag) : ?> <meta property=”article:tag” content=”<?php print_r($tag->name);?>” /> <?php endforeach; ?> … Read more
Probably because when the execution is hitting your code is already too late to hook on wp_head. If you want to have your code in image.php, make sure you place it before get_header(). In any case, I would move the code to functions.php or dedicated file and maybe use is_attachment() to conditionally print the meta … Read more
How do I get a reference to the HTML memory buffer while the page is being constructed?
Wp_head () affecting my images layout
It’s better to use PHP to remove things when possible, because if you just use JS, they’re still technically there on the page. What if a visitor is on a slow-loading network and the JS doesn’t kick in for a long time, so they see the filters long enough to use them? If you can … Read more
Getting the contents of wp_head while in admin?
My solution removes now all <link></link> tags and <style>@import url()</style> googleapi entries in the given HTML: add_action( ‘wp_footer’, ‘SPDSGVOPublic::removeGoogleFonts’ ); /** * Remove all occurrences of google fonts */ public static function removeGoogleFonts() { ob_start(); $content = ob_get_clean(); $patternImportUrl=”/(@import[\s]url\((?:”|\”)((?:https?:)?\/\/fonts\.googleapis\.com\/css(?:(?!\1).)+)(?:”|\’)\)\;)/’; $patternLinkTag = ‘/<link(?:\s+(?:(?!href\s*=\s*)[^>])+)?(?:\s+href\s*=\s*([\'”])((?:https?:)?\/\/fonts\.googleapis\.com\/css(?:(?!\1).)+)\1)(?:\s+[^>]*)?>/’; preg_match_all($patternImportUrl, $content, $matchesImportUrl); preg_match_all($patternLinkTag, $content, $matchesLinkTag); $matches = array_merge($matchesImportUrl,$matchesLinkTag); foreach( $matches as $match … Read more
ok so I figured this out. Here are the steps I took Create a php file in your themes directory wordpress Dir -> Themes -> YOUR THEME NAME -> newfile.php In this file add the following: <?php /* Template Name: theme-child */ ?> <?php get_header(); ?> // your custom script here <?php get_footer(); ?> **Then … Read more
Add a top bar to a wordpress theme without editing the header.php file?