Skip to content

Instantly share code, notes, and snippets.

View DigitalEssence's full-sized avatar

Hedley Phillips DigitalEssence

View GitHub Profile
@DigitalEssence
DigitalEssence / WordPress - Debug Pending Updates
Created March 4, 2019 11:33
WordPress - Debug Pending Updates
/**
* Debug Pending Updates
* Displays hidden plugin and theme updates on update-core screen.
*/
function debug_pending_updates() {
// Rough safety nets
if ( ! is_user_logged_in() || ! current_user_can( 'update_plugins' ) || ! current_user_can( 'update_themes' ) ) return;
$output = "";
@DigitalEssence
DigitalEssence / WordPress - Enfold - PHP - Add Div using functionand add_action
Created February 18, 2019 17:16
WordPress - Enfold - PHP - Add Div using functionand add_action
// Simple function to add a div
// Note, the display is set to none so it is only visible in the source code
function custom_stuff(){
?>
<div style="display:none">Find this</div>
<?php
}
add_action('wp_footer', 'custom_stuff');
@DigitalEssence
DigitalEssence / DigitalEssence - WordPress - CSS - Add transparent overlay
Last active February 18, 2019 17:15
- WordPress - CSS - Add transparent overlay
.div-to-have-overlay {
background: #fff;
height: 100%;
width: 100%;
opacity: 0.5;
top: 0;
left: 0;
position: absolute;
padding: 0;
transition: opacity .5s;
@DigitalEssence
DigitalEssence / WordPress - Enfold - PHP - Check if a post date is in the past
Last active February 18, 2019 12:47
WordPress - Enfold - PHP - Check if a post date is in the past
// For Enfold copy /enfold/config-templatebuilder/avia-shortcodes/postslider.php
// to /child-theme/shortcodes/postslider/postslider.php
// Add this query
if (strtotime(get_the_date( "Y-m-d", $the_id )) < strtotime(date("Y-m-d"))) {
//Do something
}
else {
//Do nothing
}
@DigitalEssence
DigitalEssence / WordPress - Enfold - PHP - Add Custom Shortcode
Last active June 17, 2020 14:45
WordPress - Enfold - PHP - Add Custom Shortcode
// Add to functions.php
add_shortcode( 'de_shortcode', 'de_shortcode' );
function de_shortcode() {
$buffer = '<h3>Post Titles</h3>';
$q = new WP_Query(array(
'post_type' => 'post',
'posts_per_page' => 6
));
while ($q->have_posts()) {
@DigitalEssence
DigitalEssence / WordPress - Enfold - PHP - Change element to full width under x pixels
Created February 13, 2019 17:13
WordPress - Enfold - PHP - Change element to full width under x pixels
@media only screen and (max-width: 1170px)
{
/*Make the programme left col become full width under 1170px*/
.homepage-blog-section-left-col {
display:block!important;
width:100%!important;
}
}
@DigitalEssence
DigitalEssence / WordPress - Enfold - PHP - Display current date in socket
Last active February 15, 2019 10:52
WordPress - Enfold - PHP - Display current date in socket
// Add dynamic date in Socket Copyright
// Add to functions.php
// Place [year] in socket
function year_shortcode() {
$year = date('Y');
return $year;
}
add_shortcode('year', 'year_shortcode');
@DigitalEssence
DigitalEssence / WordPress - Enfold PHP - Restrict Post Previous and Next buttons to within its Category
Created March 29, 2018 15:45
WordPress - Enfold PHP - Restrict Post Previous and Next buttons to within its Category
//Restrict next<>previous links to within its own category
add_filter('avia_post_nav_settings', 'avia_post_nav_settings_mod');
function avia_post_nav_settings_mod($settings)
{
$settings['same_category'] = true;
return $settings;
}
#header .main_menu .avia-menu-fx {display: none !important;}
.icon-colour-section li:nth-child(1) .avia-font-entypo-fontello {background-color:#03a9b5!important;}
.icon-colour-section li:nth-child(2) .avia-font-entypo-fontello {background-color:#6a6d71!important;}
.icon-colour-section li:nth-child(3) .avia-font-entypo-fontello {background-color:#b3ba93!important;}
.icon-colour-section li:nth-child(4) .avia-font-entypo-fontello {background-color:#b3b9ae!important;}
.icon-colour-section li:nth-child(5) .avia-font-entypo-fontello {background-color:#285e71!important;}