Skip to content

Instantly share code, notes, and snippets.

View andreiglingeanu's full-sized avatar

Andrei Glingeanu andreiglingeanu

View GitHub Profile
<?php
add_filter(
'blocksy:pro:post-types-extra:custom:collect-fields',
function ($fields, $post_type) {
if ($post_type !== 'post') {
return $fields;
}
$fields['test'] = __('Test Label', 'blocksy');
<?php
add_filter(
'blocksy:header:logo:image-id',
function ($image_id) {
// Other attachment ID
return 45;
}
);
<?php
namespace Blocksy\DbVersioning;
class V200 {
public function migrate() {
$this->migrate_color_palette();
$this->migrate_sale_badge();
$this->migrate_woocommerce_extra_features();
$this->migrate_single_product();
<?php
namespace Blocksy;
/**
* Theme Update
*
* @copyright 2019-present Creative Themes
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
* @package Blocksy
document.addEventListener('DOMContentLoaded', () => {
ctEvents.on('blocksy:frontend:init', () => {
if (document.querySelector('.quick-view-modal')) {
elementorFrontend.init()
}
})
})
<?php
add_action('template_redirect', function () {
if (is_search() && isset($_GET['s'])) {
$current_url = wp_parse_str(wp_parse_url(blocksy_current_url())['query'], $query_args);
unset($query_args['s']);
wp_redirect(add_query_arg(
$query_args,
<?php
add_filter(
'blocksy:archive:render-card-layers',
function ($layers, $prefix, $featured_image_args) {
$post_id = get_the_ID();
if (
get_post_type($post_id) !== 'blogger-template'
||
<?php
add_filter(
'blocksy:post-meta:author:author-avatar-url',
function ($url) {
$user_id = get_the_author_meta('ID');
$custom_profile_image = get_user_meta($user_id, 'custom_profile_image', true);
if (! $custom_profile_image) {
return $url;
@andreiglingeanu
andreiglingeanu / main.js
Created February 22, 2023 14:03
Events for blocksy micro popups
ctEvents.on('blocksy:micro-popups:open', (popupId, popup) => {
console.log('here open popup', popupId, popup)
})
ctEvents.on('blocksy:micro-popups:close', (popupId, popup) => {
console.log('here close popup', popupId, popup)
})
<?php
/*
Plugin Name: Change Theme by IP Address
Description: Changes the WordPress theme depending on the visitor's IP address
*/
add_filter('template', 'ct_change_theme');
add_filter('option_template', 'ct_change_theme');
add_filter('option_stylesheet', 'ct_change_theme');