Updates from September, 2010 Toggle Comment Threads | Keyboard Shortcuts

  • Mohammad Jangda 1:17 pm on December 27, 2011 Permalink | Reply  

    Co-Authors Plus v2.6: Search user’s display names, change byline order and more | danielbachhuber.

    Thanks to Daniel, Co-Authors Plus, which I’ve long neglected, finally has an update with some long-overdue bug fixes and some sweet new features.

     
  • Mohammad Jangda 3:30 pm on November 23, 2011 Permalink | Reply
    Tags: , wpdb, wpdb-prepare   

    On $wpdb->prepare 

    If you do the following, you’re a terrible person:

    $query = "SELECT ID from {$wpdb->posts} WHERE ID = %d";
    $query = $wpdb->prepare( $query, $value );
    

    There is absolutely no reason for prepare to be on a separate line.

    Here’s how you do it the right way:

    $query = $wpdb->prepare( "SELECT ID from {$wpdb->posts} WHERE ID = %d", $value );
    

    One line. Simple, easy to read, and not confusing.

     
    • Mohammad Jangda 3:31 pm on November 23, 2011 Permalink | Reply

      And, yes, the query in the example makes no sense.

    • Lloyd Budd 7:19 pm on November 23, 2011 Permalink | Reply

      You know how they come to that anti-pattern though, right? They want to isolate the query, so that if it was more easily cowboy coded — add and remove print and debug.

      Wonder if prepare() having a debug/echo parameter would be useful, or too abstract… aside, does WP still not have as good of debug infrastructure as bbPress?

      • Mohammad Jangda 10:48 am on November 24, 2011 Permalink | Reply

        The problem is that prepare doesn’t do much other than sprintf the query with the values passed in. Developers can still do something like:

        $query = $wpdb->prepare( "SELECT ID from {$wpdb->posts} WHERE ID = %d", $value );
        error_log( 'Woo! I'm querying IDs! My query: ' . $query );
        $id = $wpdb->get_col( $query );
        

        Which is why this anti-pattern baffles me…

  • Mohammad Jangda 1:21 pm on August 4, 2011 Permalink | Reply
    Tags: distraction-free writing, matrix, terminal,   

    WordPress Distraction-Free Skin: Terminal/Matrix 

    Just Write! Like you're in the Matrix!

    Because all the cool kids want to feel like they’re writing posts in the Matrix. (Inspired by Zen)

    http://wordpress.org/extend/plugins/zen
     * License: GPL v2 Baby!
     */
    add_action( 'admin_print_styles-post.php', 'dfw_terminal_style' );
    add_action( 'admin_print_styles-post-new.php', 'dfw_terminal_style' );
    
    function dfw_terminal_style() {
            ?>
    
    
            
    

    View on Github

     
    • Joen 2:15 pm on August 4, 2011 Permalink | Reply

      This reaches a weird equilibrium between terrible and awesome. Kinda like the movie Time Cop.

      • Mohammad Jangda 2:23 pm on August 4, 2011 Permalink | Reply

        Time Cop was an incredible movie.

        • Joen 2:24 pm on August 4, 2011 Permalink | Reply

          So good! Especially that part where he does the split!

          I think Mia Sara peaked in that film.

  • Mohammad Jangda 4:17 pm on March 17, 2011 Permalink | Reply
    Tags: community, love,   

    We are all WordPress 

    We all use it, we love it, and we want to learn it, teach others, and help WordPress become even better.

    We are all WordPress.

    Jackie Dana

     
  • Mohammad Jangda 6:38 pm on November 16, 2010 Permalink | Reply
    Tags: cron, cronjob, dogfooding, git, remote repos, svn   

    Dogfooding Edit Flow 

    Note: Most of the code here is specific to my environment on Webfaction, github and for use with WordPress plugins. You can make it work for other setups (i.e. different hosts, local gits, or even SVN) but will involve some tweaking.


    Scott recently had a great idea to run the bleeding edge release of Edit Flow on our official site. I usually do this for most of my plugins before releasing, though, it’s a manual process: FTP up the latest code and give it a test run. That’s not fun.

    Here’s a far better, automatized way to keep your repo up-to-date. You can either use cron or githooks. Pick your poison.

    (More …)

     
  • Mohammad Jangda 1:01 pm on October 22, 2010 Permalink | Reply
    Tags: plugin notes   

    Plugin Update: Plugin Notes v1.1 

    I pushed out an update to Plugin Notes last week bumping up the version number to 1.1. Only three changes in this update:

    Paradoxical HTML Notes

    • Ability to add select HTML tags to notes, so you can now do cool stuff like the image above. Full list of allowed tags available here. (Thanks to Dave A. for the suggestion)
    • Fixed a bunch of PHP Error Notices that were popping up across the plugin (thanks to WP_DEBUG)
    • A small styling fix

    Enjoy.

     
  • Mohammad Jangda 3:00 pm on October 15, 2010 Permalink | Reply
    Tags: , , update,   

    Plugin Update: Zen v1.1 

    I pushed up v1.1 of Zen yesterday. Not much changed in this new version. Key improvement is that the content textarea is now a bit bigger so things don’t look really disproportionate on larger resolutions.

    I’ve also added 3 new themes:

    Zen Sea & Sky

    Zen Sea & Sky

    Zen Sunset

    Zen Sunset

    Zen Foiled Again

    Zen Foiled Again (My new favourite)

    Enjoy!

     
  • Mohammad Jangda 9:23 pm on September 13, 2010 Permalink | Reply
    Tags: ajax, callbacks, ,   

    WordPress Tip: Hooking into Widget Save Callback 

    John Gadbois turned some code I gave him into short and useful write-up on how to hook into AJAX calls triggered when saving widgets. It makes use of jQuery’s Global AJAX event handlers, which allow for some very cool things, especially when you’re working with external libraries that use the jQuery AJAX methods. A future blog post will cover how plugins can use the ajaxSend event to hook into WordPress’ autosave.

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel