Skip to content

Instantly share code, notes, and snippets.

View lanche86's full-sized avatar

Milan Ivanovic lanche86

View GitHub Profile
<?php
// Version CSS file in a theme
wp_enqueue_style( 'theme-styles', get_stylesheet_directory_uri() . '/style.css', array(), filemtime( get_stylesheet_directory() . '/style.css' ) );
// Version JS file in a theme
wp_enqueue_script( 'theme-scripts', get_stylesheet_directory_uri() . '/js/scripts.js', array(), filemtime( get_stylesheet_directory() . '/js/scripts.js' ) );
@lanche86
lanche86 / gist:8383123
Created January 12, 2014 10:48
Remove empty p tags from ACF
// ACF fix to remove <p></p>
remove_filter( 'acf_the_content', 'wpautop' );
@lanche86
lanche86 / force-admin-bar.php
Created January 3, 2014 23:39
Force the WordPress Admin Bar to display for all visitors. Even Logged Out Users can use the Admin Bar.
/*
* Force the WordPress Admin Bar to display for all visitors
*/
add_filter( 'show_admin_bar', '__return_true' );
@lanche86
lanche86 / international_date_formats.php
Created December 7, 2013 22:03
International date formats by allowing the users to set their own date formats in Settings / General
<?php the_time( get_option( 'date_format' ) ); ?>
@lanche86
lanche86 / BuddyPress autologin on activation
Last active December 29, 2015 09:18
Automatically logs in the user and redirects them to their profile when they activate their account.
<?php
add_action( "bp_core_activated_user", "bp_autologin_on_activation", 40, 3 );
function bp_autologin_on_activation( $user_id, $key, $user) {
global $bp, $wpdb;
//simulate Bp activation
@lanche86
lanche86 / ownfilters.txt
Created September 16, 2013 08:53
Adblock Plus Options, own filters
apkmania.co##div#sidebar
blic.rs##*.swf
blic.rs##a.brand_left
blic.rs##a.brand_right
blic.rs##a.slg
blic.rs##div#buzzBox
blic.rs##div#dw_feed
blic.rs##div#footer
blic.rs##div#home_tabz
@lanche86
lanche86 / index.php
Created August 27, 2013 07:10
Remove quick edit for custom post type
// remove quick edit for custom post type
// not needed if Title is removed
add_filter( 'post_row_actions', 'remove_row_actions', 10, 2 );
function remove_row_actions( $unset_actions, $post ) {
global $current_screen;
if ( $current_screen->post_type != 'custom_redirect' ) return $unset_actions;
unset( $unset_actions['edit'] );
@lanche86
lanche86 / index.php
Created August 12, 2013 19:24
Automatically Remove Links from WordPress Images
// Automatically Remove Links from WordPress Images
add_filter( 'the_content', 'attachment_image_link_remove_filter' );
function attachment_image_link_remove_filter( $content ) {
$content = preg_replace( array( '{<a(.*?)(wp-att|wp-content/uploads)[^>]*><img}', '{ wp-image-[0-9]*" /></a>}' ),
array( '<img','" />' ), $content );
return $content;
}
@lanche86
lanche86 / index.html
Created August 11, 2013 20:11
Absolute Horizontal And Vertical Centering In CSS
<div>
I am Horizontal and Vertical centered only by CSS!
</div>
@lanche86
lanche86 / index.html
Created June 13, 2013 20:30
A CodePen by tomasz stryjewski. pure css fancy radio group
<form>
<fieldset class="radioset">
<ul>
<li><input type="radio" name="radio[]" id="radio1" checked><label for="radio1">foo</label>
<li><input type="radio" name="radio[]" id="radio2"><label for="radio2">bar</label>
<li><input type="radio" name="radio[]" id="radio3"><label for="radio3">baz</label>
<li><input type="radio" name="radio[]" id="radio4"><label for="radio4">qux</label>
</ul>
</fieldset>
</form>