简单的灯箱wordpress插件与wp_trim_words

时间:2014-03-26 15:33:30

标签: wordpress

我试图将简单的灯箱插件与wp_trim_words功能结合起来。对于__tent要求存在问题,因此无法让主页上的图库工作。我有这个代码

$content = get_the_content();
        apply_filters('the_content', $content);
        $content = str_replace(']]>', ']]>', $content);
        $trimmed_content = do_shortcode(wp_trim_words($content, 50, '<a href="' . get_permalink() . '" style="display: block; width: 100%;">...more</a>'));
        echo $trimmed_content;

它显示来自[gallery = 1,2,3]的图像,但简单的灯箱插件未初始化。这有什么不对?

1 个答案:

答案 0 :(得分:1)

apply_filters()返回数据。目前,您正在过滤$content但未保存结果。

// Before
apply_filters('the_content', $content);

// After
$content = apply_filters('the_content', $content);
相关问题