Skip to content

Instantly share code, notes, and snippets.

@zartgesotten
zartgesotten / dropdown.php
Last active October 24, 2017 09:01
Creates a dropdown with all event categories Has to be added to template where the dropdown should be displayed. Sources: https://theeventscalendar.com/support/forums/topic/category-dropdown/ https://pastebin.com/jg2hr5yz
<?php
$categories = get_categories(
array(
'taxonomy' => TribeEvents::TAXONOMY,
'selected' => 0,
'orderby' => 'name'
) );
?>
<script type="text/javascript"><!--
<div class="brotkruemel">
<?php
if(function_exists('bcn_display'))
{
bcn_display();
}
?>
</div>
@zartgesotten
zartgesotten / toolset-display-address-shortcode.php
Created November 27, 2017 14:45
Display address from address field not like: mystreet 34, london, uk but like: mystreet 34 London USAGE: [address id="2"] UK
<?php //Custom shortcode to add taxonomy image to Views
function getAddress_func( $atts ) {
$stadd = types_get_field_meta_value( 'standort-adresse', $atts['id'] );
$stadd = str_replace (',','<br>',$stadd);
$stadd = str_replace ('Deutschland','',$stadd);
return $stadd;
}
add_shortcode( 'adresse', 'getAddress_func' );
?>
li.kaeltetechnik a {
position:relative; overflow:hidden;
}
li.kaeltetechnik a::after{ content: '';
position: absolute;
top: -179%;
right: -87%;
bottom: 18%;
left: -173%;
@zartgesotten
zartgesotten / restrict-upload.php
Last active December 7, 2017 13:57
This goes into a small plugin and into the folder mu-plugins ... User can now only upload images and pdf
<?php add_filter('upload_mimes','restrict_mimes_for_subscriber');
function restrict_mimes_for_subscriber($mimes) {
if (!current_user_can('read')) {
return;
}
$mimes = array(
'pdf' => 'application/pdf',
'jpg|jpeg' => 'image/jpeg',
'png' => 'image/png',
<?php
//Page Slug Body Class
function add_slug_body_class( $classes ) {
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
return $classes;
}
add_filter( 'body_class', 'add_slug_body_class' );
@zartgesotten
zartgesotten / remove-current-post-from-loop.php
Created December 15, 2017 11:20
You might want to display "related" posts via Themer and a grid or other content module. Too bad, they also display the current Post. This code goes into functions.php and removes the current post from the loop on single pages.
<?php
add_filter( 'fl_builder_loop_query_args', 'probb_exclude_current_post' );
function probb_exclude_current_post( $args )
{
//add post type here
if( is_singular( 'referenz' ) )
{
$args['post__not_in'] = array( get_the_ID() );
}
<?php
function delete_directory($dirname) {
if (is_dir($dirname)){
$dir_handle = opendir($dirname);
}
if (!$dir_handle){
return false;
}
while($file = readdir($dir_handle)) {
input.wpcf7-submit:disabled,
input.wpcf7.submit[disabled]{
border: 1px solid #999999;
background-color: #cccccc;
color: #666666;
}
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]