Simple post counter

Someone in our WPSerbia FB Page asked about different styles for first post in the loop, so this is the snippet for that.   <?php if (have_posts()) : $counter = 1; while (have_posts()) : the_post(); if( $counter == 1 ) { ?> /* First post */ <? } elseif( $counter == 2 ) { ?> /* …

Simple post counter Read More »

Automatically ban “admin” user

If you are using iThemes Security (and I do recommend using it), make sure you go to Settings and under Brute Force Protection have “Immediately ban a host that attempts to login using the “admin” username.” checked.   PS: And if YOU get locked out on your “admin” account, who knows why is that good, right? :)

Gravity forms, 18 years old verification

MM-DD-YYYY // this code will run for form 4 only; change 4 to your form ID add_filter(‘gform_validation_4’, ‘verify_minimum_age’); function verify_minimum_age($validation_result){ // retrieve the $form $form = $validation_result[‘form’]; // date of birth is submitted in field 7 in the format YYYY-MM-DD // change the 7 here to your field ID $dob = rgpost(‘input_7’); // this the …

Gravity forms, 18 years old verification Read More »

Twitter Bootstrap Drop-down on hover

Twitter Boostrap 3, drop-down menu on hover.   .dropdown-menu { .sub-menu { left: 100%; position: absolute; top: 0; visibility: hidden; margin-top: -1px; } li:hover .sub-menu { visibility: visible; } } .dropdown:hover .dropdown-menu { display: block; } .nav-tabs .dropdown-menu, .nav-pills .dropdown-menu, .navbar .dropdown-menu { margin-top: 0; } .navbar { .sub-menu:before { border-bottom: 7px solid transparent; border-left: …

Twitter Bootstrap Drop-down on hover Read More »

BuddyPress autologin on activation

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 /* Check for an uploaded avatar and move that to the correct user folder, just do what bp does */ if ( is_multisite() ) $hashed_key = wp_hash( $key ); else $hashed_key = wp_hash( $user_id ); /* Check …

BuddyPress autologin on activation Read More »

You May Also Like, filter snippet

“You May Also Like”, code snippet for displaying list of posts from the same category on page: add_filter( ‘the_content’, function() { $id = get_the_id(); if ( !is_singular( ‘post’ ) ) { return $content; } $terms = get_the_terms( $id, ‘category’ ); $cats = array(); foreach ($terms as $term) { $cats[] = $term->cat_ID; } $loop = new …

You May Also Like, filter snippet Read More »

Select And Copy Text Right In Quicklook

First launch Terminal app, and paste or type in the following command: defaults write QLEnableTextSelection -boolean YES;   Then restart the finder with the following command: killall Finder   Source:  

Scroll to Top