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 | |
| // remove the top function it is used only to inspect the array so one can figure it out | |
| function apuri_get_your_elements() { | |
| $post_obs = get_field('front_posts'); | |
| ?> | |
| <pre style="min-height: 100vh; display: flex; flex-direction: column; align-items: flex-start; text-align: left;"> | |
| <h2 style="margin-top: 90px" >Check the array content</h2> | |
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 gb_query_vijesti( $query_args, $attributes ) { | |
| if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'arhiv-vijesti' ) !== false ) { | |
| $query_args['wp_grid_builder'] = 'wpgb-content'; | |
| } | |
| return $query_args; | |
| } | |
| add_filter( 'generateblocks_query_loop_args', 'gb_query_vijesti', 10, 2 ); |
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 | |
| /** | |
| * Remove extraneous whitespace from excerpts on blog posts, post archives and search results | |
| * Double test the output | |
| * Wonder why do this, real life reason here -> https://i.imgur.com/5KD8gOd.png | |
| */ | |
| add_filter( 'run_wptexturize', '__return_false' ); // removes wp feature that makes emdash from two consecutive dashes | |
| function apuri_clean_post_content( $content ){ |
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 | |
| // stores visited posts into a cookie | |
| function rv_products_non_logged_in(){ | |
| $rv_posts = array(); | |
| if ( is_singular('post') && !is_user_logged_in() ){ | |
| if(isset($_COOKIE['rv_products']) && $_COOKIE['rv_products']!=''){ | |
| $rv_posts = unserialize($_COOKIE['rv_products']); | |
| if (! is_array($rv_posts)) { |
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
| .masonry { | |
| display: block !important; | |
| } | |
| .masonry .wp-block-image{ | |
| width:100% !important; | |
| margin-bottom: 2rem !important; | |
| } | |
| .masonry.columns-default { |
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
| <section class="custom-loop__wrapper"> | |
| <h2>custom loop</h2> | |
| <?php | |
| // WP_Query arguments | |
| $args = array( | |
| 'post_type' => array( 'post' ), | |
| ); | |
| // The Query |
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 | |
| /* | |
| * 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); |
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 | |
| // objects and classes | |
| /** | |
| * Flexible but longform | |
| */ | |
| class Person { | |
| private $name; | |
| private $age; |
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 | |
| /** | |
| * 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() { | |
| ?> |
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
| /* 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; |