How to display single post from custom post type loop?

Your single.php is coded in a way that show all posts like archive, it needs to be modified. To fetch current post, try something like that instead: <?php get_header(); ?> <section id=”content”> <div class=”wrap-content blog-single”> <?php while ( have_posts() ) : the_post(); ?> <article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>> <?php the_title( ‘<h1>’,'</h1>’ ); ?> … Read more

Can multiple authors be assigned on a single custom post?

Easy way: use this plugin https://wordpress.org/plugins/user-role-editor/ More complicated way: You can use functions.php to add all of the custom capabilities to a specific roles. But ofc you need a name of these capabilities. This code is usefull if you want to add X same capabilities to X roles. Add to functions.php function wphm_add_custom_capabilities_to_roles($roles, $capabilities) { … Read more

How to remove post listing page for a custom post type

I get a way to override this problem. by using “add_action” I can able to achieve my goal. add_action(“load-edit.php”, ‘block_listing_page’); //– Block user to access post listing page function block_listing_page() { if ($_GET[“post_type”] == “your_custom_post_type”) { $args = array(‘post_type’ => ‘your_custom_post_type’, ‘post_status’ => ‘publish’); $galleryPosts = get_posts($args); if (!empty($galleryPosts) && count($galleryPosts) > 0) { wp_redirect(“post.php?post=” … Read more

manage_edit-{post_type}_sortable_columns sorts, but wrong!

Remove this: // Administration: Teach wordpress to make the column sortable function anco_project_year_column_orderby( $vars ) { if ( isset( $vars[‘orderby’] ) && ‘anco_project_year_from’ == $vars[‘orderby’] ) { $vars = array_merge( $vars, array( ‘meta_key’ => ‘anco_project_year_from’, ‘orderby’ => ‘meta_value_num’ ) ); } else if ( isset( $vars[‘orderby’] ) && ‘anco_project_year_to’ == $vars[‘orderby’] ) { $vars = … Read more