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 / custom_elementor_queries.php
Last active Jan 2, 2020
Custom queries for Elementor use - WordPress. To be inserted in you theme's functions.php or a custom made functions plugin.
View custom_elementor_queries.php
<php
/*
* Custom queries for Elementor
* by ellegaard ID
*/
/* Get direct children of current page
*
* for query ID use 'pages_direct_child_filter'
*/
@ellegaarddk
ellegaarddk / get_same_cpt_cat_as_current.php
Last active Jan 2, 2020
Get the post-type 'People' posts from the same custom taxonomy - WordPress, custom post type (CPT)
View get_same_cpt_cat_as_current.php
<?php
$id = get_post($post->ID);
$tax = get_the_terms($id, 'position');
$args = array(
'post_type' => 'people',
'tax_query' => array(
array(
'taxonomy' => 'position',
'field' => 'slug',
'terms' => $tax[0]->slug,
@ellegaarddk
ellegaarddk / MENU-text-hamburger.css
Last active Nov 14, 2019
Add the text "MENU" to a hamburger/mobile menu created with Elementor in WordPress
View MENU-text-hamburger.css
/* places the text "MENU" til the left of the default hamburger menu */
.elementor-menu-toggle:before{
position: relative;
padding-right: 10px;
content: "MENU";
font-weight: 700;
color: rgba(0,0,0,.5)
}
@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
}
You can’t perform that action at this time.