Hi,
I am new to this framework. I want to know that i i want to display custom post type “courses” in home page then what i need to do changes in “mars-theme”?
Please help me.
Hi,
I am new to this framework. I want to know that i i want to display custom post type “courses” in home page then what i need to do changes in “mars-theme”?
Please help me.
You can add support for custom post-types by adding them to your configuration in frontity.settings.js
. See this post for more details: Frontity release: Support for Custom Post Types & Custom Taxonomies
Hi,
Thanks for your reply. If there is custom post type “courses” then what i need to do in this line “const Post = ({ state, actions, libraries }) => {”
Hi @letternanda
Welcome to the community.
If you’ve set the custom post type up in frontity.settings.js
then you don’t need to do anything else - unless you want the “courses” post type to be treated differently from normal posts. You just need to visit the URL (e.g. https://yoursite.com/courses/
or https://yoursite.com/courses/categoryname/
) and Frontity will handle everything in the background for you.
Hi,
Thanks for your reply. Here is code for my frontity.setting.js
{
"name": "@frontity/wp-source",
"state": {
"source": {
"api": "https://www.demo.pixelbiteweb.com/onpoint/wp-json/",
"postTypes": [
{
"type": "courses", // type slug
"endpoint": "courses"
}
],
}
}
When i run it in home page it show only loading image and no content. Please help me.
it my site page http://demo.pixelbiteweb.com/onpoint/courses/ i want to display all the “courses” in the frontity home page. Help me
what i need to do for that.
Hi @letternanda
If you want to see an archive of all courses, as well as or instead of courses by category, then you need to add the archive
property as well.
postTypes: [
{
type: "courses",
endpoint: "courses",
archive: "/courses_archive",
},
];
For more info see our docs on postTypes.
Let me know if this solves the problem for you.
Thanks for your reply. I checked it but it is still not working. This is my setting.js changes for display custom post type “courses”
{
"name": "@frontity/wp-source",
"state": {
"source": {
"api": "https://www.demo.pixelbiteweb.com/onpoint/wp-json/",
"postTypes": [
{
"type": "courses", // type slug
"endpoint": "courses",
"archive": "/courses_archive",
}
],
}
}
I try to check it by http://localhost:3000/courses/ but nothing display.
Thanks for your help and now problem is solved.