Skip to content

Instantly share code, notes, and snippets.

View robertstaddon's full-sized avatar

Robert Staddon robertstaddon

View GitHub Profile
@robertstaddon
robertstaddon / functions.php
Last active June 14, 2023 18:17
Divi - remove Divi sidebar from all WooCommerce Product pages (as well as Shop and Category pages) pages with a hook
<?php
/**
* Remove Divi sidebar from all WooCommerce Product pages (as well as Shop and Category pages)
*/
function mytheme_divi_output_content_wrapper_end() {
echo '
</div> <!-- #left-area -->
</div> <!-- #content-area -->
</div> <!-- .container -->
@robertstaddon
robertstaddon / style.css
Created August 17, 2017 07:25
Divi - CSS rule for an overlay (with animation)
.background-fade .et_pb_slide.et_pb_bg_layout_dark:after {
position: absolute;
content: '';
top: 0;
right: 0;
left: 0;
bottom: 0;
animation: customFadeToDark 3s ease-out 1s 1 both;
-webkit-animation: customFadeToDark 3s ease-out 1s 1 both;
}
@robertstaddon
robertstaddon / style.css
Created August 17, 2017 07:23
Divi - CSS rule for an overlay (with light overlay)
.background-fade .et_pb_slide.et_pb_bg_layout_light:after {
position: absolute;
content: '';
top: 0;
right: 0;
left: 0;
bottom: 0;
background-color:rgba(255,255,255,.7);
}
@robertstaddon
robertstaddon / style.css
Created August 17, 2017 07:22
Divi - CSS rule for an overlay
.background-fade .et_pb_slide:after {
position: absolute;
content: '';
top: 0;
right: 0;
left: 0;
bottom: 0;
background-color:rgba(0,0,0,.5);
}
@robertstaddon
robertstaddon / style.css
Created August 14, 2017 21:19
Divi - style the custom featured image (include default blog page)
@media all and (min-width: 768px) {
.et_pb_posts img, .archive .post img, .category .post img, .search .post img, .blog .post img {
float: left;
margin-right: 1em;
}
.et_pb_posts article:after, .archive article:after, .category article:after, .search article:after, .blog article:after { /* Clear floated image */
content: "";
display: table;
clear: both;
}
@robertstaddon
robertstaddon / style.css
Created August 14, 2017 21:17
Divi - Style the custom featured image
@media all and (min-width: 768px) {
.et_pb_posts img {
float: left;
margin-right: 1em;
}
.et_pb_posts article:after { /* Clear floated image */
content: "";
display: table;
clear: both;
}
@robertstaddon
robertstaddon / functions.php
Last active August 14, 2017 21:19
Divi - custom featured post image size (include default WordPress blog pages)
<?php
function mycustom_featured_width( ) { return 320; /* Custom featured post image width */ }
add_filter( 'et_pb_blog_image_width', 'mycustom_featured_width');
add_filter( 'et_pb_index_blog_image_width', 'mycustom_featured_width');
function mycustom_featured_height( ) { return 260; /* Custom featured post image height */ }
add_filter( 'et_pb_blog_image_height', 'mycustom_featured_height');
add_filter( 'et_pb_index_blog_image_height', 'mycustom_featured_height');
function mycustom_featured_size( $image_sizes ) {
@robertstaddon
robertstaddon / functions.php
Last active August 14, 2017 21:20
Divi - custom featured post image size
<?php
function mycustom_featured_width( ) { return 320; /* Custom featured post image width */ }
add_filter( 'et_pb_blog_image_width', 'mycustom_featured_width');
function mycustom_featured_height( ) { return 260; /* Custom featured post image height */ }
add_filter( 'et_pb_blog_image_height', 'mycustom_featured_height');
function mycustom_featured_size( $image_sizes ) {
$custom_size = mycustom_featured_width() . 'x' . mycustom_featured_height();
@robertstaddon
robertstaddon / functions.php
Created March 15, 2017 06:36
Hide category and forum menu items that are restricted by Itthinx Groups
<?php
/**
* Menu items of categories and forums should be hidden if the user doesn't belong to the Group
*/
if ( !is_admin() ) {
add_filter( 'wp_get_nav_menu_items', 'lenspiration_hide_groups_restricted_menu_items', 999, 3 );
}
function lenspiration_hide_groups_restricted_menu_items( $items = null, $menu = null, $args = null ) {
$user_id = get_current_user_id();
@robertstaddon
robertstaddon / rewrite.php
Created February 24, 2017 20:43
Rewrite POST data
<?php
if($_POST) {
$postdata = http_build_query($_POST);
$opts = array('http' =>array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
$context = stream_context_create($opts);
$result = file_get_contents("https://mynewdomain.com$_SERVER[REQUEST_URI]", false, $context);
echo $result;
} else {
header("Location: https://mynewdomain.com$_SERVER[REQUEST_URI]");
exit();