Skip to content

Instantly share code, notes, and snippets.

View rupokify's full-sized avatar
🎯
Focusing

Rupok Chowdhury Protik rupokify

🎯
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am rupokify on github.
  • I am rupok (https://keybase.io/rupok) on keybase.
  • I have a public key ASB1lzHC0eYQeIkJEKQzDVCLiunQwwsB2BSgTbF5mDfJKQo

To claim this, I am signing this object:

@rupokify
rupokify / divi-static-cache-flush.php
Created September 22, 2021 06:50
Flush Divi Theme Static Cache
<?php
function flush_divi() {
include_once get_template_directory(). '/core/components/PageResource.php';
ET_Core_PageResource::remove_static_resources( 'all', 'all' );
}
add_action('wp_head', 'flush_divi');
@rupokify
rupokify / copytexttoclipboard.php
Last active July 18, 2021 05:36
Copy Text to Clipboard Shortcode for WordPress
<?php
add_shortcode( 'copycoupon', 'copy_text_shortcode' );
function copy_text_shortcode( $atts ) {
?>
<p id="text-to-copy"><?= $atts['coupon'] ?></p>
<button id="copybutton">Copy to Clipboard</button>
<?php
}
add_action( 'wp_footer', 'copy_to_clipboard' );
@rupokify
rupokify / loadCustomjQuery.php
Created February 1, 2021 05:19
Deregister Stock jQuery and Load Custom jQuery on Specific Pages/Posts
<?php
// WordPress 5.6 comes with a very recent version of jQuery and it's not suggested to use an older one.
if (!function_exists('load_custom_jquery')) {
function load_custom_jquery() {
if (is_page(array('page-slug-one', 'page-slug-two'))) { // Replace 'page-slug-one', 'page-slug-two' etc with your own page slug
wp_dequeue_script('jquery');
wp_deregister_script('jquery');
@rupokify
rupokify / logged-in-front-page-redirect-wordpress.php
Created December 6, 2020 09:42
Redirect Logged In Users From Front Page to Another Page WordPress
<?php
//Redirect Logged-in users from front page to another page
function my_logged_in_redirect() {
if (is_front_page() && is_user_logged_in()) {
// Replace "YOUR_URL_HERE" with your target URL
wp_redirect( 'YOUR_URL_HERE', 301 );
exit;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>HKAtrialFibrillationDetectionOnboardingCompleted</key>
<integer>1</integer>
<key>HKElectrocardiogramOnboardingCompleted</key>
<integer>3</integer>
</dict>
</plist>
@rupokify
rupokify / probloglist.php
Created May 22, 2018 20:40
Show List of Blogs + Pro Sites Status of Each Blog
function show_blog_list() {
$user_id = get_current_user_id();
if ($user_id == 0) {
echo 'You are not logged in.';
} else {
echo '<h2>Your Blog List with Prosite Levels</h2>';
$user_blogs = get_blogs_of_user( $user_id );
foreach ($user_blogs AS $user_blog) {
global $psts;
echo '<li><a href="'.$user_blog->siteurl.'">'.$user_blog->blogname.'</a> - Pro Sites Level: '.$psts->get_level( $user_blog->userblog_id ).'</li>';

Keybase proof

I hereby claim:

  • I am rupokify on github.
  • I am rupok (https://keybase.io/rupok) on keybase.
  • I have a public key whose fingerprint is 62FB A6B5 9A12 FC19 FA6B 2C53 FE2C 72D5 8D5C B0F8

To claim this, I am signing this object: