View post_by_view.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 & GeneratePress implementation of post ordering based on post views. | |
*/ | |
// set the view counter | |
function getPostViews($postID){ | |
$count_key = 'post_views_count'; | |
$count = get_post_meta($postID, $count_key, true); |
View objects.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 | |
// objects and classes | |
/** | |
* Flexible but longform | |
*/ | |
class Person { | |
private $name; | |
private $age; |
View back_to_top.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 | |
/** | |
* Back to Top button that appears once one scrolls past the full viewport height | |
* Drop this function into your functions.php, code snippets plugin ... | |
* You should not need to change anything, but in case your theme does not have #page id in one of top dom elements, change to the one you have | |
* CSS you can normally edit as you like | |
*/ | |
function back_to_top() { | |
?> |
View hide-show.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
/* we use variables to that hiding fits perfectly with the nav and aside height/width */ | |
:root { | |
--nav-height: 90px; | |
--sidebar-width: 120px; | |
} | |
/* menu setup */ | |
body nav { | |
position: fixed; | |
top: 0; |
View gb_query_events.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 | |
/** | |
* Event query with GenerateBlocks | |
* Show only events that are happening in future, and order them from sooner to later | |
* @link https://community.generateblocks.com/t/generateblocks-query-loop-args-slowing-pages-way-down/903/9 | |
* @link https://community.generateblocks.com/t/use-gb-query-loop-for-related-post/688/2 | |
*/ | |
function gb_query_events( $query_args, $attributes ) { |
View toggle.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
.editor-styles-wrapper .gb-button-wrapper .gb-button.trigger, | |
.site .gb-button-wrapper .gb-button.trigger { | |
cursor: pointer; | |
user-select: none; | |
padding: 5px !important; | |
border-radius: 2em; | |
height: 25px; | |
width: 50px; | |
align-items: center; | |
color: #ddd; |
View new-tabs.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
/* Buttons as TABS */ | |
.site .triggers .gb-button { | |
color: var(--contrast-2); | |
background-color: var(--base-2); | |
} | |
.site .triggers .gb-button:hover, | |
.site .triggers .gb-button:focus, | |
.site .triggers .gb-button:target, | |
.site .triggers .gb-button[aria-selected="true"] { |
View tabs.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
.site .triggers > .gb-inside-container .gb-container { | |
color: var(--contrast-2); | |
background-color: var(--base-2); | |
} | |
.site .triggers > .gb-inside-container .gb-container:hover, | |
.site .triggers > .gb-inside-container .gb-container:focus, | |
.site .triggers > .gb-inside-container .gb-container.is-active { | |
color: var(--base); | |
background-color: var(--accent); |
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'; |
NewerOlder