I'm searching for a method to limit the quantity of figures displayed inside a heading using jquery. Basically the heading is retreived in the database however i only want the outcomes to show on a single type of a collection width so want to limit the output or abbreviate it to prevent the pictures below being pressed too much lower.

The next Live example should show exactly what I am talking about, scroll lower a little and you'll see images game titles which are two or three lines lengthy.

Hope someone might help!!!!

Serta, I am a bit unclear about what you are searching for, however it seems like you would like some code to truncate the smoothness period of a particular area. I observed that you simply labeled this PHP -- it'd most likely be superior to deal with it server-side. However, if you are set on using Jquery, there's most likely a good way to get it done.

The important thing factor to determine is, what pattern will you use to recognize the area tags inside the page (ie. what type of jquery selector are you going to email choose the tags you would like)? Once that's lower, javascript's .slice() function will achieve what you would like.

So here's a good example. In line with the page you linked, I am likely to say we're able to choose your area output by choosing any span tag that's an immediate child of the anchor tag that's an immediate child of a listing item.

$('li > a > span')

Then after that we are able to grab the items in the span, look into the width, and truncate if we have to.

(untested, but provides the idea)

<script type="text/javascript">

    var MAX_TITLE_LENGTH = 75;

    // on page load...
    $(function() {

    function truncateImageTitles() {
    	$('li > a > span').each(
    		if (this.text().length > MAX_TITLE_LENGTH)


Trim with PHP works, as T. Stone stated, but you'd have to determine if you wish to trim the front-end of the title or even the back finish. Lots of examples. I personally use trim with game titles by myself wordpress site. This trims the very first 13 figures from the publish title, instead of the_title.

<?php $mytitle = get_the_title(); $mytitle = substr($mytitle,13); echo $mytitle; ?>