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 / .htaccess
Created May 7, 2018 12:11
Force SSL .htaccess
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@pixelbart
pixelbart / magic.txt
Created April 20, 2018 00:36
Remove Jetpack Website Stats
your-domain.de/wp-admin/admin.php?page=jetpack_modules
@pixelbart
pixelbart / after-load.js
Last active April 17, 2018 21:42
load scripts after ajax load
var data = {};
data['test'] = 'test';
var response = $.ajax({
url : ajax_url,
data : data
});
response.always(function() {
$.getScript('file.js');
@pixelbart
pixelbart / replace.sql
Last active August 19, 2017 14:33
replace http to https (mysql) wordpress
UPDATE `wp_posts` SET post_content = REPLACE(post_content, 'https://', 'http://') WHERE post_content LIKE '%http://%';
UPDATE `wp_postmeta` SET `meta_value` = REPLACE(meta_value, 'https://', 'http://') WHERE meta_value LIKE '%http://%';
UPDATE `wp_options` SET `option_value` = REPLACE(option_value, 'https://', 'http://') WHERE option_value LIKE '%http://%';
@pixelbart
pixelbart / simple-color-picker.html
Created April 19, 2017 10:36
A simple color picker for/with html and jquery
<label class="kevin-color">
<input type="text" name="kevin_color" value="" />
<input type="color" name="kevin_color" value="" />
</label>
<script>
jQuery('.kevin-color input[type="color"]').on( 'change', function() {
var ValColor = jQuery(this).val();
jQuery('.kevin-color').find('input[type="text"]').val(ValColor);
});
@pixelbart
pixelbart / categories.php
Created March 30, 2017 14:06
WordPress Widget to show posts, posts_type from category or exclude an category for an limited time, or all... crazy.
<?php
/**
* Simple Addon to showing posts by category in sidebars
*/
// Creating the widget
class jl_categories extends WP_Widget
{
function __construct()
@pixelbart
pixelbart / wordpress-org-api.php
Created February 15, 2017 10:29
Use wordpress.org API (plugins & themes) with PHP curl
<?php
/**
* WordPress.org Plugin API
*/
// Plugin Slug
$slug = 'simple-marketplace-affiliate';
$args = (object) array( 'slug' => $slug );
$fields = array( 'action' => 'plugin_information', 'timeout' => 15, 'request' => serialize( $args ) );
@pixelbart
pixelbart / post_formats.php
Created February 3, 2017 12:51
Post formats example
<?php
// functions.php
add_theme_support( 'post-formats', array( 'video', 'gallery' ) );
// single.php
// Innerhalb des WordPress Loops
if( get_post_format() == 'video' ) :
@pixelbart
pixelbart / functions.php
Created January 10, 2017 11:41
Add this in your functions.php and optimize some simple things
<?php
/**
* WordPress Optimizing
*/
// Remove Query String from Static Resources
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
@pixelbart
pixelbart / magic.js
Created November 30, 2016 13:24
Change text color based on background color
$(document).ready(function() {
var base = 'div'; // Change it to your element
$(base).each(function() {
var target = $(this);
var bgcolor = target.css('background-color');
var rgb = bgcolor.replace('rgb(', '').replace(')', '').split(',');