Skip to content

Instantly share code, notes, and snippets.

View lukecav's full-sized avatar
🎅
The best way to spread Christmas cheer is singing loud for all to hear.

Luke Cavanagh lukecav

🎅
The best way to spread Christmas cheer is singing loud for all to hear.
View GitHub Profile
@lukecav
lukecav / gist:c55c0ec4fb1b357eb9cb
Created January 15, 2016 22:09
CPT on Blog Module
Ok, open up includes/builder/main-modules.php, and on line 10908 replace this code
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
and replace it with
<h2 class="entry-title"><a href="<?php if ( ( $myurl = get_post_meta( get_the_ID(), 'myurl', true) ) && $myurl<> '' ){
echo $myurl;} else { the_permalink();} ?>"><?php the_title(); ?></a></h2>
Now you can use custom field with the name myurl.
This should redirect the titles of your blog items to custom URL that you can define via myurl custom link. let me know the result
@lukecav
lukecav / gist:24c112db248c494461a5
Created January 18, 2016 19:38
Top Navigation Move Search Box below fold
#et-top-navigation #et_top_search {
margin: 18px 0 0 9px; }
@media screen and (max-width: 980px) {
#et-top-navigation #et_top_search {
width: 45px;
margin-top: 12px; } }
#et_search_icon:before {
opacity: 1 !important;
animation: none !important;
@lukecav
lukecav / gist:2629f35fdde7ca0a26b7
Created January 22, 2016 17:12
Code for adding a color background behind the description for the slider
/*Code for adding a color background behind the description for the slider.*/
.et_pb_slider .et_pb_container {
width: 100%;
max-width: 100%;
min-height: 466px !important;
display: flex; }
.et_pb_slide_description, .et_pb_slider_fullwidth_off .et_pb_slide_description {
padding: 3% 6%;
background: rgba(166, 31, 36, 0.5);
<?php
$iepage = 9999999999;
if( is_page( $iepage ) ) {
if( preg_match( '/(?:\b(MS)?IE\s+|\bTrident\/7\.0;.*\s+rv:)(\d+)/', $_SERVER['HTTP_USER_AGENT'] ) ) {
header( "Location: https://www.google.com/chrome/" );
}
}
?>
@lukecav
lukecav / gist:299e65dc2ae25f278338
Created January 28, 2016 23:32
Widget Title URL
// We will make use of widget_title filter to
//dynamically replace custom tags with html tags
add_filter( 'widget_title', 'accept_html_widget_title' );
function accept_html_widget_title( $mytitle ) {
// The sequence of String Replacement is important!!
$mytitle = str_replace( '[link', '<a', $mytitle );
<?php
//RELATED POSTS
$post_id = get_the_ID();
//get related services
$related_services = get_post_meta( $post_id, '_pods_services' );
$services = $related_services[0];
if(!empty($related_services)) { ?>
@lukecav
lukecav / gist:e9c082ef6b0eb301c529
Created February 4, 2016 18:43
Add SVG Support for Uploads and Fix SVG Thumbnails in Library Admin List View
//ADD SVG SUPPORT FOR UPLOADS
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
//FIX SVG THUMBNAILS IN LIBRARY ADMIN LIST VIEW
function fix_svg_thumb_display() {
echo '<style> td.media-icon img[src$=".svg"], img[src$=".svg"].attachment-post-thumbnail { width: 100% !important; height: auto !important; } </style>';
@lukecav
lukecav / gist:dc70b70d507cd7f6e514
Created February 16, 2016 21:12
Telephone Number in Secondary Navigation Clickable in Divi
<div id="et-info">
<?php if ( '' !== ( $et_phone_number = et_get_option( 'phone_number' ) ) ) : ?>
<span id="et-info-phone"><a href="tel:<?php echo esc_html( $et_phone_number ); ?>"><?php echo esc_html( $et_phone_number ); ?></a></span>
<?php endif; ?>
@lukecav
lukecav / gist:caeab013e93ea866fb83
Created February 16, 2016 21:17
Divi Phone Hover
#et-info-phone:hover
{
opacity: 0.7;
transition-property: all;
transition-duration: 0.4s;
transition-timing-function: ease-in-out;
transition-delay: 0s;
}
@lukecav
lukecav / gist:f32f8ad09b32e32f2631
Created February 18, 2016 17:39
Video Loading Code
<?php
//video files uploaded into media library and saved to the post via Advanced Custom Fields
$webm = get_sub_field('webm');
$mp4 = get_sub_field('mp4');
$ogv = get_sub_field('ogv');
?>
<video class="video">
<source src="<?php echo $webm['url']; ?>" type="video/webm">
<source src="<?php echo $mp4['url']; ?>" type="video/mp4">
<source src="<?php echo $ogv['url']; ?>" type="video/ogv">