Skip to content

Instantly share code, notes, and snippets.

View advokatb's full-sized avatar

advokatb

  • Ukraine
View GitHub Profile
<?php
/**
* Change site url in admin bar
*
* @param WP_Admin_Bar $wp_admin_bar
*/
function admin_bar_menu_filter( WP_Admin_Bar $wp_admin_bar ) {
$new_url = 'site.org';
$site_name_node = $wp_admin_bar->get_nodes()['site-name'];
$site_name_node->href = $new_url;
@iqbalrony
iqbalrony / custom-css.php
Last active November 22, 2023 11:56
How to add custom css control with elementor free version.
<?php
use Elementor\Controls_Manager;
use Elementor\Element_Base;
use Elementor\Core\Files\CSS\Post;
use Elementor\Core\DynamicTags\Dynamic_CSS;
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
class ElementsKit_Extend_Onepage_Scroll{
public function __construct() {
// add_action( 'elementor/element/wp-post/document_settings/after_section_start', [ $this, 'register_controls' ], 10, 2 );
add_action( 'elementor/element/wp-post/document_settings/before_section_end', [ $this, 'register_controls' ], 10, 2 );
}
public function register_controls( Controls_Stack $element ) {
@MogulChris
MogulChris / find-replace-elementor.sql
Created January 24, 2022 00:52
MySQL / PHPMyAdmin find and replace of Elementor data
# Points to note:
# 1. Elementor data is saved as JSON in wp_postmeta with meta_key _elementor_data
# 2. The LIKE operator needs four backslashes for every one in the JSON data you are looking for.
# 3. The REPLACE function needs two backslashes for every one in the find / replace strings.
# 4. Eg: Searching for buttons with a particular label and linking to "/" - I want to change their links to /case-studies
update `wp_3_postmeta` set meta_value = REPLACE(meta_value, '"button_label":"View All","button_link":"\\/','"button_label":"View All","button_link":"\\/case-studies') WHERE meta_key = '_elementor_data' AND meta_value LIKE '%"button_label":"View All","button_link":"\\\\/"%';