Skip to content

Instantly share code, notes, and snippets.

View pixelbart's full-sized avatar
🫥
Hidden

Kevin Pliester pixelbart

🫥
Hidden
View GitHub Profile
@pixelbart
pixelbart / PixelbartFinder.class.php
Created January 19, 2020 19:07
A class for searching files and folders, also recursively.
<?php
/**
* A class for searching files and folders, also recursively.
*
* @package Pixelbart Gists
* @author Pixelbart
*/
class PixelbartFinder {
/**
@pixelbart
pixelbart / functions.php
Created December 21, 2019 17:47
Helpful: Get all pro posts order by pro count
<?php
/**
* Shortcode for displaying all posts with pro, order by pro count
*/
function helpful_pro_shortcode() {
global $wpdb;
$table_name = $wpdb->prefix . 'helpful';
@pixelbart
pixelbart / is_ie.php
Created December 3, 2019 16:44
Prüft ob der aktuelle Browser der Internet Explorer ist.
/**
* Prüft ob der aktuelle Browser der Internet Explorer ist.
*
* @return boolean
*/
function is_ie() {
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
$ua = htmlentities( $_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8' );
if ( preg_match( '~MSIE|Internet Explorer~i', $ua ) || ( strpos( $ua, 'Trident/7.0' ) !== false && strpos( $ua, 'rv:11.0' ) !== false ) ) {
return true;
@pixelbart
pixelbart / helpful-example.css
Created November 18, 2019 20:19
WordPress Plugin Helpful Example CSS
/* Helpful */
.helpful {}
/* Helpful: Users has already voted */
.helpful.helpful-exists {}
/**
* Headline
*/
@pixelbart
pixelbart / helpful-faq-example.php
Last active November 15, 2019 15:14
In this example you will learn how to add Helpful to an existing Post Type (here FAQ), including its own heading.
<?php
/**
* In this example you will learn how to add Helpful to an
* existing Post Type (here FAQ), including its own heading.
*
* @package Helpful Example
* @author Pixelbart
*/
$args = array(
@pixelbart
pixelbart / functions.php
Created August 30, 2019 14:40
Change the title tag of WordPress
<?php
/**
* Custom title tag in WordPress
*
* @author Kevin Pliester
*/
/**
* Set custom title
*
@pixelbart
pixelbart / contact-form.php
Last active July 17, 2019 12:11
Einfaches WordPress Kontaktformular
<?php
/**
* @author Kevin Pliester <me@pixelbart.de>
*/
/**
* Der E-Mail-Empfänger.
*/
$email_receivers = [ 'meine@email.de' ];
@pixelbart
pixelbart / functions.php
Last active July 15, 2019 15:36
Related posts at the last position in the content.
<?php
/**
* Add related posts at the last position in the content.
* URL to Plugin: https://de.wordpress.org/plugins/wordpress-23-related-posts-plugin/
*
* @param string $content post content.
*
* @return string
*/
function my_related_posts( $content ) {
@pixelbart
pixelbart / class-custom-status.php
Last active May 7, 2019 13:16
Class for custom post status in WordPress
<?php
/**
* Class for custom post statuses
*/
class Custom_Status
{
protected $status, $labels, $post_type;
/**
* Set variables
@pixelbart
pixelbart / uk-lightbox.js
Created January 21, 2019 15:13
Uikit lightbox on wordpress block galleries
(function($) {
if( $('.wp-block-gallery, .wp-block-image').length ) {
$(ukLightboxGallery);
}
function ukLightboxGallery() {
$('.wp-block-gallery, .wp-block-image').attr('data-uk-lightbox', true);
$('figure').each(function() {
var src = $(this).find('img').attr('src');