Skip to content

Instantly share code, notes, and snippets.

View LeMiira's full-sized avatar
🏠
Working from home

Mira LeMiira

🏠
Working from home
View GitHub Profile
function fws_admin_posts_filter( $query ) {
global $pagenow;
if ( is_admin() && $pagenow == 'edit.php' && !empty($_GET['my_parent_pages'])) {
$query->query_vars['post_parent'] = $_GET['my_parent_pages'];
}
}
add_filter( 'parse_query', 'fws_admin_posts_filter' );
function admin_page_filter_parentpages() {
global $wpdb;
@LeMiira
LeMiira / code.php
Last active June 1, 2023 01:18
schema agespace
<?php
add_filter( 'wpseo_schema_webpage', 'change_schema_ref', 11, 2 );
function change_schema_ref( $piece ) {
$linkstring ='https://www.agespace.org'.$_SERVER['REQUEST_URI'];
$piece['@id']=$linkstring;
@LeMiira
LeMiira / custom-variations-select.css
Created January 5, 2023 20:10 — forked from codescribblr/custom-variations-select.css
Custom Select Box Replacements for Woocommerce Variations
.woocommerce.single-product .product .summary .variations {
width: 100%;
}
.woocommerce.single-product .product .summary .variations td {
display: block;
width: 100%;
}
.woocommerce.single-product .product .summary .variations td label {
font-family: 'Nunito', Helvetica, Arial, sans-serif;
letter-spacing: 0px;
@LeMiira
LeMiira / stripslash.php
Created December 29, 2022 11:19
Can't decode JSON string in php
//https://stackoverflow.com/questions/3586401/cant-decode-json-string-in-php
$json = stripslashes('{\"json\":[{\"username\":\"1062576\",\"accountId\":\"45656565\"}]}');
$postarray = json_decode($json);
print_r($postarray);
@LeMiira
LeMiira / getparams.js
Created December 29, 2022 08:53
Get URL parameters in jQuery
//https://stackoverflow.com/a/26744533/861265
function getURLParams(url){
var p={};
url.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(s,k,v){p[k]=v})
return p;
}
@LeMiira
LeMiira / gist:79ca48da3cc7f166f6e8c3b187d565aa
Created December 1, 2022 09:38
manually install openssl on ubuntu
Steps to download, compile, and install are as follows (I'm installing version 1.0.1g below; please replace "1.0.1g" with your version number):
Step – 1 : Downloading OpenSSL:
Run the command as below :
$ wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz
Also, download the MD5 hash to verify the integrity of the downloaded file for just varifacation purpose. In the same folder where you have downloaded the OpenSSL file from the website :
@LeMiira
LeMiira / wp-breadcrumb.php
Created November 27, 2022 07:47
custom breadcrumb for wordpress
<?php
/*=============================================
= BREADCRUMBS =
=============================================*/
// to include in functions.php
function the_breadcrumb() {
@LeMiira
LeMiira / acf-woocommerce-instock.php
Created November 24, 2022 13:05
ACF Pro relationship only show in stock products woocommerce
<?php
add_filter('acf/fields/relationship/query/name=also_may_like', 'exclude_outofstock', 10, 3);
function exclude_outofstock ( $args, $field, $post_id ) {
$meta_query[] = [
'key' => '_stock_status',
'value' => 'instock',
'compare' => '=',
@LeMiira
LeMiira / acf-body-wp.php
Created November 8, 2022 12:45
Add ACF field in WordPress Body Class
<?php
function add_acf_body_class($class) {
$value = get_field('header_height');
$class[] = $value;
return $class;
}
add_filter('body_class', 'add_acf_body_class');
@LeMiira
LeMiira / disable-wordpress-admin-new-user-notification.php
Created October 27, 2022 15:26 — forked from someguy9/disable-wordpress-admin-new-user-notification.php
Disable the WordPress new user email notification sent to the site admin
<?php
//Disable the new user notification sent to the site admin
function smartwp_disable_new_user_notifications() {
//Remove original use created emails
remove_action( 'register_new_user', 'wp_send_new_user_notifications' );
remove_action( 'edit_user_created_user', 'wp_send_new_user_notifications', 10, 2 );
//Add new function to take over email creation
add_action( 'register_new_user', 'smartwp_send_new_user_notifications' );
add_action( 'edit_user_created_user', 'smartwp_send_new_user_notifications', 10, 2 );