Skip to content

Instantly share code, notes, and snippets.

View pavlo-bondarchuk's full-sized avatar
🏠
remote

Pavlo Bondarchuk pavlo-bondarchuk

🏠
remote
View GitHub Profile
@pavlo-bondarchuk
pavlo-bondarchuk / Disable WP REST API - Contact Form 7 Endpoints
Created August 15, 2024 16:46 — forked from petermann/Disable WP REST API - Contact Form 7 Endpoints
Automatically Enable Contact Form 7 Endpoints with Disable WP REST API Plugin
/**
* Automatically Enable Contact Form 7 Endpoints with Disable WP REST API Plugin
* Plugin URI: https://wordpress.org/plugins/disable-wp-rest-api/
*/
function disable_wp_rest_api_enable_contact_form7_endpoints() {
$active_plugins = get_option('active_plugins');
// Check if the "Disable WP REST API" plugin is active
if (in_array('disable-wp-rest-api/disable-wp-rest-api.php', $active_plugins)
// Check if the "Contact Form 7" plugin is active
&& in_array('contact-form-7/wp-contact-form-7.php', $active_plugins)
@pavlo-bondarchuk
pavlo-bondarchuk / bypass-elementors-maintenance-mode.php
Created April 4, 2024 13:29 — forked from mishterk/bypass-elementors-maintenance-mode.php
Using this snippet, you can bypass Elementor's maintenance mode by adding ?bypass_maintenance=1 to the query string
<?php
add_filter( 'pre_option_elementor_maintenance_mode_mode', function ( $option ) {
$parameter = 'bypass_maintenance'; // change this to whatever you like
if ( isset( $_GET['bypass_maintenance'] ) and $_GET['bypass_maintenance'] ) {
return 0; // needs to be falsy but not FALSE
}
@pavlo-bondarchuk
pavlo-bondarchuk / custom-languge-swicther-schortcode.php
Created July 13, 2023 19:02 — forked from evtihii/custom-languge-swicther-schortcode.php
Translatepress custom language switcher shortcode
<?php
/*
* Custom language switcher shortcode
*/
function trpc_language_switcher($atts)
{
ob_start();
global $TRP_LANGUAGE;
<?php
class MyTheme
{
private function actionAfterSetup($function)
{
add_action('after_setup_theme', function() use ($function) {
$function();
});
}
@pavlo-bondarchuk
pavlo-bondarchuk / psl-theme-test.txt
Created April 12, 2022 15:37 — forked from bph/psl-theme-test.txt
Blocks for Themes Test
<!-- wp:paragraph -->
<p><a href="https://gist.github.com/bph/335ddef358bb41efdcd159cbc76f582e">https://gist.github.com/bph/335ddef358bb41efdcd159cbc76f582e</a></p>
<!-- /wp:paragraph -->
<!-- wp:heading {"className":"eplus-oOhLNH"} -->
<h2 class="eplus-oOhLNH">Common Blocks / Formatting / Layout Elements / Widgets and Embeds</h2>
<!-- /wp:heading -->
<!-- wp:list {"className":"eplus-eI3gin"} -->
<ul class="eplus-eI3gin"><li><a href="#images">Images</a> (Single image, cover image, gallery </li><li><a href="#quotes">Pull Quote / Quote</a></li><li><a href="#verse">Verse</a></li><li><a href="#buttons">Buttons</a></li><li><a href="#socialicons" data-type="internal" data-id="#socialicons">Social Icons</a></li><li><a href="#columns">Columns </a> Text (only) columns / Columns experimental</li><li><a href="#cover" data-type="internal" data-id="#cover">Cover</a> with CAT + button</li><li><a href="#paragraphs">Paragraph</a> </li><li><a href="#audio">Audio</a> </li><li><a href="#video">Video</a></li><li><a href="#w
@pavlo-bondarchuk
pavlo-bondarchuk / wp_ext_pll_functions.php
Created March 16, 2022 17:43 — forked from icetee/wp_ext_pll_functions.php
Polylang function_exists (active the plugin) - WordPress - Paste the code into functions.php
/*
* Polylang Language API functions tester - WordPress
* Github: https://gist.github.com/icetee/fbbfef5534fead58611e
*
*/
function ex_pll_the_languages($arg = '') {
if ( function_exists('pll_the_languages') ) {
return pll_the_languages($arg);
}
/**
* Allow to remove method for an hook when, it's a class method used and class don't have variable, but you know the class name :)
* source: https://github.com/herewithme/wp-filters-extras
* More: http://wordpress.stackexchange.com/questions/57079/how-to-remove-a-filter-that-is-an-anonymous-object
*/
function remove_filters_for_anonymous_class( $hook_name = '', $class_name ='', $method_name = '', $priority = 0 ) {
global $wp_filter;
// Take only filters on right hook name and priority
if ( !isset($wp_filter[$hook_name][$priority]) || !is_array($wp_filter[$hook_name][$priority]) )
@pavlo-bondarchuk
pavlo-bondarchuk / gist:88d9ce83de048fa72e47da4451b4339f
Created May 15, 2021 19:44 — forked from mattheu/gist:508d3246eea566e6fa33
Tidy Up WordPress TinyMCE 4 editor buttons
<?php
// Modify Tiny_MCE init
add_filter('tiny_mce_before_init', 'tmy_modify_tinyMCE4', 10, 2 );
/**
* Filter TinyMCE4 Init args.
*/
function tmy_modify_tinyMCE4( $mceInit, $editor_id ) {
@pavlo-bondarchuk
pavlo-bondarchuk / functions.php
Created August 10, 2020 07:43 — forked from ihorvorotnov/functions.php
Painless 3rd party marketing scripts in WordPress
<?php
// Enqueue all js codes combined in a single file.
function enqueue_theme_assets()
{
wp_enqueue_script(
'trackers',
get_stylesheet_directory_uri() . '/js/trackers.js',
null,
null,
@pavlo-bondarchuk
pavlo-bondarchuk / manage_columns_wp_admin.php
Created February 28, 2020 10:58 — forked from vishalkakadiya/manage_columns_wp_admin.php
Manage custom columns with sortable in WordPress Admin side
<?php
/*
* =================================================================================================
* Below both hooks works for custom post types.
* e.g. Suppose we have custom post-type name : Books
* @ref https://codex.wordpress.org/Plugin_API/Action_Reference/manage_$post_type_posts_custom_column
* =================================================================================================
*/