This file contains hidden or 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
<?php | |
$remote_site = 'https://' . basename(dirname(__FILE__)) . '.com'; | |
// Comment the line above and uncomment the following line if your local site url is not based on directory | |
// $remote_site = 'https://www.your-remote-site.com'; | |
if (!empty($_SERVER['DOCUMENT_ROOT']) && !empty($_SERVER['REQUEST_URI']) && preg_match('/^\/wp-content\/uploads\/(.*)$/', $_SERVER['REQUEST_URI'], $matches) && !file_exists($_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI'])) { | |
header('Location: ' . $remote_site . '/wp-content/uploads/' . $matches[1]); | |
exit; | |
} |
This file contains hidden or 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
<?php | |
/** | |
* Block: Hero | |
* -------------------------------- | |
* The hero block for all pages. | |
*/ | |
$block_data = get_fields(); | |
?> |
This file contains hidden or 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
/** | |
* Returns the company name of a NEPSE stock. | |
* | |
* @param {string} stockSymbol - The stock symbol to retrieve the company name for. | |
* @return {string} The company name of the specified stock. | |
* @customfunction | |
*/ | |
function getCompanyName(stockSymbol) { | |
if (!stockSymbol) return '#SYMBOL_MISSING'; | |
const response = UrlFetchApp.fetch("https://nepse-test.vercel.app/api?symbol=" + stockSymbol); |
This file contains hidden or 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_filter('embed_oembed_html', 'gdpr_compliant_embed_for_youtube_and_vimeo'); | |
function gdpr_compliant_embed_for_youtube_and_vimeo($html) | |
{ | |
if (preg_match('/src="(.+?)"/', $html, $matches)) { | |
$source = !empty($matches[1]) ? parse_url($matches[1]) : ''; | |
$host = !empty($source['host']) ? $source['host'] : ''; | |
// For Youtube embedded videos | |
if ($host && ($host == 'www.youtube.com' || $host == 'youtu.be')) { | |
$html = str_replace($host, 'www.youtube-nocookie.com', $html); |