View webp-fallback.css
This file contains 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
/* Old Browsers Use this - read Safari */ | |
element.classname { | |
background: url("../images/image.jpg"); | |
} | |
/* Chrome 66+, Edge 79+, Opera 53+, Android Brower 80+ */ | |
@media screen and (-webkit-min-device-pixel-ratio: 0) and (min-resolution:.001dpcm) { | |
@supports (background-image: -webkit-image-set(url("../images/repozitorij.webp") 1x)) { | |
element.classname { | |
background: url("../images/image.jpg"); |
View gb-query-block-filter.php
This file contains 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 | |
// GenerateBlocks variant of pre_get_posts for the query block | |
add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) { | |
if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'custom-grid-class' ) !== false ) { | |
$query_args['meta_key'] = 'field_name'; | |
$query_args['orderby'] = 'meta_value'; // better for strings | |
// $query_args['orderby'] = 'meta_value_num'; // better for numbers | |
$query_args['order'] = 'ASC'; |
View theme.json
This file contains 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
{ | |
"version": 2, | |
"settings": { | |
"typography": { | |
"letterSpacing": false, | |
"Appearance": false, | |
"letterCase": false, | |
"fontFamily": false, | |
"fontSize": false, | |
"fontStyle": false, |
View fallback_featured_image.php
This file contains 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 | |
/** | |
* Auto set featured images whenever there is no featured image set | |
*/ | |
function prefix_autoset_featured_image() { | |
global $post; | |
$already_has_thumb = has_post_thumbnail( $post->ID ); | |
if ( ! $already_has_thumb ) { | |
set_post_thumbnail( $post->ID, '2023' ); // identified by attatchment ID |
View classic_plaintext_and_gutenberg.php
This file contains 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 | |
/** | |
* This file provides differnt levels of formating ability per post type | |
* Posts are in plain classic editor | |
* Osoblje CPT have no formating controls, pure plain text | |
* The rest is more or less in gutenberg | |
* I may later add gutenberg for admins in posts ... perhaps | |
*/ |
View remove-empty-p.php
This file contains 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 | |
add_filter( 'the_content', 'remove_empty_p', 20, 1 ); | |
function remove_empty_p( $content ){ | |
// clean up p tags around block elements | |
$content = preg_replace( array( | |
'#<p>\s*<(div|aside|section|article|header|footer)#', | |
'#</(div|aside|section|article|header|footer)>\s*</p>#', | |
'#</(div|aside|section|article|header|footer)>\s*<br ?/?>#', | |
'#<(div|aside|section|article|header|footer)(.*?)>\s*</p>#', | |
'#<p>\s*</(div|aside|section|article|header|footer)#', |
View scroll-direction.js
This file contains 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
window.addEventListener( 'DOMContentLoaded', ()=> { | |
const body = document.body, | |
scrollUp = "scroll-up", | |
scrollDown = "scroll-down", | |
offset = 0; | |
let lastScroll = window.pageYOffset; | |
if ( lastScroll > offset ) { | |
body.classList.add(scrollUp); |
View thisbit-filtering-assets.css
This file contains 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
/* essential hiding utility */ | |
.is-hidden { | |
display: none !important; | |
} | |
/** | |
Design, could be also moved to theme | |
*/ |
View thisbit-filtering-query.php
This file contains 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 | |
/** | |
* Shortcode for generating filters to filter output of GenerateBlocks query loop | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly. | |
} |
NewerOlder