Support » Fixing WordPress » Problem with columns and custom fields/truncate function

  • I’ve set up twenty eleven as a child theme and created a custom page with advanced custom fields. I created a page with 2 columns and everything works great until I used truncated text.

    I use this code in my functions.php and it’s working as supposed to be:

    function trunc($phrase, $max_words)
    {
    $phrase_array = explode(' ',$phrase);
    if(count($phrase_array) > $max_words && $max_words > 0)
    $phrase = implode(' ',array_slice($phrase_array, 0, $max_words)).'...'
    return $phrase;
    }

    However, I’m experiencing a problem with my page when using this function in columns. As long as I am using the get_field alone without trunc, the columns look OK but as soon as I’m using trunc, I have a problem with the first column, second row moving over to the second column. You can check it here: http://tierhilfe-spanien.org/zuhause-gesucht/huendinnen/

    Here’s the code I’m using in my template file (sorry for the spaghetti code but I’m new to PHP and WP):

    http://pastebin.com/0dRdfB1t

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Problem with columns and custom fields/truncate function’ is closed to new replies.