GDPR Suggestion

Hi @tix

That’s an endpoint to fetch the data from, it’s not a path that you would use with Frontity - Frontity uses the endpoint internally to get the data into the state so that you can work with it. To navigate a Frontity site you would use the same permalinks that WordPress uses.

Regarding the posts, where is the content for the plugin if it’s not in posts?

Also shouldn’t it be http://SOMETHING/wp-json/wp/v2/cookielawinfo ?

I see.

The content for the plugin is already included when you install the plugin. It’s here (look picture below):

Yes, of course. Typo. And when I type http://SOMETHING/wp-json/wp/v2/cookielawinfo, I get an empty array.

It’s a shortcode automatically aded.

So the shortcode adds, or should be adding, the cookie info to the page content? If that’s the case then you don’t need the code you cited when you started this thread in your functions.php file. That code is only needed if you need to add a CPT to the REST API.

So now we need to figure out why the cookie info isn’t in the page content that is being sent to Frontity.

1 Like

I’m going to test it out. Just to confirm this is the plugin you’re using?

Great. Yes, this one.

Hi @tix

OK, so I installed the plugin and did some digging around.

It turns out that the content for the cookie consent plugin is buried away in the WordPress wp_options table. It is in an option called CookieLawInfo-0.9 and it looks like all the info and settings for the plugin are contained within that option, including the text content. I’ve included screenshots (taken from Sequel Pro) below and have highlighted both the option and also the text content corresponding to the text in the Message field under the Customise Cookie Bar tab.

You will need to write some PHP code, either in the theme’s functions.php file or in a custom plugin, that retrieves that option and gets the content you want. You will then need to create a custom endpoint, again in PHP, exposing that content in the REST API, and then fetch it from Frontity and handle it.

TBH, unless you need to use WordPress to content manage this it might be simpler to just add a React component to your Frontity theme to display a consent bar.

Thanks for all the help. In the end I just decided to use react-cookie-consent package. I think it’s enough for what I need.

You’re welcome @tix, good luck with the rest of your project. We’re right here if you need any more help.

1 Like

Is this the one you’re using? Looks like a good option. :ok_hand:

Yes, this one. I agree. Very simple to implement.