Skip to content

Instantly share code, notes, and snippets.

View konradsroka's full-sized avatar
🙃
...mostly not on github anymore!

Konrad Sroka konradsroka

🙃
...mostly not on github anymore!
View GitHub Profile
@konradsroka
konradsroka / wp_customizer_frontend_css.php
Last active December 21, 2015 15:19
A small class to help building the FrontEnd CSS from the WP Customizer Options. Better Readability. Lean CSS. No more PHP Noodles in your styles!
<?php
/**
* This small PHP class provides you some functions to build the frontend CSS from the WP Customizer Options.
*
* == Fight the PHP Noodles in your CSS! ==
* As the resulting dynamic CSS of themes can look ugly,
* we thought about a sweet and short solution for this.
*
* == Better Readabilty ==
@konradsroka
konradsroka / wp_customizer_frontend_css_examples.php
Last active December 21, 2015 15:19
Some Examples how to use the WP Customizer FrontEnd CSS Class https://gist.github.com/konradsroka/6325980
<?php
// Some Examples
// The following examples show how you can use the CC_Customizer class to generate the CSS for the frontend.
// First create a new Customizer_Frontend_CSS object.
$cc_customizer = new Customizer_Frontend_CSS();
// Now we can start defining the styles we need for the frontend,
// based on the saved option values in the WP Customizer.
@konradsroka
konradsroka / cc_add_above_content
Created January 8, 2014 17:22
For Custom Community Theme versions 1.x // Adding some content at the place where the slideshow container sits usually.. // in this example we call the slideshow from the nice plugin "SlideDeck 2" from wordpress.org
// this is the action hook to add stuff above the content..
add_action( 'bp_after_header', 'cc_add_above_content' );
// this is the function to add stuff above the content..
function cc_add_above_content() {
// first, add a wrapper around.
echo '<div style="margin: 10px 0;">';
@konradsroka
konradsroka / ks-custom-login.js
Created January 20, 2015 08:30
Add Placeholders To WordPress Login Form And Remove Labels
// ----------------------------------------------------
// Adding the placeholders in textfields of login form
// ----------------------------------------------------
jQuery(document).ready(function($) {
$('#loginform input[type="text"]').attr('placeholder', 'Username');
$('#loginform input[type="password"]').attr('placeholder', 'Password');
@konradsroka
konradsroka / mycred-points-on-signup
Last active August 29, 2015 14:15
Fixup for myCred points on registration if you use BuddyPress but the standard WP signup form
// tell myCRED to ignore waiting for a user to confirm their signup via BuddyPress
// cheers to @gabrielmerovingi for this neat 1-line-solution
add_filter( 'bp_core_signup_send_activation_key', '__return_false' );
@konradsroka
konradsroka / mycred-on-dwqa-comments
Last active March 5, 2018 04:58
WordPress Plugins DWQA and myCred: Adding myCred points when comment on DWQA Question or Answer is added
// Note: Sadly you need to make one hack into the DWQA plugin as they didn't want to add a new do_action at this place.
// I was a bit disappointed with that answer, however you need to add the do_action into the DWQA plugin yourself.. :-/
// HOW TO MAKE THIS WORK:
// First add this whole PHP chunk to your theme's functions.php or into your custom plugin.
// Then copy this: do_action( 'kx_dwqa_add_comment' );
// Go to file dw-question-answer/inc/actions.php to the function dwqa_comment_action_add()
// and paste it right after the ob_end_clean(); - in the next line.
// That's it, save and test ;)
<?php
// display member list filtered by profile fields
function member_list_by_profile_fields( $atts ) {
global $bp, $wpdb;
$atts = shortcode_atts( array(
'id' => '1',
'YOURFIELDNAME' => 'default-value' // this can be just a number! check in bp profile field settings with inspector tool ;)
), $atts, 'member_list_by_profile_fields' );
@konradsroka
konradsroka / sale-flash.php
Last active June 13, 2017 02:54
WooCommerce Sale Flash - display discounted $ amount per product (works with variations too)
<?php
/**
* WooCommerce Sale Flash
* Display money saved on a product, or the discount percentage
* Add this file to your theme folder to /woocommerce/loop and into /woocommerce/single (if wanted there too)
* Konrad Sroka - http://konradsroka.com
*
*/
if ( ! defined( 'ABSPATH' ) ) exit;