Alternate Title – WordPress

By Lew Ayotte  |  July 9th, 2009  |  Published in Development, WordPress  |  2 Comments

We’ve been working on a site where the client wanted the page title to be different on the front end and the back end. They want a longer more descriptive title on the back end. On the front end, they wanted to customize the title for their customers to see. Basically something small and simple.

Immediately I knew that using WordPress Custom Tags would work perfectly for this. So we went with the meta-tag “alt_title” for their alternate titles. On my first attempt I edited the relevant .php theme files to do this for the title:

<?php
if ($p = get_post_meta($post->ID, "alt_title", true)) {
	$title = $p;
} else {
	$title = get_the_title($post->ID);
} 
?>
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title='Click to read: "<?php echo $title; ?>"'>
<?php echo $title; ?></a></h2>

However, that wasn’t quite good enough. They also wanted to be able to make an alternate name for page titles in a navigation. In their current navigation, using wp_list_pages, it was displaying the actual page title, not the alternate title. This took a little extra work, but finally, with a pretty simple piece of code. I added this function to the functions.php in their theme.


function the_alt_title($title= '') {
	$page = get_page_by_title($title);

	if ($p = get_post_meta($page->ID, "alt_title", true)) {
		$title = $p;
  	}

	return $title;
}

Now, all I need to do is apply this function to the the_title filter, with:

add_filter('the_title', 'the_alt_title', 10, 1);

But, if you remember, they want to see the original titles on the backend, so I actually needed to write it like this:

if (!is_admin()) {
	add_filter('the_title', 'the_alt_title', 10, 1);
}

I don’t know if there is much need for this functionality, but this could easily be turned into a WordPress plugin. There is still a little more work that would need to be done. But it works for our client’s needs.

As always, your questions and comments are welcome.

Twitter Post

By Lew Ayotte  |  July 4th, 2009  |  Published in Uncategorized  |  103 Comments

With Twitter Post every author of your blog can have their own Twitter information stored under the User’s section. Whenever they post to your blog it will automatically tweet a message to the admin twitter accoutn as well as their own twitter account. The admin can also choose to send a tweet to all authors twitter accounts whenever anyone publishes a post.

With Twitter Post you can…
choose which categories are included or excluded
exclude individal posts from being tweeted before you publish them
retweet a published post*
choose to tweet to all authors
customize the tweet format, including the post title and post URL (using the custom tags %TITLE% and %URL%, respectively)**

Currently Twitter Post supports two URL shortening services. TinyURL is the default shortener, Twitter Post will attempt to get permalink of your post shortened by TinyURL. If it is unable to, it will use the regular site URL. The other shortener you can use is a WordPress plugin called Twitter Friendly Links. If Twitter Friendly Links is installed and activated on your website then Twitter Post will use it as the default shortener.

* Twitter no longer allows the ability to tweet the same exact message more than once. This is an attempt to reduce SPAM in their system. I am not trying to encourage SPAM with the ReTweet feature, but I felt like it was an important feature to include. Because of the limitation imposed by Twitter, I had to add a random element to each ReTweet. Currently a random digit between 10 and 99 will be appended to a ReTweet. Also, you will only see the ReTweet option for published posts.

** Twitter allows a maximum of 140 characters per tweet. If your custom format is too long to accommodate %TITLE% and/or %URL% then this plugin will cut off your title to fit and/or remove the URL. URL is given preference (since it’s either all or nothing). So if your TITLE ends up making your Tweet go over the 140 characters, it will take a substring of your title (plus some ellipsis).

Download

Latest Version (Tested on WordPress 2.9.1 but should work on 2.6 and up)

ChangeLog
1.5.5

  • Fixed exclude post issue.

1.5.4

  • Removed link to survey.

v1.5.3

v1.5.2

  • Fixed bug introduced in WordPress 3.0 with publishing pages

v1.5.1

  • Fixed case sensitivity issue in tweet format
  • Added ability to ReTweet a published post
  • Removed and cleaned up some code
  • Cleaned up some validation techniques for test tweet feature

v1.5.0

  • Added ability to send a test tweet to Twitter (to verify everything is working); this bumps the support up to start at WP2.8 but will allow me to add a “re”-tweet feature in a later version.
  • Made some efficiency fixes
  • Made some styling changes to match current WordPress styling
  • Setup partial error reporting (as part of the test tweet) which I will extend into a debugging feature in a later version

v1.4.1

  • Fixed issue with not stripping slashes properly from default tweet format option
  • Removed unneeded option code for efficiency
  • Updated str_ireplace function for better PHP4 compatibility

v1.4.0

  • Discovered WP_Http class (since WP2.7) which makes life much easier for everyone, but this bumps the support up to start at WP2.7)
  • Removed cURL requirement, switched to WP_Http API
  • Removed Twitter API Classes, switched to WP_Http API
  • Changes in cURL requirement required modification of init() function

v1.3.5

  • Moved URL shortening functionality for improved efficiency

v1.3.4

  • Moved exclusion check for efficiency
  • Fixed bug in scheduled posts, if a secondary account schedules a post and logs out, it would not have tweeted the message

v1.3.3

  • Had a typo when checking the PHP Version for PHP5 functionality

v1.3.2

  • Fixed bug that prevented TwitterPost from tweeting when setting a custom tweet on a Post page

v1.3.1

  • Fixed bug with category exclusion logic… accidentally brought it back in with version 1.3.0

v1.3.0

  • Cleaned up and remove 139 lines of code
  • Fixed second bug with category exclusion logic

v1.2.2

v1.2.1

  • Fixed PHP cURL Requirement Error Message
  • Added PHP cURL Requirement skip if Twitter Friendly Links is already installed.
  • Added ability for WP Admin to set Twitter Post to tweet from all Author accounts whenever a post is published.

v1.2.0

  • Changed default tweet from “Blogged %TITLE%: – %URL%” to “Blogged %TITLE%: %URL%”.
  • Added check to make sure PHP Curl is installed.
  • Fixed bug that caused Twitter Post to tweet when adding new page.
  • Added ability to specify which categories to include/exclude in tweet.
  • Added ability to exclude a post before publishing it.
  • Added support for using Twitter Friendly Links instead of TinyURL links when TFL plugin is activated.
  • Added support for multiple author twitter accounts and default twitter account.

v1.1.1

  • Fixed support URLs

v1.1.0

  • Fixed Default Tweet typo (“blogged” instead of “bloggged”).
  • No longer publishes to twitter when you update/edit an old post.
  • Added feature to customize tweet per post using Custom Fields.
  • Changed project URL to http://fullthrottledevelopment.com/ – my new business venture.

v1.0.0 – Initial release

  • Allows custom tweet formatting with %TITLE% and %URL% tags.

Installation

  1. Upload `rf-twitterpost` directory to the `/wp-content/plugins/` directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Update Twitter Post Options with your twitter username, password, and the tweet format.
  4. Next time you publish a new post it will update twitter.

Possible Future Features

  • Ability to add post excerpt to tweet.
  • Possibly switch to Twitter’s OAuth API.
  • And as always, we listen to your requests…

Matt Mullenweg – Keynote – WordCamp RDU

By Lew Ayotte  |  June 24th, 2009  |  Published in Blogging, Conferences  |  0 Comments

This is the video of Matt Mullenweg’s Keynote at WordCamp RDU. Unfortunately Matt forgot to wear the lapel mic that I gave him, so I had to rip the audio from Wayne Sutton’s (@WayneSutton) UStream video (http://www.ustream.tv/recorded/1651759) – thanks Wayne! It is pretty well synced up, and there are a couple minutes at the front and near the end where the audio is muted for some reason. But otherwise, it’s all good. Enjoy.

Alan Knox – WordPress in Corporate and Educational Environments – WordCamp RDU

By Lew Ayotte  |  June 23rd, 2009  |  Published in Blogging, Conferences  |  0 Comments

Download Alan’s Slideshow in PDF format: Implementing WordPress in Corporate and Educational Environments

Alan can be reached on Twitter via @alan_knox

Also watch: WordPress as a Factory (plugin development)

Glenn Ansley – WordPress as a Factory – WordCamp RDU

By Lew Ayotte  |  June 22nd, 2009  |  Published in Conferences, Video  |  0 Comments

Download Glenn’s Slideshow in PDF format: WordPress as a Factory

Glenn can be reached on Twitter via @glennansley

Also watch: Using WordPress in Corporate and Educational Environments

FullThrottle Development at WordCampRDU 2009

By Alan Knox  |  June 12th, 2009  |  Published in Blogging, Conferences, News  |  0 Comments

FullThrottle Development is excited to take part in WordCampRDU 2009 on Saturday, June 13, 2009. WordCampRDU will be held at the School of Education at North Carolina Central University in Durham, NC from 9:00 a.m. until 6:00 p.m. (For a complete schedule, click here.)

FullThrottle Development is participating in WordCampRDU 2009 is several ways. First, we are one of the Gold Sponsors of the event. Second, three of our developers are speaking during the event (see below for more information). Finally, we will be taking part in the “Q&A” in the “genius lounge”.

The following representatives of FullThrottle Development will be speaking during WordCampRDU 2009:

  • Glenn Ansley will speak on the topic “WordPress as a Factory: The Fundamentals of Plug-in Development” at 10:15 a.m.
  • Lew Ayotte will speak on the topic “WordPress Mu: Installation, Plug-in Management, and Features” at 3:00 p.m.
  • Alan Knox will speak on the topic “Implementing WordPress in Corporate & Educational Environments” at 5:00 p.m.

(We plan to record our sessions and post the videos and slide shows here.)

Other representatives of FullThrottle Development will be attending WordCampRDU sessions, meeting people, volunteering, and answering questions.

Also, we will live blog as much of WordCampRDU as possible.

Finally, don’t miss our BIG ANNOUNCEMENT at 11:45 a.m.

We hope to see you at WordCampRDU!

Creating Dependent WordPress Plugins

By Glenn Ansley  |  June 11th, 2009  |  Published in Uncategorized  |  8 Comments

This script was generated in response to a thread on the wp-hackers mailing list.

The question at hand is how to make one plugin dependant on another plugin’s installation and activation while maintaining the use of the register_activation_hook() function.

The following code is a proof of concept. It can be improved and will be improved after I get through with WordCampRDU this weekend. I slapped it out while on a 2 1/2 hour phone call with a client and only had time to confirm it works and post it here.

How to use this proof of concept:

  1. Copy the code below and paste it into the top of “Hello Dolly”
  2. Try to activate “Hello Dolly” without “Akismet” activated.
  3. Activate “Akismet” and try to activate “Hello Dolly”
  4. Deactivate “Akismet” and confirm that “Hello Dolly” has been deactivated

Still To Do:

  1. Investigate the active plugins option to see if I can prevent hardcoding the plugin’s file location
  2. Enable a way to notify the admin that a dependent plugin has been deactivated at the same time the required plugin was deactivated.
  3. Copy the WordPress Core’s implementation of deactivating a plugin to allow for multiple dependencies and to take advantage of existing action hooks.

The Code: ( a modified hello.php )

Recent Sites 2

By Lew Ayotte  |  June 9th, 2009  |  Published in Uncategorized  |  0 Comments

Danielle Brown – Testimony

By Glenn Ansley  |  May 30th, 2009  |  Published in Uncategorized  |  0 Comments

Working with FullThrottle Development has been an absolute pleasure. This is by far the best development experience I’ve ever had. Delivery time and quality are 100% top-notch. In fact, it’s above and beyond what I could have ever expected. I highly recommend them and will continue to use them for all of my projects.

Recent Sites 1

By Glenn Ansley  |  May 29th, 2009  |  Published in Uncategorized  |  0 Comments