This file contains 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 Page Terms (Taxonomy) to Body Tag | |
*/ | |
function pro_page_taxonomy_class_to_body( $classes ){ | |
if ( $pageTaxonomy = get_the_terms( get_the_ID(), 'my_taxonomy_slug' ) ) { | |
foreach( $taxonomyTerm as $term ){ | |
if(is_array($term)){ | |
if(!empty($term['slug'])){ | |
$termClass = 'mytaxonomy-' . $term['slug']; | |
array_push( $classes, $termClass ); |
This file contains 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
// Preload Featured Images | |
function propel_add_cwv_code(){ | |
global $post; | |
// Run code only for Single post page | |
if( is_admin() ){ | |
return; | |
} | |
$post_id = $post->ID; |
This file contains 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
/** | |
* This code first retrieves all the anchor elements in the page using document.querySelectorAll('a'). | |
* Then it filters out the anchor elements that are inside <head>, <header>, or <footer> tags. | |
* After that, it extracts the "href" attribute of each remaining anchor element. | |
* Finally, it filters out the URLs that are pointing to other pages on the same domain. | |
*/ | |
const isNestedInTags = (element) => { | |
const allowedTags = ['head', 'header', 'footer']; | |
let parent = element.parentElement; | |
while (parent) { |