NextGEN Excerpts

Posted in PHP, Wordpress on November 1st, 2011 by jonolan

Wordpress W/ Wrench - Tech and Tool Tips for WordPress.org sitesWordPress is a great blogging platform and overall CMS. Part of its utility comes from its in-built capability to display excerpts from posts and pages, which makes displaying search results and archives much more elegant.

This is, however, not without its flaws. One the most common problem with excerpts is WordPress that WordPress shortcodes don’t work in excerpts.

When one of the most commonly utilized plugins for WordPress is Alex Rabe’s NextGEN Gallery plugin, which heavily relies upon shortcodes, this is a problem.

Fortunately, WordPress’ Shortcode API has within it the capability of easily and quickly fixing this issue.

Below is the default PHP statement to display a post’s excerpt in WordPress:

< ? php the_excerpt(); ?>

The problem with the_excerpt() function is that it echoes the excerpt directly to the screen without interpretation. This causes the shortcode itself to display in the excerpt rather than the code it was calling.

In order to have NextGen Gallery entries appear in the post excerpts, simply replace that line wherever it occurs in your blog’s theme files with the following:

< ? php echo do_shortcode(get_the_excerpt()); ?>

The do_shortcode() function actually runs the shortcodes and returns their results as a string. Hence, it will allow your NextGEN Galleries – and anything other shortcodes – to display properly within post excerpts.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon] [Twitter]

Deleting Post Revisions

Posted in SQL, Wordpress on April 10th, 2011 by jonolan

WordPress W/ Wrench - Tech and Tool Tips for WordPress.org sitesWhenever you create or edit an article in WordPress, the software suit will save multiple revision copies of the article. This is a waste of server and database resources. Excessive or extraneous revision records will increase the burden on the underlying database.

This will increase loop iterations, data retrieval, and page loading time.

Periodic deletion of these post revision and all their associated metadata should be considered part of your normal maintenance routine. This can be accomplished with a simple SQL statement:

DELETE a,b,c FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision'

NOTE: Depending on exactly how WordPress was installed, the table names (wp_posts, wp_term_relationships, & wp_postmeta) may need to be modified to include the blog name, e.g., wp_yourblogposts.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon] [Twitter]

Bumping RDP Users

Posted in Windows on December 25th, 2009 by jonolan

Windows computer systems without Terminal Services licensing can only accept two (2) concurrent Remote Desktop (RDP). Sessions. This can occasionally cause Windows Administrators and Tech Support personnel problems since users often do not properly close their RDP sessions. This prevents the Admin or Support personnel from opening sessions of their own in order to work on issues.

There is actually a simple, if not widely publicized, fix for this problem.

If you’re using MSTSC version 5.x, installed by default on Windows XP, Windows Server 2003, and Windows Vista SP1 systems, enter the following from either RUN or CMD:


mstsc.exe /console

If you’re using MSTSC version 6.x, installed by default on Windows Server 2008, Windows Vista SP2, and Windows 7 systems and upgradeable to from Windows XP, enter the following from either RUN or CMD:


mstsc.exe /admin

In either situation using mstsc.exe with the appropriate switch – /console or /admin – will connect you to Session 0 on the remote system, bumping off another connection in order to do so if necessary. Then you can do whatever work that you need to do.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon] [Twitter]