-
Author
Tagged: custom post type, template
-
September 25, 2015 at 20:29 #79517KlameParticipant
Hi,
I’m trying to make custom post type with Kleo.
I have created a code in functions.php, and it’s shown in the dashboard whit meta-boxes etc.But how do I get the data shown in front-end – On a subpage/page template?
I tried to take a existing page-template from kleo, added it to child-kleo/page-templates, and added this code:
COPY CODE<?php $args array ('post_type' => 'coevents'); $query = new WP_Query($args); while($query -> have_posts()) : $query -> the_post(); ?> <div class="event-titel"> <h2><?php the_title(); ?></h2> </div> <?php endwhile; ?>
But then I get a PHP-error, seems like it dosen’t like the array…
Furthermore this custom post type should be what the user creates, when he goes under “my articles” (using social articles plugin)
Have looked/googled at this part so much yet, that I want the front-end done first.
Is this simple to accomplish?September 26, 2015 at 03:42 #79545sharmstrModeratorI dont think Social Articles supports CPTs. I could be wrong. If not, take a look at this one: http://buddydev.com/buddypress/reintroducing-buddyblog-supporting-custom-post-typestaxonomies-for-buddypress-user-blogs/
As far as templates go… not sure why you’re creating a page template. Looks like you just want a listing of all the posts for that CPT. If that’s the case, then you want to copy /kleo/archive.php to /kleo-child/archive-{cpt-name}.php
Then, if you want a custom page to display that actual post, then you can do the same with single.php.
Its all in the codex: https://codex.wordpress.org/Post_Type_Templates
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The forum ‘KLEO’ is closed to new topics and replies.