Skip to content

Instantly share code, notes, and snippets.

View commwork's full-sized avatar
😄

COMMWORK commwork

😄
View GitHub Profile
@stephanieleary
stephanieleary / wp_private_page_filters.php
Last active March 7, 2018 12:41
Private page filters for WordPress. Related to ticket #8592.
<?php
/*
Plugin Name: Unpublished Hierarchies
Description: A tiny plugin to allow draft, private, scheduled, and password-protected pages to be selected as parents.
Author: Stephanie Leary
Version: 1.0
Author URI: http://stephanieleary.com
License: GPL2
*/
@leoken
leoken / redirect-parent-to-child.php
Created December 28, 2012 06:56
Redirect Parent to First Child - WordPress Plugin
<?php
/*
Plugin Name: Redirect Parent to First Child
Plugin URI: http://www.nathanrice.net/parent-to-first-child
Description: This plugin will do a 301 redirect on top-level parent pages, to their first child page, based first on menu order, then post title if no menu order is set. It only redirects if a *published* child page actually exists.
Version: 0.1
Author: Nathan Rice
Author URI: http://www.nathanrice.net/
License: This plugin is licensed under GPL.
@charleslouis
charleslouis / custom-search-acf-wordpress.php
Last active December 15, 2023 09:11
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request
<?php
/**
* [list_searcheable_acf list all the custom fields we want to include in our search query]
* @return [array] [list of custom fields]
*/
function list_searcheable_acf(){
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF");
return $list_searcheable_acf;
}
@stephenscaff
stephenscaff / Random Images on Refresh
Last active October 21, 2023 07:29
Super simple way to randomly load new images on refresh via Jquery and DOM injection. Great for banners.
<!DOCTYPE html>
<head>
<!--Little CSS fade in -->
<style>
.fade-in{
-webkit-animation: fade-in 2s ease;
-moz-animation: fade-in ease-in-out 2s both;
-ms-animation: fade-in ease-in-out 2s both;
-o-animation: fade-in ease-in-out 2s both;
@emaildano
emaildano / acf-radio-button-example.php
Last active October 14, 2016 08:08
ACF Radio Button Example
<?php $program = get_sub_field('program_selection'); ?>
<?php if( $program == 'intensity' ){ ?>
<?php } else if( $program == 'crossfit' ){ ?>
<?php } else if( $program == 'personal' ){ ?>
<?php } else if( $program == 'allprograms' ){ ?>
@DannyNunez
DannyNunez / BootStrapFlyoutMenu.html
Last active June 19, 2018 10:41
Boot Strap Flyout Menu
<!doctype html>
<html>
<head>
<title>Boot Strap Fly out</title>
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<style>
/* Drop Down FLyout Menu */
.dropdown-submenu {
@mattradford
mattradford / acf_get_directions.php
Last active February 16, 2023 12:08
ACF Get Directions map link
<?php
$location = get_field('map_location');
if ( !empty( $location ) ) :
$map_url = 'https://www.google.com/maps/dir/?api=1&destination=' . $location['lat'] . ',' . $location['lng'];
echo '<a href=". esc_url( $map_url ) . '" rel="nooopener">Get directions</a>';
endif;
?>
<p>This should produce a link like this:</p>
<a href="https://www.google.com/maps/dir/?api=1&destination=51.072159,1.088130">Get directions</a>
@cfxd
cfxd / shortcode.css
Last active November 17, 2021 05:53
How to Make the WordPress Video Shortcode Responsive. See http://cfxdesign.com/how-to-make-the-wordpress-video-shortcode-responsive
.wp-video, video.wp-video-shortcode, .mejs-container, .mejs-overlay.load {
width: 100% !important;
height: 100% !important;
}
.mejs-container {
padding-top: 56.25%;
}
.wp-video, video.wp-video-shortcode {
max-width: 100% !important;
}
@jacurtis
jacurtis / _spacing-helpers.scss
Last active May 30, 2024 17:41
SASS Margin and Padding Helpers Loop. Generates .m-t-10 type helper classes.
/*
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects.
It will generate several classes such as:
.m-r-10 which gives margin-right 10 pixels.
.m-r-15 gives MARGIN to the RIGHT 15 pixels.
.m-t-15 gives MARGIN to the TOP 15 pixels and so on.
.p-b-5 gives PADDING to the BOTTOM of 5 pixels
.p-l-40 gives PADDING to the LEFT of 40 pixels
@giodc
giodc / wordpress-check-if-image-is-gif
Last active June 23, 2022 03:54
Check if WordPress featured image is gif, and output full size image to allow animated gif in Loop
<?php
$url = wp_get_attachment_url( get_post_thumbnail_id() );
$filetype = wp_check_filetype($url);
if ($filetype[ext] == 'gif')
{the_post_thumbnail('full', array('class' => 'img-responsive')); }
else