Reusable Custom Blocks

Custom Taxonomy Block

A dyanmic block that outputs custom taxonomy of a custom post type. REQUIRED LAZYBLOCK FIELDS:font-size = NUMBERfont-color = COLOR PICKERtext-transform = SELECT/TEXTletter-spacing = NUMBER <?php /** * Template for Auction Type [Taxonomy] */ global $post; $font_size = $attributes[‘font-size’]; $font_color = $attributes[‘font-color’]; $text_transform = $attributes[‘text-transform’]; $letter_spacing = $attributes[‘letter-spacing’]; $auction_type = get_object_term_cache( $post->ID, ‘auction-types’ ); ?> <style> […]

Reusable Custom Blocks

Custom Post Type Slider

A block that queries and outputs custom post types in a slider using slickslider. REQUIRED LIBRARIES (insert these in enqueuing styles and scripts in functions.php):wp_enqueue_script( ‘slick-js’, ‘https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.js’);wp_enqueue_style( ‘slick-css’, ‘https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.css’ ); REQUIRED LAZYBLOCK FIELDS:slide-count = NUMBERbutton-text = TEXTtitle-color = COLOR PICKERtitle-size = NUMBER Still looking for solutions on how to make slickslider work in wp backend. […]

PHP Code Snippets/Functions

Display Custom Post Type.

This snippet is a loop used for displaying custom posts. Replace variables/IDs/names/attributes as needed. <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $loopb = new WP_Query( array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 3, ‘paged’ => $paged, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’ ) ); $ctr = 0; while ( $loopb->have_posts() ) : $loopb->the_post(); $post_ID = […]