Skip to content

Instantly share code, notes, and snippets.

View simbasounds's full-sized avatar

Simon Barnett simbasounds

View GitHub Profile
@simbasounds
simbasounds / checked-and-unchecked.php
Last active June 8, 2024 09:14
Get all taxonomy terms of the current post in the loop and output them as a list of checked and unchecked items
<!--
The shortcode will detect the current post type.
Usage: specify your taxonomy like so (defaults to "category"):
[checked-list taxonomy="portfolio"]
Add to functions.php
-->
<?php // Consider excluding opening PHP tag
function display_checked_list_shortcode( $atts ) {
@simbasounds
simbasounds / Tame Bricks entrance animations by modifying their start points.css
Last active June 3, 2024 21:14
The default entrance animations in Bricks Builder are too extreme. To tame some of them, add this to Bricks > Settings > Custom code > Custom CSS.
@keyframes fadeInDown2 {
from {
opacity: 0;
transform: translate3d(0, -30px, 0)
}
to {
opacity: 1;
transform: none
}
}
@simbasounds
simbasounds / style.css
Last active November 9, 2017 19:49
Dynamic Image Scaling with Smartphone Landscape Exception
/*
* Dynamic Image Scaling with Smartphone Landscape Exception
* ----------------------------------------------------------
* Pic fits screen.
* Except on smartphone landscape,
* where it fills the width, and
* overflows the height.
*/
img.dynamic-size {
@simbasounds
simbasounds / Very Simple FlexBox override for WordPress Galleries.css
Last active September 18, 2016 18:05
This code will remove the borders around WordPress gallery images and change the layout model to CSS flexbox.
.gallery {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
@simbasounds
simbasounds / wp-template-for-bb.php
Created July 15, 2016 20:49
WordPress template < - > Beaver Builder layout template. Incl. hook for custom BB module.
<?php
add_action('fl_dynamic_switchboard', 'my_template_code');
function my_template_code() {
/* Your template loop code here */
}
add_action('fldts_fl_template','fldts_get_fl_template');
function fldts_get_fl_template() {
FLBuilder::render_query( array(
@simbasounds
simbasounds / structural-template-for-bbdts.php
Last active July 14, 2016 00:41
Sample WordPress structural template code for Dynamik Website Builder and Beaver Builder Dynamic Template Switchboard plugin.
<?php
add_filter( 'body_class', 'dynamik_page_builder_body_class' );
function dynamik_page_builder_body_class( $classes ) {
$classes[] = 'dynamik-page-builder';
return $classes;
}
add_action('fl_dynamic_switchboard', 'fldts_template_content');
function fldts_template_content() {
@simbasounds
simbasounds / Simple WordPress image gallery shortcode.php
Created January 10, 2016 19:06
Simple WordPress image gallery shortcode. Add to functions.php. Images categorised as 'Gallery' will be fetched. Data attribute is for Featherlight lightbox.
@simbasounds
simbasounds / single-cpt.php
Created January 10, 2016 15:53
Single Custom Post Type Template for WordPress or WordPress + Genesis.
<?php
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'custom_loop' );
function custom_loop() {
while ( have_posts() ) : the_post();
if ( has_post_thumbnail() ) {
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail', true);
$my_thumb_url = $thumb_url[0];
$my_post_thumb = "background-image: url(" . $my_thumb_url .");";
@simbasounds
simbasounds / Output content with html tags.php
Last active July 23, 2018 22:23
Output WordPress unstripped content (with html tags). Add to functions.php and use ob_wp_content() in templates instead of the_content()
//* Output Content with html tags
function ob_wp_content($display = true) {
global $post;
ob_start();
the_content();
$output = ob_get_contents();
ob_end_clean();
if(!$display) {return $output;} else {print $output;};
}
@simbasounds
simbasounds / Proportional size with vertical centring.css
Created January 10, 2016 15:24
Proportional size with vertical centring in CSS
/* Basic vertical centring (middle) */
.container {
position: relative;
}
.content {
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%);