Home › Forums › WoodMart support forum › How can I edit post type single post
How can I edit post type single post
- This topic has 6 replies, 2 voices, and was last updated 2 years, 7 months ago by
Aizaz Imtiaz Awan.
-
AuthorPosts
-
September 21, 2022 at 12:33 pm #407612
prabhathParticipantHi Author,
I created custom post type and add items. Then clicked the “Read More” button, its going to single page.
I want to add custom single post for that. How can I do that?Also in this situation, single post header not showing this post.
Please refer image.Thank you.
Attachments:
You must be logged in to view attached files.September 21, 2022 at 3:47 pm #407686
Aizaz Imtiaz AwanKeymasterHello,
Can you please tell me which plugin you have used to create the custom post type?
Also, share the WP admin login details of your site so I will check the possible solution to your issue.
Best Regards.
September 22, 2022 at 5:50 am #407825
prabhathParticipantHi Author,
I created custom code for it. Also I attached the php code with this.
And I install this theme in my localhost so can not share.
the only issue is I can not create custom single page for it.
Please advice.Thank you.
September 22, 2022 at 5:56 am #407829
prabhathParticipant/*
Custom post type code goes here
*/<?php // Register Custom Post Type - Case Studies function ttbc_case_studies_custom_post_type(){ // Set labels for the custom post type $labels = array( 'name' => 'Case Studies', 'singular_name' => 'Case Study', 'add_new' => 'Add Case Study', 'add_new_item' => 'Enter Case Study Details', 'all_items' => 'All Case Studies', 'featured_image' => 'Add Poster Image', 'set_featured_image' => 'Set Poster Image', 'remove_featured_image' => 'Remove Poster Image' ); // Set Options for this custom post type; $args = array( 'public' => true, 'label' => 'Case Studies', 'labels' => $labels, 'description' => 'Case Studies is a collection of Case Study and their info', 'menu_icon' => 'dashicons-format-aside', 'supports' => array( 'title', 'editor', 'thumbnail'), 'capability_type' => 'page', ); register_post_type('casestudy', $args); } add_action( 'init', 'ttbc_case_studies_custom_post_type' ); // Custom Post Type ends here. function ttbc_create_shortcode_case_studies_post_type(){ $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'casestudy', 'posts_per_page' => '8', 'publish_status' => 'published', 'paged' => $paged ); $query = new WP_Query($args); if($query->have_posts()) : $result=''; $result .= '<div class="casestudy-container container"><div class="content-box-wrapper row">'; while($query->have_posts()) : $query->the_post() ; $content = wp_strip_all_tags( get_the_excerpt(), true ); $custom_attach = get_post_meta( get_the_ID(), 'wp_custom_attachment', true ); $path; if(isset($custom_attach['url'])){ $path = removeBasePath($custom_attach['url']); }else{ $path = '#'; } $result .= '<div class="casestudy-item grid-columns-4" style="width:25%;">'; $result .= '<div class="casestudy-poster">' . get_the_post_thumbnail() . '</div>'; $result .= '<div class="casestudy-name"><h2>' . get_the_title() . '</h2></div>'; $result .= '<div class="casestudy-desc"><p>' . wp_trim_words(get_the_content(),17,'...') . '</p></div>'; $result .= '<a class="btn btn-color-primary btn-style-default btn-style-rectangle btn-size-default" href="'.get_post_permalink(get_the_ID()).'" target="_blank"> Read more</a>'; $result .= '<a class="btn btn-color-default btn-style-bordered btn-style-rectangle btn-size-default" href="'.get_template_directory_uri().'/inc/downloadpdf.php?pdfpath='. $path .'" target="_blank"> Download</a>'; $result .= '</div>'; endwhile; $result .= '</div></div><div class="wp-pagination-wrapper"><div class="wp-pagination">'; $total_pages = $query->max_num_pages; if ($total_pages > 1) { $current_page = max(1, get_query_var('paged')); $result .= paginate_links(array( 'base' => get_pagenum_link(1). '%_%', //'format' => '/page/%#%', 'current' => $current_page, 'total' => $total_pages, 'prev_text' => __('<i class="fas fa-chevron-left page-prev custom-arrow"></i>'), 'next_text' => __('<i class="fas fa-chevron-right page-next custom-arrow"></i>'), )); } $result .= '</div></div>'; wp_reset_postdata(); endif; return $result; } add_shortcode( 'case-studies-list', 'ttbc_create_shortcode_case_studies_post_type' ); // shortcode code ends here - Case Studies function removeBasePath($url){ $urlParts = parse_url($url); return $urlParts['path']; }
September 22, 2022 at 2:37 pm #407922
Aizaz Imtiaz AwanKeymasterHello,
Sorry but we could not help with code customizations.
This is beyond our limitations and support policy.
Best Regards
September 23, 2022 at 6:06 am #408039
prabhathParticipantHI Author,
Thank you for your reply.
My client have 2 types of post, case study and services.
How can I add those post in this theme.Thank you.
September 23, 2022 at 1:57 pm #408121
Aizaz Imtiaz AwanKeymasterHello,
Sorry but we could not help in Code customizations.
This is out of our theme support scope.
Best Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register