Skip to content

Instantly share code, notes, and snippets.

View flegfleg's full-sized avatar

Florian Egermann flegfleg

View GitHub Profile
@flegfleg
flegfleg / cb tag.php
Last active June 8, 2020 13:36
tag system in cb
<?php
// add this to any template, e.g. booking-publish.php
// echo
CB::echo('item', 'mymeta'); // this is the item meta
CB::echo('item', 'mymethod'); // this is a method in class item
CB::echo('timeframe', 'myproperty'); // this is a property of class timeframe
CB::echo('booking', 'myproperty'); // 'booking' is substited with 'timeframe' in CB.php
@flegfleg
flegfleg / dein-lastenrad.css
Created June 6, 2020 19:47
dein-lastenrad.css
/* Das folgende CSS wird für alle Benutzeroberflächen geladen. */
/* -------------- HEADER ------------ */
/* Header modifications: Logo */
#p-logo {
width: 200px;
}
/* Header modifications: Hide non-essential Page Tools */
#pt-userpage, #pt-mytalk, #pt-watchlist, #pt-mycontris {
@flegfleg
flegfleg / kasimir-theme-padding-anpassen.css
Created June 3, 2020 11:49
Kasimir theme padding anpassen
.wrap {
padding-left: 0 !important;
padding-right: 0 !important;
}
@flegfleg
flegfleg / add caps to wp custom post types
Created February 2, 2019 11:22
add caps to wp custom post types
<?php
function create_post_type_items() {
register_post_type( 'acme_item',
array(
'labels' => array(
'name' => __( 'CB2 Items' ),
'singular_name' => __( 'CB2 Item' )
),
'public' => true,
<?php
// Start with an underscore to hide fields from custom fields list
$prefix = '_cb2_velogistics_';
/**
* Initiate the metabox
*/
$cmb = new_cmb2_box( array(
'id' => '_cb2_velogistics_',
@flegfleg
flegfleg / hide.css
Created July 8, 2018 19:31
commons booking hide contact+opening hours
.single-cb_items .cb-contact,
.single-cb_items .cb-opening-hours {
display: none;
}
<translate>
== Veranstaltungen ==
Veranstaltungen rund um das Thema "Freies Lastenrad". Tragt gerne eure eigenen hier ein.
</translate>
@flegfleg
flegfleg / example output cb-object.php
Last active April 19, 2018 20:33
example output cb-object
<?php
$args = array();
$tf = new CB_Timeframe();
$tf->set_context('timeframe'); // either 1) 'timeframe' (default): group by timeframe or 2) 'calendar': group by date or 3) 'admin_table'
$timeframes = $tf->get_timeframes( $args );
var_dump($timeframes);
?>
array (size=2)
0 =>
@flegfleg
flegfleg / cbDisableDelete.js
Last active April 16, 2018 19:33
Hide/Disable delete button in Commons Booking 0.9 bookings table.
jQuery( document ).ready(function() {
jQuery('body.toplevel_page_cb_bookings span.delete').hide();
});
<?php
// see https://github.com/flegfleg/cb-temp/blob/master/classes/CB_Object.php#L161
$args = array (
'item_id' => get_the_id(), // This template is called in the loop, so you need to supply the id
);
$tf = new CB_Timeframe();
$tf->set_context('admin_table'); // either 1) 'timeframe' (default): group by timeframe or 2) 'calendar': group by date or 3) 'admin_table'
$tf->get_timeframes( $args );