Skip to content

Instantly share code, notes, and snippets.

View ellegaarddk's full-sized avatar

ellegaarddk ellegaarddk

View GitHub Profile
@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 / 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'
*/
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,