WordPress Mode - WordPress syntax mode for Coda

This add-in for Coda adds a Syntax Mode for the WordPress Blog CMS.

Features:

  • Autocompletion for WordPress functions and template tags.
  • Adds “The Loop” to the Code Navigator.

Requirements:

  • Tested on Coda 1.6.4, should work on previous versions.

Installation:

  1. Download the tgz file and unpack.
  2. Move the “WordPress.mode” folder into the Modes folder for Coda. (~/Library/Application Support/Coda/Modes/)
  3. Open up your WordPress template file in Coda and use the mode by going to “Text -> Syntax Mode -> WordPress” in the toolbar.
  4. (Optional) If you want to set this Mode as the default handler for PHP files, go to the Editor pane in the Preferences window and add a Custom Syntax Mode that maps the .php extension to the WordPress mode.

  • Just downloaded this mode.. for Coda 1.6.10. Once installed the autocomplete is working however the loop is not should in the code navigator. Any ideas what it could be ?
  • I haven't been able to test the mode on 1.6.10 so I can only guess for now. Would you mind posting the code for your loop here? It might be that the regular expression that identifies the loop just doesn't match what you're using.
  • I am not sure it is related to one the loops on this one page, as the code navigator is not showing the loops on any of my wordpress php pages. However here is an example loop
    <?php $recent = new WP_Query("tag=editor_letter&showposts=1"); while($recent->have_posts()) : $recent->the_post();?>

    Editor's Letter


    <div class="block">
    <?php the_content();?>
    </div>
    <?php endwhile; ?>
    <?php wp_reset_query(); ?>
  • Ok yeah so the code navigator can only find sections using regular expressions and the one I have only matches The Loop in the standard format like:

    if (have_posts()): while (have_posts()): the_post();

    And you can have any whitespace in between. Since yours include the $recent-> variable it wouldn't match. I'll see if I can add this to the detection though for the next version though when Coda 2.0 comes out!
  • ok thanks... looking forward to Coda 2.0 + your syntax mode!! and thanks for the prompt response.
  • darionovoa
    No download link is it broken?
  • Just switched the blog to another server and I'm having some issues with the PHP short tags getting echoed out. Should be fixed by tomorrow!
  • Thanks for the information and for the steps of installation. Nice blog.
  • A-W-E-S-OM-E

    Thanks for putting this together, works really well and now when I instinctively try to allow my wp functions to autocomplete, it actually does. :-)
  • Jason
    I have tried several times to add this .mode to Coda 1.6.7 and it isn't showing up in the Syntax Mode menu.

    I followed the instructions to a T, then tried a few different things (dragging it to Coda, double clicking it, etc).

    I can see the contents using the "Show Package Contents" in the right click contextual menu and verify the .mode files are not corrupt (and checked the md5).

    Any ideas?
  • Does the directory structure look like this?

    /Users/username/Library/Application Support/Coda/Modes/WordPress.mode/Contents/

    If it's not that, I don't know what could be causing the issue as I am using Coda 1.6.7 too and just dropping the mode in there like that works fine.
  • Jason
    I got it! When digging in via Terminal, I realized at some point I added on the extension .codaplugin. I don't remember when, but I removed it and it works now.

    Thanks for developing this Code Mode!
  • Jason
    I can not unpack the tgz file.

    Finder error:
    Unable to unarchive "WordPress.mode.tgz" into "Downloads".
    (Error 2 - No such file or directory)

    Terminal error:
    tar: This does not look like a tar archive
    tar: Skipping to next header
    tar: Error exit delayed from previous errors

    Do you have a md5 for the file so I can see if it is a download error?
  • MD5 Hash of the file is 3c0d2971fa870151e9859d31b8d8ed1e. Let me know if you figure out the problem, I can always make it available as a zip.
  • casey
    I have this error as well

    Unable to unarchive "WordPress.mode.tgz" into "Downloads".
    (Error 2 - No such file or directory)
  • I just changed the download to a zip file instead. MD5 hash of the new file is 956cae7cbfb4a918f35c559e12cd84df

    Give that a try and see how it works.
  • Jason
    Thanks Pradador. Works well now, but you forgot to edit the link in the right column from .tgz extension to .zip.

    I manually just changed the url to the file to .zip and I was able to download that way.
  • Damn WP-Cache... doesn't refresh when you update a sidebar widget. Thanks for the heads up.
  • Alvaro
    I get the same error!
  • Alvaro
    I get the same error!
  • human3rror
    this looks awesome!
  • Great!!! Thanks!
blog comments powered by Disqus