Site logo

Archived topic

Working together with a Glossary plugin, is it possible ?

3 replies · Started by Jimi on May 2, 2021

Viewing posts 1–4 of 4

Hi,

Thanks for helping me, my site is looking great now, and is getting the best scores on Google Pagespeed, and GT Metrix :)

One more question though. I don't get the possibility to edit using Generatepress, or GenerateBlocks, on the pages that my Glossary /wiki plugin makes.

You can see one of them here:https://onlinemarketingbureauet.dk/ordbog/seo/

I asked the maker of this plugin and he told me this:

"Hi there,

Thanks for purchasing my plugin. I would be happy to help you.

You can add Gutenberg / Block Editor support to my custom post type easily by adding following script to your current theme’s functions.php file"

function wpg_post_editor ( $args ) {
$args['show_in_rest'] = true;
return $args;
}
add_filter ( 'wpg_post_type_glossary_args', 'wpg_post_editor' );

Is it true what he says ? And how do I add it in the functions.php ? Inside my Cpanel ?

Thanks,
Jimi

Hi there,

that function registers Rest support for plugins template - which is required for using the Block Editor... so if the Author says that will work then we have no reason to say it would not.

The code is PHP - this article explains 2 methods of adding it your site:

https://docs.generatepress.com/article/adding-php/

It worked :)

And here is an even better code for that purpose:

function wpg_post_editor ( $args ) {
$args['show_in_rest'] = true; // for Gutenberg Editor
return $args;
}
add_filter ( 'wpg_post_type_glossary_args', 'wpg_post_editor' );

add_filter( 'register_taxonomy_args', 'my_taxonomy_args', 10, 2 );

function my_taxonomy_args( $args, $taxonomy_name ) {

if ( 'glossary_cat' === $taxonomy_name ) {
$args['show_in_rest'] = true;
}

if ( 'glossary_tag' === $taxonomy_name ) {
$args['show_in_rest'] = true;
}

return $args;
}

Glad to hear that - and thanks for sharing your final code!

This archived topic is closed to new replies.