【问题标题】:Add specific anchors under posts title在帖子标题下添加特定锚点
【发布时间】:2023-04-02 07:20:01
【问题描述】:

我是 wordpress 插件开发的新手,我想创建一个插件,在创建后对帖子进行一些特殊的编辑。我想在创建后(如附图中)在帖子下添加一个链接(锚点)以重定向到我将创建的新页面..

我可以这样做吗?

【问题讨论】:

    标签: php plugins wordpress


    【解决方案1】:

    你可以通过为post_row_actions过滤器创建一个钩子来做到这一点

    add_filter( 'post_row_actions', 'wpse8170_row_actions', 10, 2 );
    function wpse8170_row_actions( $actions, WP_Post $post ) {
        if ( $post->post_type != 'my-custom-post-type' ) {
            return $actions;
        }
    
        $actions['wpse8170-pdf'] = 'http://your/url/here';
        return $actions;
    }
    

    阅读本文

    http://pippinsplugins.com/add-custom-links-to-user-row-actions/

    或阅读这个

    http://www.codeforest.net/add-custom-links-to-row-actions-in-wordpress

    【讨论】:

    • 哇——很棒的过滤器..以前从未见过..+1
    猜你喜欢
    • 1970-01-01
    • 2015-06-28
    • 2010-10-16
    • 1970-01-01
    • 2023-04-05
    • 1970-01-01
    • 1970-01-01
    • 2011-04-06
    • 1970-01-01
    相关资源
    最近更新 更多