Skip to content

Instantly share code, notes, and snippets.

ellegaarddk ellegaarddk

Block or report user

Report or block ellegaarddk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ellegaarddk
ellegaarddk / optimized.htaccess
Last active Jun 22, 2019
Optimised htaccess for WP - expires, headers and deflate
View optimized.htaccess
# Optimized expire cache and compression
# For WordPress
# by ellegaard ID
# Insert above default WP section in .htaccess - use with caution!
# BEGIN Manual editing for speed
## BEGIN Expire headers
<ifModule mod_expires.c>
AddType application/font-sfnt otf ttf
AddType application/font-woff woff
@ellegaarddk
ellegaarddk / stikcy-anchor-points.css
Created May 14, 2019
Keeping anchor point below sticky header
View stikcy-anchor-points.css
body:not(.elementor-editor-active) /* for not messsing up elementor editor */
*[id]:before {
content: "";
display:block;
height: 150px; /* fixed header height*/
margin: -150px 0 0; /* negative fixed header height */
visibility: hidden;
pointer-events: none;
z-index: -1; /* This prevents any links being behind the offset block and un-clickable */
}
@ellegaarddk
ellegaarddk / remove_product_tabs.php
Created Nov 2, 2018
Remove one or all of the WooCommerce tabs
View remove_product_tabs.php
<?php
/**
* Remove woocomerce product data tabs
* @origin https://wp-pro.dk/guides/tilpas-woocommerce-faneblades-titel-og-overskrift
*/
add_filter( 'woocommerce_product_tabs', 'eid_remove_product_tabs', 98 );
function eid_remove_product_tabs( $tabs ) {
unset( $tabs['description'] ); // Remove the description tab
@ellegaarddk
ellegaarddk / functions.php
Last active Mar 11, 2019
Autoptimize: adjust the level of the autowarning on cache size to 1GB
View functions.php
<?php
// #Adjusting Autoptimize warning limit to 1GB
add_filter('autoptimize_filter_cachecheck_maxsize','adjust_cachesize');
function adjust_cachesize() {
return 1024*512*1024;
}
@ellegaarddk
ellegaarddk / functions.php
Created Dec 15, 2017
Tilføjer 'Udsolgt label til WooCommerce
View functions.php
// Adds 'Udsolgt' label to produkts out of stock
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_stock', 10);
function woocommerce_template_loop_stock() {
global $product;
if ( ! $product->managing_stock() && ! $product->is_in_stock() )
echo '<p class="stock out-of-stock">Udsolgt</p>';
}
@ellegaarddk
ellegaarddk / remove_widgets.php
Created Aug 23, 2018
WordpRess: Remove not needed widgets from backend
View remove_widgets.php
/*
* Remove unneccesary default widgets from backend
* Comment out what you wish to see
*/
function unregister_default_widgets() {
unregister_widget('WP_Widget_Pages');
unregister_widget('WP_Widget_Calendar');
unregister_widget('WP_Widget_Archives');
unregister_widget('WP_Widget_Links');
unregister_widget('WP_Widget_Meta');
View remove_woocommerce_widgets.php
//* Remove unused Woocommerce widgets */
function eid_unregister_woo_widgets() {
// unregister_widget( 'WC_Widget_Recent_Products' );
unregister_widget( 'WC_Widget_Featured_Products' );
// unregister_widget( 'WC_Widget_Product_Categories' );
unregister_widget( 'WC_Widget_Product_Tag_Cloud' );
unregister_widget( 'WC_Widget_Cart' );
// unregister_widget( 'WC_Widget_Layered_Nav' );
// unregister_widget( 'WC_Widget_Layered_Nav_Filters' );
unregister_widget( 'WC_Widget_Price_Filter' );
@ellegaarddk
ellegaarddk / woo_add_SKU_cat_pages
Created Oct 22, 2018
Tilføj SKU fra WooCommerce på kategorisider
View woo_add_SKU_cat_pages
/* WooCommerce - add SKU on cat pages */
add_action( 'woocommerce_after_shop_loop_item_title', 'shop_sku', 5 );
function shop_sku(){
global $product;
echo '<span itemprop="productID" class="sku">' . __('SKU', 'woocommerce'). ': ' . $product->sku . '</span>';
}
@ellegaarddk
ellegaarddk / wpml_show_default.php
Last active Mar 6, 2019
Show default version if translation isn't found
View wpml_show_default.php
<?php
add_filter('icl_ls_languages', 'wpml_ls_filter');
function wpml_ls_filter($languages) {
global $sitepress;
$default_url = $languages[$sitepress->get_default_language()]['url'];
foreach($languages as $lang_code => $language){
if($languages[$lang_code]['missing']==1){
$languages[$lang_code]['url'] = $default_url;
@ellegaarddk
ellegaarddk / woo_change_tab_headline_desc.php
Last active Mar 6, 2019
Change Woocommerce tab title and/or description to something else - or nothing
View woo_change_tab_headline_desc.php
<?php
/* This will change the heading (H2:Decstiption) within the description tab to product name
* @origin https://wp-pro.dk/guides/tilpas-woocommerce-faneblades-titel-og-overskrift
*/
add_filter( 'woocommerce_product_description_heading', 'eid_change_product_description_tab_heading', 10, 1 );
function eid_change_product_description_tab_heading( $title ) {
global $post;
return $post->post_title; //change to "" to remove text
}
You can’t perform that action at this time.