Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将自定义文件添加到自定义文章列表页面_Php_Wordpress_Plugins_Hook_Custom Post Type - Fatal编程技术网

Php 如何将自定义文件添加到自定义文章列表页面

Php 如何将自定义文件添加到自定义文章列表页面,php,wordpress,plugins,hook,custom-post-type,Php,Wordpress,Plugins,Hook,Custom Post Type,我已经创建了一个自定义的帖子类型。我试着展示每一个 在自定义文章列表页面(见屏幕截图)中,点击和浏览次数会计数,但没有成功 您可以这样添加它。您需要根据帖子类型和字段名进行调整。在本例中,我将使用“custom Artiale”的post类型和“view count”的字段名 add_filter('manage_custom-articale_posts_columns', 'reveal_view_count', 1); add_action('manage_custom-articale_

我已经创建了一个自定义的帖子类型。我试着展示每一个 在自定义文章列表页面(见屏幕截图)中,点击和浏览次数会计数,但没有成功


您可以这样添加它。您需要根据帖子类型和字段名进行调整。在本例中,我将使用“custom Artiale”的post类型和“view count”的字段名

add_filter('manage_custom-articale_posts_columns', 'reveal_view_count', 1);
add_action('manage_custom-articale_posts_custom_column', 'reveal_view_count_value', 1, 2);

function reveal_view_count($columns)
{
    $columns['view-count'] = 'View Count';
    return $columns;
}

function reveal_view_count_value($column)
{
    if ('view-count' == $column) {
        echo the_field('view-count');
    }
}

你遇到过类似的情况吗@我认为你应该提供更多的细节。你为实现这一目标做了什么?