Hello Upadesh,
if you wanna create a custom post type, I would recommend to switch first to a WP standard theme, like Twenty Seventeen. If it doesn’t work there, it’s most likely an error in your code.
Also, for getting started with CPT more easily, you can use a plugin like Custom Post Type UI. Havea look to this small tutorial: How to Create Custom Post Types in WordPress. I’ve just tried it out and it works also on Quicksand.
If you still want to programm your own CPT, please ask on stackoverflow or another wordpress forum for developers.
Hope that helps 🙂
Dear cafeserendipity21,
Thank you for the help and I am great fan of your theme.
As you suggested, I was able to make the post display the title and description, but there are still few of the custom fields that I want to display in the post. But, it was only possible by editing the quicksand/inc/template-tags.php of main theme. I don’t want to play with the main theme. So, please guide me how to make it workable by editing quicksand-child/inc/template-tags.php.
I tried same with the Twenty Seventeen Child theme and it worked.
Thanks in advance once again.
Hello Upadesh,
frankly speaking, I’m not a specialist in custom post types, but I’ve just tested it with a child-theme and here’s what I’ve done.
copy single.php inside your child-theme directory and modify the while-loop, so it looks like:
while ( have_posts() ) : the_post();
//get_template_part('template-parts/content', get_post_format());
if ( get_post_type() ):
get_template_part( 'template-parts/content', get_post_type() );
else:
get_template_part( 'template-parts/content', get_post_format() );
endif;
...
endwhile;
Create a folder named template-parts and copy template-parts/content.php inside. Rename it, to fit your custom post type, i.e. content-software.php
Now you can modify the content to fit your needs, by renaming the function quicksand_the_entry_content() to quicksand_the_entry_content_software()
Create this function inside your functions.php.
if (!function_exists('quicksand_the_entry_content_software')) :
function quicksand_the_entry_content_software($class = 'entry-content') {
?>
<div class="card-block quicksand-entry-content-software <?php echo esc_attr($class); ?>">
<div class="card-text">
<?php the_content(); ?>
</div>
</div>
<?php
echo "publisher: : " . get_post_meta( get_the_ID(), 'publisher', TRUE ) . "<br>";
echo "created: : " . get_field( 'created');
?>
<!--displays page links for paginated posts (i.e. includes the 'nextpage')-->
<?php
quicksand_paginated_posts_paginator();
}
endif;
Here you can output your custom fields (get_field() is provided by the Advanced Custom Fields Plugin).
Hope that helps 🙂
Dear cafeserendipity21,
You are great. It worked like a charm :).
I am in love with your theme and waiting for the future update of the theme. I hope we will soon get this theme with Bootstrap v4 final release.