Skip to content

Instantly share code, notes, and snippets.

View 2shrestha22's full-sized avatar
💙
Dart / Flutter

Sangam Kumar Shrestha 2shrestha22

💙
Dart / Flutter
View GitHub Profile
//adds social share in AMP pages add in function.php /WP
add_filter('the_content', 'my_social_share');
function my_social_share($content) {
if(is_single()) {
$before_after_content = '<div class=social-share>
<amp-social-share width=35 height=35 type=facebook data-param-app_id=xxxxxxxxxxxxx></amp-social-share>
<amp-social-share height=35 width=35 type=twitter></amp-social-share>
<amp-social-share height=35 width=35 type="system"></amp-social-share>
</div>';
# Set page cache expiration time to 10 minutes
Header set Cache-Control "max-age=600, must-revalidate" "expr=%{REQUEST_URI} !~ m#^/wp-admin#"
@2shrestha22
2shrestha22 / cloudflare-worker-cors-fonts.js
Created September 14, 2019 12:36
Cloudflare workers script to enable CORS for fonts
// Sets Access-Control-Allow-Origin for fonts
// this worker should be used in subdomain from where fonts are being loaded but not in main site
// eg. www.example.com & static.example.com
// use this worker script with static.example.com
let corsHeaders = {
"Access-Control-Allow-Origin" : "https://sangams.com.np",
}
addEventListener('fetch', event => {
<section id="enews-ext-3" class="enews-widget">
<div class="enews">
<div class="widget-wrap">
<form id="subscribeenews-ext-3" name="submit" method="post" action-xhr="https://sangams.com.np/wpx/mailchimp-post.php" target="_top">
<p>Get awesome content delivered straight to your inbox. </p>
<input type="email" name="email" placeholder="Enter your email address" required="">
<input type="submit" value="Subscribe">
<div submitting>
<template type="amp-mustache">
Form submitting... Thank you for waiting.
<img src="https://sangams.com.np/logo-footer.svg" height="60" alt="sangams.com.np"><br>[footer_copyright] · <a href="https://sangams.com.np/" title="Sangam's Blog" ><span>Sangam's Blog</span></a> · <strong>ॐ</strong> · Hosted by <a rel="nofollow" href="https://www.digitalberg.com/" title="DigitalBerg">DigitalBerg</a><br><a href="//sangams.com.np/about/">About</a> · <a href="https://sangams.com.np/contact/">Contact</a> · <a href="https://sangams.com.np/privacy-policy/">Privacy Policy</a> · <a href="https://sangams.com.np/sitemap_index.xml">Sitemap</a><!--
ॐ त्र्यम्बकं यजामहे सुगन्धिं पुष्टिवर्धनम् । उर्वारुकमिव बन्धनान् मृत्योर्मुक्षीय मामृतात् ॥
ॐ त्र्यम्बकं यजामहे सुगन्धिं पुष्टिवर्धनम् । उर्वारुकमिव बन्धनान् मृत्योर्मुक्षीय मामृतात् ॥
ॐ त्र्यम्बकं यजामहे सुगन्धिं पुष्टिवर्धनम् । उर्वारुकमिव बन्धनान् मृत्योर्मुक्षीय मामृतात् ॥
-->
@2shrestha22
2shrestha22 / flashfooter.php
Last active August 10, 2019 00:26
footer editor for flash theme (ThemeGrill)
<?php
//copy below this line, you shouldn't include <?php
//paste this code in your function.php
//flash footer editor
if (! function_exists('flash_custom_credits')) {
add_action('init','remove_default_flash_credits');
function remove_default_flash_credits(){
remove_action('flash_copyright_area','flash_footer_copyright');
pre {
color: white;
border-left: 6px solid #bbb;
padding:5px 10px;
background: rgb(105,105,105);
font-size: 14px;
margin-right: 50px;
white-space:pre-wrap;
}
pre::selection { color: #696969; background: rgba(255, 255, 255, 0.996);
#blog_subscription-4 .widget-title{
display:none;
}
#subscribe-blog-blog_subscription-4{
color:white;
padding: 15px;
display: block;
background-color:#e8554e
}
@2shrestha22
2shrestha22 / task.txt
Last active October 8, 2018 06:48
Opening .php files directly from VS Code
{
//run in chrome task
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"command": "chrome",
"tasks": [
{
"label": "Run in Chrome",
"windows": {
@2shrestha22
2shrestha22 / foodhunt.txt
Last active July 18, 2018 08:58
code snippet to remove footer credits in Foodhunt by ThemeGrill. Put this in function.php
dd_action('init','remove_default_foodhunt_credits');
function remove_default_foodhunt_credits(){
remove_action('foodhunt_footer_copyright','foodhunt_footer_copyright');
}
add_filter('foodhunt_footer_copyright', 'foodhunt_custom_credits');
function foodhunt_custom_credits(){
$foodhunt_custom_credits = ""; //add here any text you want to put in footer credits
$credit_value ='<div class="copyright"><span class="copyright-text">Copyright &copy; ' . date('Y') . ' <a href="' . esc_url( home_url( '/' ) ) . '" title="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '" ><span>' . get_bloginfo( 'name', 'display' ) . '.</span></a> ' .$foodhunt_custom_credits. '</span></div>';
echo $credit_value;