Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ellegaarddk's full-sized avatar

ellegaarddk ellegaarddk

View GitHub Profile
function eid_cpt_employee() {
register_post_type( 'eid_team_member',
array(
'labels' => array(
'name' => __( 'Medarbejdere', 'eid_function' ),
'singular_name => __( 'Medarbejder', 'eid_function' ),
),
'description' => __( 'Virksomhedens medarbejdere', 'eid_function' ),
'public' => true,
'has_archive' => true,
@ellegaarddk
ellegaarddk / custom_elementor_queries.php
Last active October 10, 2023 14:14
Custom queries for Elementor use - WordPress. To be inserted in you theme's functions.php or a custom made functions plugin.
<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 October 10, 2023 14:18
Get the post-type 'People' posts from the same custom taxonomy - WordPress, custom post type (CPT)
<?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 October 10, 2023 14:18
Add the text "MENU" to a hamburger/mobile menu created with Elementor in WordPress
/* 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
Last active July 27, 2022 07:41
Keeping anchor point below sticky header
/** better solution
* description on https://wp-pro.dk/?p=3656
**/
:target { scroll-margin-top:75px}
/** old solution - don't use this! **/
body:not(.elementor-editor-active) /* for not messsing up elementor editor */
*[id]:before {
content: "";
display:block;
@ellegaarddk
ellegaarddk / functions.php
Last active March 11, 2019 08:08
Autoptimize: adjust the level of the autowarning on cache size to 1GB
<?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 November 2, 2018 12:14
Special functions for this website that shouldn't be put in the child theme
<?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 November 2, 2018 11:15
Remove one or all of the WooCommerce tabs
<?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 November 2, 2018 11:09
This will change the title (Description) of the description tab to something else - here 'Event information'. Use a suitable txt_domain for translations.
<?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 November 2, 2018 10:15
Change Woocommerce description tab title to product name
<?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;
}