WordPress.org

Ready to get started?Download WordPress

Forums

WP-Filebase Download Manager
WordPress truncates wp-filebase shortcode (5 posts)

  1. fringer
    Member
    Posted 3 years ago #

    Hiya,

    I'm having a really weird problem - WordPress keep truncating the wp-filebase shortcoe every time I make a change to the page or post. What happens is that every time I change something (unrelated to the wp-filebase shortcode itself), the shortcode gets truncated like this:

    THIS
    [gn_tab title="something"][wpfilebase tag=list id='3,4' tpl='table_list' sort='<file_id'][/gn_tab]

    BECOMES THIS
    [gn_tab title="something"][wpfilebase tag=list id='3,4' tpl='table_list' sort='

    gn_tab - shortcode for tabs (Shortcodes Ultimate plugin)
    table_list - my template for displaying list of files

    Now I do have TinyMCE installed, with loads of plugin for it, so maybe some of them are causing this, I'll have to test this, but I'd love to know if somebody had similar problems.

  2. fringer
    Member
    Posted 3 years ago #

    I did some testing and the roblem appears only when I use the shortcode for file listing. I've tried omitting the sort order shortcode, but still it doesn't work.

    Any ideas?

  3. fringer
    Member
    Posted 3 years ago #

    This is really weird - two pages, completely the same structure, one works, the other one doesn't. Evrytime I adda shortcode for Category with id 4, it breaks. I've tried adding another category list on the same page and it works. What could be the cause of such behavior?

  4. fringer
    Member
    Posted 3 years ago #

    I did yet more testing and it seems that the number of files is the culprit - I have 20 files in the category, and if I remove 1 random file, the category listing displays. As soon as I put the file back int o the category, the page doesn't dispay.

    What is going on with this? Does anyone have a similar issue with number of files?

  5. kraudio
    Member
    Posted 2 years ago #

    in function.php(template)

    /* truncate
    **************************************************************/
    function truncate($str, $len=80, $etc='') {
        $end = array(' ', '.', ',', ';', ':', '!', '?');
    
        if (strlen($str) <= $len)
            return $str;
    
        if (!in_array($str{$len - 1}, $end) && !in_array($str{$len}, $end))
            while (--$len && !in_array($str{$len - 1}, $end));
    
        echo rtrim(substr($str, 0, $len)).$etc;
    }

    in template page
    <a href="<?php the_permalink(); ?>"><?php truncate(get_the_content(), 90, ' {...}'); ?></a>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic