Tagged: aaa
- This topic has 10 replies, 3 voices, and was last updated 4 years, 5 months ago by Theme Horse Support Team.
-
AuthorPosts
-
May 25, 2020 at 10:40 pm #77953alahang9Participant
Hi, am having trouble with custom post types single layout. When viewing a custom post type the post content goes off the main content div. But it displays just fine with default wordpress posts. What could be the issue?
May 26, 2020 at 6:49 am #77957Theme Horse Support TeamKeymasterMay 26, 2020 at 7:11 am #77958alahang9ParticipantMy site is still on local environment. It’s only in Newscard where am having this issue. I tried other themes the custom posts display just fine. But in newscard everything is messed up in the post single page.
May 27, 2020 at 12:25 am #77967alahang9ParticipantAnd how can I change this code found in the content.php file to get category links for custom post types?
<div class=”cat-links”><?php the_category(”); ?> </div>
May 27, 2020 at 8:25 am #77979Theme Horse Support TeamKeymasterOk then please go to ‘Appearance > Customize > Additional CSS’ and paste the below Custom CSS Code.
.site-content .site-main .hentry { background-color: #ffffff; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); margin-bottom: 30px; padding: 25px; } .site-content .site-main .post-col .hentry { padding: 15px 15px 7px; margin-bottom: 14px; min-height: calc(100% - 14px); } .site-content .site-main .post-col .hentry .post-featured-image .entry-meta.category-meta { position: absolute; bottom: 0; left: 15px; right: 15px; margin-bottom: 10px; } .site-content .site-main .post-col .hentry .entry-content p { margin-bottom: 10px; } @media (max-width: 767px) { .site-content .site-main .hentry { padding: 15px; } }
For the Custom Post type Categories, First you need to register the Custom Taxonomies then you have to print/render the those each array of custom taxonomies rendered by wp_get_post_terms( post ID, Taxomony Name );
Thanks
May 30, 2020 at 2:52 pm #78082alahang9ParticipantThank you very much it worked. One more thing please. How can I use custom post type Taxonomies in the Card/Block Posts widget?
May 31, 2020 at 12:00 pm #78101Theme Horse Support TeamKeymasterBefore using Taxonomies first you have to register the Taxonomies(tags, Categories etc) using your custom post type register name. Then you can replace the function to show respective custom taxonomies on Theme Directory/ template-parts/ content.php file. Then to show the custom taxonomy list you can make the copy of archive.php file and rename the file as taxonomy-(your registered taxonomy name).php.
You can find many tutorials on internet/youtube about registering Taxonomies and related stuff. You can follow them for help
Thanks
May 31, 2020 at 12:49 pm #78103alahang9ParticipantThank you. Yes I have already registered custom taxonomies. They are working perfectly just having problems on how to use them in the theme’s front page widgets. I couldn’t find a solution.
June 1, 2020 at 6:15 am #78118Theme Horse Support TeamKeymasterOk for widgets you have to add your registered Custom Post Type on query codes. On Theme Directory/inc/newscard-widgets.php file, you can find the below code on line no: 195, 361 and 483.
'post_type' => array('post'),
to the mentioned code you have to add the registered Custom Post type as
'post_type' => array('post', 'your-custom-post-type'),
and to add taxomony (custom category) on dropdown list you have to add the taxomony on dropdown query code. you can find below code on line no: 169 and 335.
'selected' => $instance['category']
add the the taxonomy query code just beneath the mentioned code followed by comma (,) and after adding the code should look like this.
'selected' => $instance['category'], 'taxonomy' => 'your-custom-taxonomy'
We haven’t tried instantly but hope it should work and if it doesn’t work you for you then i think you have to hire a developer who is more familiar with the codes and can customized the Theme code for you.
Thanks
June 1, 2020 at 9:57 pm #78136alahang9ParticipantThanks a lot for the help, it worked.
June 2, 2020 at 1:58 pm #78166Theme Horse Support TeamKeymasterWelcome anytime @alahang9
-
AuthorPosts
- You must be logged in to reply to this topic.