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 / 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 / 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 Nov 2, 2018
Special functions for this website that shouldn't be put in the child theme
View functions.php
<?php
/*
Plugin Name: Functions for my website
Plugin URI: https://wp-pro.dk/lav-dit-eget-funktionsplugin/
Description: Special functions for this website without their own plugin
Version: 1.5
Author: Ellegaard ID
Author URI: http://www.eid.dk
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@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 / change_product_description_tab_title.php
Last active Nov 2, 2018
This will change the title (Description) of the description tab to something else - here 'Event information'. Use a suitable txt_domain for translations.
View change_product_description_tab_title.php
<?php
/* This will change the title (Description) of the description tab to something else
* @origin https://wp-pro.dk/guides/tilpas-woocommerce-faneblades-titel-og-overskrift
*/
add_filter( 'woocommerce_product_tabs', 'eid_change_product_description_tab_title', 10, 1 );
function eid_change_product_description_tab_title( $tabs ) {
global $post;
if ( isset( $tabs['description']['title'] ) )
$tabs['description']['title'] = __('Event information', 'txt_domain'); // change for something else, ready for translation
@ellegaarddk
ellegaarddk / woo_change_tab_titel_desc.php
Last active Nov 2, 2018
Change Woocommerce description tab title to product name
View woo_change_tab_titel_desc.php
<?php
// This wil cheange the title (Description) of the description tab to product name
add_filter( 'woocommerce_product_tabs', 'eid_change_product_description_tab_title', 10, 1 );
function eid_change_product_description_tab_title( $tabs ) {
global $post;
if ( isset( $tabs['description']['title'] ) )
$tabs['description']['title'] = $post->post_title;
return $tabs;
}
@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
}
@ellegaarddk
ellegaarddk / slider_cpt.php
Created Oct 22, 2018
creating custom post type for frontpage slider
View slider_cpt.php
<?php
/* creating custom post type for frontpage slider
* By ellegaard ID - www.eid.dk
*/
add_action('init', 'create_frontpagepic');
function create_frontpagepic() {
$feature_args = array(
'labels' => array(
'name' => __( 'Forsidebilleder' ),
@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 / create_product_cpt
Created Oct 22, 2018
Opret Custom Post Type til produkter
View create_product_cpt
function eid_cpt_produkt() {
$labels = array(
'name' =&gt; _x( 'Produkter', 'Post Type General Name', 'eid_domain' ),
'singular_name' =&gt; _x( 'Produkt', 'Post Type Singular Name', 'eid_domain' ),
'menu_name' =&gt; __( 'Produkter', 'eid_domain' ),
'parent_item_colon' =&gt; __( 'Produkt over:', 'eid_domain' ),
'all_items' =&gt; __( 'Alle produkter', 'eid_domain' ),
'view_item' =&gt; __( 'Vis produkt', 'eid_domain' ),
You can’t perform that action at this time.