Skip to content

Instantly share code, notes, and snippets.

@svenl77
svenl77 / menue order of groups and profiles
Created May 13, 2011 07:57
Add this functions in your functions.php in your template directory, to adjust the menue order of groups and profiles
// Change the Profile nav tab order
function change_profile_tab_order() {
global $bp;
$order = ''; // Add the component slugs coma separated in the order you like to have the nav menu tabs
$order = str_replace(' ','',$order);
$order = explode(",", $order);
$i = 1;
foreach($order as $item) {
@svenl77
svenl77 / Facebook Like Button
Last active September 25, 2015 19:08
Add Facebook Like button to Wordpress posts, pages and Buddypress
<?php
// Just copy this function into your functions.php and call facebook_like() where ever you want.
// If you want to use it in page and posts or text widgets as shortcode, write [facebook_like]
function facebook_like() {
echo get_facebook_like();
}
function get_facebook_like() {
$pageURL = 'http';
@svenl77
svenl77 / detect.php
Created September 10, 2011 15:22
This Class returns the currently viewed WordPress & BuddyPress page type
<?php
class TK_WP_Detect {
/**
* PHP 4 constructor
*
* @package Custom Community
* @since 1.8.3
*/
function tk_detect_page_type() {
$this->__construct();
@svenl77
svenl77 / bootstrap-wordpress-default-widgets
Created August 7, 2013 12:38
Add Bootstrap classes to WordPress core html elements - default widgets and comments. If you want to build a WordPress theme using twitter bootstrap, this will help you to add all needed classes to html witch comes from functions inside WordPress like widgets and comments.
// first set the body to hide and show everyhthing when fully loaded ;)
document.write("<style>body{display:none;}</style>");
jQuery(document).ready(function(){
jQuery( 'input.search-field' ).addClass( 'form-control' );
// here for each comment reply link of wordpress
jQuery( '.comment-reply-link' ).addClass( 'btn btn-primary' );
<?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 ==
<?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.
function tk_loop_designer_options($template_name){
global $list_post_atts;
$loop_designer_options = get_option('tk_loop_designer_options');
$template_options = $loop_designer_options['template_options'];
//$template_name = isset($template_options[$template_name]['loop_template_name']) ? sanitize_title($template_options[$template_name]['loop_template_name']) : '';
$show_img = isset($template_options[$template_name]['loop_template_image_show']) ? $template_options[$template_name]['loop_template_image_show'] : '';
$img_position = isset($template_options[$template_name]['loop_template_image_position']) ? $template_options[$template_name]['loop_template_image_position'] : '';
$clickable = isset($template_options[$template_name]['loop_template_entry_clickable']) ? $template_options[$template_name]['loop_template_entry_clickable'] :'';
@svenl77
svenl77 / BuddyForms WP-Posts-to-Posts --> Add Connection Parameter
Last active August 29, 2015 13:57
BuddyForms WP-Posts-to-Posts --> Add Connection ParameterExample function
add_filter('connection_types_args', 'add_connection_parameter', 99, 2);
function add_connection_parameter($args, $form_slug){
if($form_slug != 'Your BuddyForms Form Slug')
return $args;
$args = array_merge($args, array( 'title' => 'Your Title' ));
return $args;
}
/**
* Add the field to the checkout
**/
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
function my_custom_checkout_field( $checkout ) {
echo '<div id="my_custom_checkout_field"><h3>'.__('My Field').'</h3>';
/**
@svenl77
svenl77 / gist:dc73f3c0ba04b1f877d3
Last active August 29, 2015 14:05
bootstrap tabs
<div class="bs-example bs-example-tabs">
<ul id="myTab" class="nav nav-tabs" role="tablist">
<li class="active"><a href="#tab1" role="tab" data-toggle="tab">Tab1</a></li>
<li><a href="#tab2" role="tab" data-toggle="tab">Tab2</a></li>
<li><a href="#tab3" role="tab" data-toggle="tab">Tab3</a></li>
<li><a href="#tab4" role="tab" data-toggle="tab">Tab4</a></li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="tab1">
tab 1