는 내가 목록에서 "제목"을 제거해야, 내가 manage_commercial_cpi_posts_columns, 에 새로운 열을 추가 관리 어떻게 정의 게시물 목록을 사용자 정의하는 많은 검색하지만, , 여전히 편집, 삭제 옵션이 있습니다. 어떻게해야합니까?워드 프레스 변화 사용자 정의 포스트 유형 제목
1
A
답변
2
CSS 또는 JS로 제목 링크를 숨길 수 있지만 여기에는 PHP 접근 방식이 있습니다.
다음add_filter('manage_commercial_cpi_posts_columns', 'manage_commercial_cpi_posts_columns', 25, 1);
function manage_commercial_cpi_posts_columns($cols)
{
// remove title column
unset($cols['title']);
// add custom column
$cols['ccpi_links'] = __('Edit', 'textdomain');
// return columns
return $cols;
}
는 링크를 생성하는 WP_List_Table 클래스의 row_actions 방법을 사용 : 첫 번째 정의를 제목 열을 제거하고 추가 할 수 있습니다. 코드는 WP_Posts_List_Table 클래스에서 복사됩니다. 중요한 세부 사항은 을 row_actions
메서드의 두 번째 매개 변수로 추가하여 링크가 항상 표시되는지 확인하는 것입니다.
add_action('manage_commercial_cpi_posts_custom_column', 'manage_commercial_cpi_custom_column', 10, 2);
function manage_commercial_cpi_custom_column($col, $post_id)
{
switch($col) :
case 'ccpi_links' :
// variables
$post = get_post($post_id);
$title = _draft_or_post_title();
$post_type_object = get_post_type_object($post->post_type);
$can_edit_post = current_user_can('edit_post', $post->ID);
// set up row actions
$actions = array();
if ($can_edit_post && 'trash' != $post->post_status) {
$actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline')) . '">' . __('Quick Edit') . '</a>';
}
if (current_user_can('delete_post', $post->ID)) {
if ('trash' == $post->post_status)
$actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash')) . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>";
elseif (EMPTY_TRASH_DAYS)
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>";
if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS)
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently') . "</a>";
}
if ($post_type_object->public) {
if (in_array($post->post_status, array('pending', 'draft', 'future'))) {
if ($can_edit_post) {
$preview_link = set_url_scheme(get_permalink($post->ID));
/** This filter is documented in wp-admin/includes/meta-boxes.php */
$preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
$actions['view'] = '<a href="' . esc_url($preview_link) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
}
} elseif ('trash' != $post->post_status) {
$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>';
}
}
// invoke row actions
$table = new WP_Posts_List_Table;
echo $table->row_actions($actions, true);
break;
endswitch;
}
결과
+0
감사합니다. 매우 도움이됩니다. – dvircn
관련 문제
- 1. 워드 프레스 사용자 정의 워드 프레스 사용자 정의 포스트 유형 테마 만들 사용자 정의 포스트 유형
- 2. 워드 프레스 미디어 사용자 정의 포스트 유형
- 3. 워드 프레스 - 사용자 정의 포스트 유형
- 4. 사용자 정의 워드 프레스 포스트 유형
- 5. 워드 프레스 사용자 정의 포스트 유형
- 6. 사용자 정의 포스트 유형이 워드 프레스
- 7. 워드 프레스 (3.4.2) 페이지 매김 문제 - 사용자 정의 포스트 유형
- 8. 워드 프레스 사용자 정의 포스트 유형 탐색 + 어린이
- 9. 워드 프레스 사용자 정의 포스트 유형 월별 아카이브
- 10. 사용자 정의 포스트 형식 범주는 워드 프레스
- 11. 사용자 정의 게시 유형 워드 프레스
- 12. 워드 프레스 - 주문 사용자 정의 포스트 유형으로 사용자 정의 분류
- 13. 쿼리 모든 워드 프레스 포스트 제목
- 14. 워드 프레스 - 아래와 같이 나는 사용자 정의 포스트 유형을 만든
- 15. 워드 프레스 포스트 유형 만들기로 작업하기
- 16. 워드 프레스 3 사용자 정의 포스트 유형 : 나는 4 개 사용자 정의 포스트 유형 선언의 각각은이 종류를 사용하고
- 17. 워드 프레스 : 기간, 포스트 메타 또는 함께 포스트 제목
- 18. 워드 프레스 - 주제 사용자 정의 포스트 형 루프 - 아이 테마
- 19. 워드 프레스 사용자 정의 포스트 유형의 검색은 입력을 기반으로
- 20. 발췌 포스트 워드 프레스 포스트
- 21. 워드 프레스 사용자 정의 게시,
- 22. 워드 프레스 Woocommerce - 제목
- 23. 워드 프레스 포스트 순서와 category.php
- 24. 워드 프레스 - 관련 포스트
- 25. 워드 프레스 포스트 ID로
- 26. Regisitry 포스트 타입 워드 프레스
- 27. 사용자 정의 워드 프레스 쿼리
- 28. 워드 프레스 사용자 정의 분류 및 당기와
- 29. 사용자 정의 포스트 유형
- 30. 구문 오류, 워드 프레스 사용자 정의 포스트 템플릿
목록 페이지가 지금 무엇입니까? 제목을 바꿀 수 있습니까? –