This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // fetch block by name like this: | |
| // https://…/wp-json/public/v1/reusable?slug=brunch-termine | |
| add_action('rest_api_init', function () { | |
| register_rest_route('public/v1','/reusable',[ | |
| 'methods' => 'GET', | |
| 'args' => ['slug'=>['required'=>true]], | |
| 'permission_callback' => '__return_true', | |
| 'callback' => function(WP_REST_Request $r){ | |
| $slug = sanitize_title($r['slug']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // attention! place your yt-video in html-block inside a blocksy popup like this: | |
| // <iframe src="https://www.youtube.com/embed/LW0OVY9e5r0?enablejsapi=1&autoplay=1" class="yt-video" style="aspect-ratio:16/9" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> | |
| // this approach is also compatible with script blocker plugin "embed privacy" AND "complianz cookie consent". last one is mandatory! | |
| function autoplay_yt_video_in_blocksy_popup(){ | |
| ?> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| ctEvents.on('blocksy:micro-popups:open', (popupId) => { | |
| let video = document.querySelector("#post-"+popupId+" .yt-video"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function change_layer_from_card($layer,$prefix,$image_args){ | |
| if($prefix != "unterstuetzer_archive") return $layer; | |
| $layer["featured_image"] = sprintf('<div class="ct-media-container">%s</div>',strip_tags($layer["featured_image"],"<img>")); | |
| $layer["title"] = strip_tags($layer["title"],"<h2>"); | |
| return $layer; | |
| } | |
| add_filter('blocksy:archive:render-card-layers',"change_layer_from_card",10,3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function disable_blocksy_hook_panel(){ | |
| $user = wp_get_current_user(); | |
| if(in_array("editor",$user->roles)) return false; | |
| return true; | |
| } | |
| add_filter('blocksy:content-blocks:has-actions-debugger','disable_blocksy_hook_panel'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [data-archive="default"].entries article.entry-card { | |
| position:relative; | |
| } | |
| [data-archive="default"].entries article.entry-card .entry-title > a::before { | |
| position:absolute; | |
| inset: 0; | |
| content:""; | |
| display:block; | |
| z-index:10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // add the class to your button: | |
| .no-btn-transform:hover { | |
| --theme-button-transform: none; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // hide wp armour menu from editor role | |
| function remove_wpa_menu(){ | |
| if(!is_admin()) return; | |
| if(current_user_can('editor')) | |
| remove_action('admin_menu', 'wpa_plugin_menu'); | |
| } | |
| add_action("wp_loaded",'remove_wpa_menu'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // unload wp armour honeypot assets due to jquery dependency | |
| function remove_plugin_stuff_in_wp_loaded(){ | |
| if(is_front_page()) | |
| remove_action('wp_enqueue_scripts','wpa_load_scripts'); | |
| } | |
| add_action('wp', 'remove_plugin_stuff_in_wp_loaded'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // disable page title and top spacing when assigned to "schwebende navigation" term of taxonomy "page_props": | |
| function disable_blocksy_hero_section($value){ | |
| global $post; | |
| if(!$post->ID) return $value; | |
| $post_options = blocksy_get_post_options($post->ID); | |
| // turns out (for some reason) $post->ID is more reliable than $post_id in certain cases! | |
| if($p_terms = get_the_terms( $post->ID, 'page_props' )){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function change_blocksy_vertical_spacing($v_spacing_components){ | |
| global $post; | |
| if($p_terms = get_the_terms( $post->ID, 'page_props' )){ // change "page_props" to your custom taxonomy name | |
| if ( ! is_wp_error( $p_terms ) ) { | |
| if(in_array("schwebende-navigation",array_column($p_terms,"slug"))){ // change "schwebende-navigation" to your term name | |
| if (($key = array_search("top", $v_spacing_components)) !== false) { | |
| unset($v_spacing_components[$key]); | |
| } | |
| } |
NewerOlder