如何更改/删除此功能';s输出,而不修改原始主题文件


How to alter/remove this function's output without modifying the original theme files?

我正在使用一个主题框架,并努力抵制编辑核心文件的诱惑。我想添加帖子格式的功能,但我需要能够删除特定帖子格式的某些元素。

            function thesis_teaser_headline($post_count, $post_image) {
                thesis_hook_before_teaser_headline($post_count); #hook
                if ($post_image['show'] && $post_image['y'] == 'before-headline')
                    echo $post_image['output'];
                echo '<h2 class="entry-title"><a href="' . get_permalink() . '" rel="bookmark" title="Permanent link to ' . get_the_title() . '">' . get_the_title() . "</a></h2>'n";
                if ($post_image['show'] && $post_image['y'] == 'after-headline')
                    echo $post_image['output'];
                thesis_hook_after_teaser_headline($post_count); #hook
            }

删除诸如"链接"之类的帖子格式的标题数据最有效的方法是什么?调用此函数是为了从主页循环中生成预告片的内容。我可以做一个完整的自定义循环,但它不会与论文后端绑定,这使它的灵活性大大降低。

谢谢!

我不熟悉Thesis,但我看到它正在调用钩子,所以你可以在上面放一个函数,以防你不想要原始thesis_teaser_headline()中的任何内容。你可以在before钩子上打开输出缓冲(ob_start()),并在after钩子上清除它(如果你想更改它的内容,则为ob_end_clean()$content = ob_get_clean(),而不是完全替换)。

您可以使用/* */控件在注释中生成函数。所以它不会被执行。或者只将要删除的部分放在它们之间。。。

用jquery调整html怎么样?检查post类(包装每个post的div上的css类列表),看看是否可以从中选择所需内容。最重要的是,我建议避免使用该框架,当你需要调整它时,这简直是噩梦