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
{ | |
"code-runner.saveFileBeforeRun": true, | |
"workbench.colorTheme": "One Dark Pro", | |
"editor.fontSize": 16, | |
"phpfmt.psr2": false, | |
"phpfmt.passes": [ | |
"PSR2KeywordsLowerCase", | |
"PSR2LnAfterNamespace", | |
"PSR2ModifierVisibilityStaticOrder", | |
"ReindentSwitchBlocks", |
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
<?php | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Change size for Yoast SEO OpenGraph image for all content | |
* Credit: Yoast Development team | |
* Last Tested: May 19 2020 using Yoast SEO 14.1 on WordPress 5.4.1 | |
* Accepts WordPress reserved image size names: 'thumb', 'thumbnail', 'medium', 'large', 'post-thumbnail' | |
* Accepts custom image size names: https://developer.wordpress.org/reference/functions/add_image_size/ | |
*/ | |
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
//* @ Method 1 | |
// Set the order of the pages/posts in the admin section descending according to the editing date [for all post/page type] | |
function orderby_modified_posts( $query ) { | |
if( is_admin() ) { | |
$query->set( 'orderby', 'modified' ); | |
$query->set( 'order', 'desc' ); | |
} | |
} | |
add_action( 'pre_get_posts', 'orderby_modified_posts' ); |
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 featured image column to WP admin panel - posts AND pages | |
* See: https://bloggerpilot.com/featured-image-admin/ | |
*/ | |
// Set thumbnail size | |
add_image_size( 'j0e_admin-featured-image', 60, 60, false ); | |
// Add the posts and pages columns filter. Same function for both. | |
add_filter('manage_posts_columns', 'j0e_add_thumbnail_column', 2); |
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
/* | |
@ Usecase: Add a border to any Facebook post which has more than 3 likes. It will apply to only this specific feed. | |
@ Required plugin: https://wordpress.org/plugins/custom-facebook-feed/ | |
@ Install [this plugin](https://wordpress.org/plugins/custom-css-js/) to inject custom CSS/JS code snippets into a WordPress site. | |
*/ | |
jQuery(document).ready(function($) { | |
$(".cff-likes .cff-count").each(function() { | |
var el = $(this); | |
var value = parseFloat(el.text()); |
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
/* Hide HA Pro Elementor widgets from the editor left sidebar */ | |
function hide_happy_addons_pro_category_widgets_from_editor() { | |
echo '<style> | |
#elementor-panel-category-happy_addons_pro_category{ | |
display: none !important; | |
} | |
</style>'; | |
} | |
add_action('admin_init', 'hide_happy_addons_pro_category_widgets_from_editor'); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Upload file from URL</title> | |
<!-- From: https://stackoverflow.com/questions/22823204/is-there-any-way-to-upload-file-directly-from-url-in-filemanager-of-cpanel --> | |
</head> | |
<body> | |
<?php | |
$BASE_URL = strtok($_SERVER['REQUEST_URI'],'?'); |
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
<?php | |
/** | |
* Redirects subscribers back to the home page if they attempt to access the dashboard. | |
*/ | |
function prefix_redirect_admin() { | |
if ( ! current_user_can( 'edit_posts' ) && ! defined( 'DOING_AJAX' ) ) { | |
wp_safe_redirect( home_url() ); | |
exit; | |
} | |
} |
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
<?php // Only copy this line if needed | |
/** | |
* Removes the "My Memberships" table from my account area | |
*/ | |
function sv_remove_my_memberships_table() { | |
if ( function_exists( 'wc_memberships' ) && ! is_admin() ) { | |
remove_action( 'woocommerce_before_my_account', array( wc_memberships()->get_frontend_instance()->get_members_area_instance(), 'my_account_memberships' ) ); | |
} | |
} |
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
# Terminal Cheat Sheet | |
pwd # print working directory | |
ls # list files in directory | |
cd # change directory | |
~ # home directory | |
.. # up one directory | |
- # previous working directory | |
help # get help | |
-h # get help |
NewerOlder