In WordPress Recent Posts Widget , only show posts tagged with the current page url

/******* filter posts by tag based on page url ***********/ add_filter(‘widget_posts_args’, ‘wpsites_modify_recent_posts_widget’, 100000); function wpsites_modify_recent_posts_widget($params) { $url = sanitize_text_field($_SERVER[‘REQUEST_URI’]); $last_word = basename($url); error_log(“last word = $last_word”); $tags_filter_by = array(‘who’,’what’,’when’,’where’,’why’,’how’); // only do for these pages if(in_array($last_word, $tags_filter_by) ){ //$params[‘tag’] = ‘bread,baking’; posts with any of these tags $params[‘tag’] = trim(strtolower($last_word)); error_log(“filtering to only show posts … Read more

Buddypress hide the top level tabs from users ( e.g. hide the group tab)

This is to hide the top level tabs from users. Based on this code from the buddypress forums. define( ‘BP_DEFAULT_COMPONENT’,’profile’ ); // this shows something if no tabs (otherwise 404) function bpfr_hide_tabs() { if ( bp_is_user() && !is_super_admin() ) { /* and here we remove our stuff ! */ //bp_core_remove_nav_item( ‘activity’ ); //bp_core_remove_nav_item( ‘friends’ ); … Read more

WordPress on Windows IIS permissions error – uploaded file could not be moved to wp-content/uploads

Recently I’ve been developing a WordPress Intranet for a company that runs on Windows hosting ( IIS 6 – Internet Information Services ). I ran into a problem with file permissions and not being able to write to the wp-content/uploads directory, I’ve ran into the same problem with unix many times (which alittle bit of recursive … Read more

Installing ChromeDriver for WebDriver – For the Techies (Java)

If your using Webdriver to automate your web testing you’ll already know what a great tool it is. This is a quick note on installing ChromeDriver for WebDriver (to test using the Chrome Browser). 1. get the latest version of chrome driver from this url http://chromedriver.storage.googleapis.com/index.html 2. unzip this and place it whenever you want 3. … Read more

Java Generics (2008)

Notes on SCJP I did in 2008 Generics   Straight forward Type Safe Collections   List<Animal> myList = new ArrayList<Animal>();   the generic type in the declaration must match on both side of = , in this case <String> (unless a wildcard is used to the left of the equals OR the ref has no gen … Read more