badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

Newscard Custom Post Type Single

Tagged: 

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #77953
    alahang9
    Participant

    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?

    #77957

    Hi @alahang9,

    Could please share us your Site URL so that we can figure out the issue.

    Thanks

    #77958
    alahang9
    Participant

    My 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.

    #77967
    alahang9
    Participant

    And 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>

    #77979

    Ok 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

    #78082
    alahang9
    Participant

    Thank you very much it worked. One more thing please. How can I use custom post type Taxonomies in the Card/Block Posts widget?

    #78101

    Before 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

    #78103
    alahang9
    Participant

    Thank 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.

    https://ibb.co/1ZZCKs7

    #78118

    Ok 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

    #78136
    alahang9
    Participant

    Thanks a lot for the help, it worked.

    #78166

    Welcome anytime @alahang9

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.