如果你是开发人员,我需要你的帮助。

adifkane1983

New member
我的WordPress插件和主题有问题。我的插件使用自定义文章类型(词汇表),但主题不支持,所以我在主题functions.php中添加了这个代码,它在插件的文章中有效果,但问题是这个代码没有获取主题中的所有内容,如“建议的文章”。所以,你们能帮我吗?这是我使用的代码:function add_glossary_post_type_support( $supported_post_types ) { if ( ! is_array( $supported_post_types ) ) { $supported_post_types = array(); } $supported_post_types[] = 'glossary'; return $supported_post_types;}add_filter( 'TieLabs/Settings/default_post_types', 'add_glossary_post_type_support' );
 

theringhapo1985

New member
请你能不能解释得更详细些?你指的是什么?能否发送链接和对你正在尝试实现的最终结果的描述?
 

titiregi1979

New member
如果我在我的网站上发布普通文章,所有主题功能都能正常工作,例如文章图像、作者信息、推荐文章等等。但是该插件使用了一个自定义类型叫做词汇表,我使用了以下代码: function add_glossary_post_type_support( $supported_post_types ) { if ( ! is_array( $supported_post_types ) ) { $supported_post_types = array(); } $supported_post_types[] = 'glossary'; return $supported_post_types;}add_filter( 'TieLabs/Settings/default_post_types', 'add_glossary_post_type_support' );这段代码让我的插件几乎可以从主题中获取所有内容,如果我更改了文章布局,它也会影响到插件文章。但是我仅有一个问题,我的自定义文章词汇表没有像普通文章一样从主题中获取推荐文章的功能。
 
顶部