function apply_filters($tag, $value) {
global $wp_filter, $merged_filters, $wp_current_filter; $args = array(); if ( isset($wp_filter['all']) ) {
$wp_current_filter[] = $tag;
$args = func_get_args();
_wp_call_all_hook($args);
} if ( !isset($wp_filter[$tag]) ) {
if ( isset($wp_filter['all']) )
array_pop($wp_current_filter);
return $value;
} if ( !isset($wp_filter['all']) )
$wp_current_filter[] = $tag; if ( !isset( $merged_filters[ $tag ] ) ) {
ksort($wp_filter[$tag]);
$merged_filters[ $tag ] = true;
} reset( $wp_filter[ $tag ] ); if ( empty($args) )
$args = func_get_args(); do {
foreach( (array) current($wp_filter[$tag]) as $the_ )
if ( !is_null($the_['function']) ){
$args[1] = $value;
$value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));
} } while ( next($wp_filter[$tag]) !== false ); array_pop( $wp_current_filter ); return $value;
}function the_permalink() {
echo apply_filters('the_permalink', get_permalink());
}

解决方案 »

  1.   

    常用函数-apply_filters()
    说明
    调用添加到过滤器hook上的函数。在Plugin API上查看过滤器hook列表。
    通过调用该函数,可以调用附着在过滤器hook $tag上的回调函数。用$tag参数所指定的新hook的名称调用该函数,可创建一个新的过滤器hook。
    用法
    <?php apply_filters($tag, $value); ?> 
    参数
    $tag
    (字符串)(必需)过滤器hook的名称
    默认值:None
    $value
    (混合)(必需)连接到$tag上的过滤器可能修改的值
    默认值:None
    返回的值
    (混合)所有连接函数都应用到该函数后,返回$value的结果。
    注意:返回值的类型应与$value类型一致,如字符串或数组。
    使用方法:$tag:可以自定义任意值
    $value:可以自定义任意值
      

  2.   


    过滤器hook? 是什么东西?
    我选择用wordpress做一个博客,先在blog.php页面中显示全部博文(分页),然后点击标题进入完整博文内容。
    为什么当我点击博文标题, 就跳转到了index.php页面, 如果是别人写好的模板,在index.php中显示全部博文,点击标题后在index.php中显示完整博文,为什么换了个页面就不可以了?代码大概如下:<?php if (have_posts()): ?>//检查是否有日志
        <?php while(have_posts()): the_post(); ?>//当博文有日志时 就循环
            <a href="<?php the_permalink();?>" title="<?php the_title(); ?>">
                <?php the_title(); ?>//博文标题
                <?php _e(the_permalink());?>//这里的输出是http://localhost/mulan/?p=8
            </a>
        <?php endwhile; ?> //关闭while()
    <?php endif; ?>//关闭if
      

  3.   


    过滤器hook? 是什么东西?
    我选择用wordpress做一个博客,先在blog.php页面中显示全部博文(分页),然后点击标题进入完整博文内容。
    为什么当我点击博文标题, 就跳转到了index.php页面, 如果是别人写好的模板,在index.php中显示全部博文,点击标题后在index.php中显示完整博文,为什么换了个页面就不可以了?代码大概如下:<?php if (have_posts()): ?>//检查是否有日志
        <?php while(have_posts()): the_post(); ?>//当博文有日志时 就循环
            <a href="<?php the_permalink();?>" title="<?php the_title(); ?>">
                <?php the_title(); ?>//博文标题
                <?php _e(the_permalink());?>//这里的输出是http://localhost/mulan/?p=8
            </a>
        <?php endwhile; ?> //关闭while()
    <?php endif; ?>//关闭if

    人家应该还有js你没调用吧
      

  4.   

    hook 钩子
    hook 函数,俗称回调函数apply_filters 意义就在于注册一个用户函数来改变默认的行为你还是应该认真的阅读 wordpress 的插件开发说明,先弄清楚工作流程
      

  5.   


    过滤器hook? 是什么东西?
    我选择用wordpress做一个博客,先在blog.php页面中显示全部博文(分页),然后点击标题进入完整博文内容。
    为什么当我点击博文标题, 就跳转到了index.php页面, 如果是别人写好的模板,在index.php中显示全部博文,点击标题后在index.php中显示完整博文,为什么换了个页面就不可以了?代码大概如下:<?php if (have_posts()): ?>//检查是否有日志
        <?php while(have_posts()): the_post(); ?>//当博文有日志时 就循环
            <a href="<?php the_permalink();?>" title="<?php the_title(); ?>">
                <?php the_title(); ?>//博文标题
                <?php _e(the_permalink());?>//这里的输出是http://localhost/mulan/?p=8
            </a>
        <?php endwhile; ?> //关闭while()
    <?php endif; ?>//关闭if

    人家应该还有js你没调用吧问题解决了一半 和你说的差不多 js 还有 一个php页面,只是还没有找到这个php页面,加油~~继续找。
      

  6.   


    恩 是的 wordpress要了解的还有很多。