Skip to content

Instantly share code, notes, and snippets.

View salehahmadbabu's full-sized avatar

Saleh Ahmad salehahmadbabu

View GitHub Profile
/*create a php file in the root directory, paste these codes and open the file in browser (https://yoursite.com/filename.php)*/
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow"/>
<title>Search and replace files</title>
</head>
<body style="margin: 0; padding: 0;">
<script>
;(function($){
$(window).on('load', function(){
var maxHeight = 0,
items = $('.customers-review .swiper-slide');
items.each(function () {
maxHeight = ($(this).height() > maxHeight ? $(this).height() : maxHeight);
});
//Assign maximum height to children
add_filter( 'wp_nav_menu_items', 'wbtheme_custom_menu_item', 10, 2 );
function wbtheme_custom_menu_item ( $items, $args ) {
if ( $args->menu == 'Main Menu') {
$items .= '<li><a href="callto:'.get_field('number', 'option').'" class="menu-bttn">'.get_field('number', 'option').'</a></li>';
}
return $items;
}
add_action( 'woocommerce_order_status_changed', 'your_function', 99, 4 );
function your_function( $order_id, $old_status, $new_status, $order ){
if( $new_status == "completed" ) {
var_dump($order);
$user_id = $order->get_user_id();
$user = new WP_User($user_id);
$user->set_role('subscriber');
}
}
function add_additional_class_on_a($classes, $item, $args)
{
if (isset($args->menu_anchor_class)) {
$classes['class'] = $args->menu_anchor_class;
}
return $classes;
}
add_filter('nav_menu_link_attributes', 'add_additional_class_on_a', 1, 3);
<?php
// collection of walker classes
class Walker_Mobile_Menu extends Walker_Nav_Menu
{
function start_lvl(&$output, $depth = 0, $args = null)
{
$output .= "\n<ul class=\"dropdown-menu\">\n";
// add nav menu class & sub-menu class
function v123_nav_class($classes, $item)
{
if (in_array('menu-item-has-children', $classes)) {
$classes[] = 'dropdown';
}
return $classes;
}
add_filter('nav_menu_css_class', 'v123_nav_class', 10, 2);
body.login.login-password-protected {
position: relative;
overflow: hidden;
display: flex;
justify-content:center;
align-items: center;
}
body.login.login-password-protected:after {
position: absolute;
function owp_remove_menu_items() {
if( !current_user_can( 'administrator' ) ):
remove_menu_page( 'edit-comments.php' );
remove_menu_page( 'edit.php?post_type=elementor_library&tabs_group=library' );
endif;
}
add_action( 'admin_menu', 'owp_remove_menu_items' );
add_action('admin_head', 'hide_templates_menu_for_users');
@salehahmadbabu
salehahmadbabu / pmpro_add_billing_fields_to_profile.php
Created July 24, 2020 01:49 — forked from strangerstudios/pmpro_add_billing_fields_to_profile.php
Add PMPro billing fields to the edit user profile page. You must Paid Memberships Pro and the Register Helper plugin installed. Then add this to a custom plugin or your active theme's functions.php
/*
Add PMPro billing fields to the edit user profile page.
You must Paid Memberships Pro and the Register Helper plugin installed:
http://wordpress.org/extend/plugins/paid-memberships-pro
https://github.com/strangerstudios/pmpro-register-helper
*/
function add_billing_fields_to_profile()
{
global $pmpro_countries;