1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
<?php
function papi_filter_settings_only_page_type( $post_type ) {
$page_type = apply_filters( 'papi/settings/only_page_type_' . $post_type, '' );
if ( ! is_string( $page_type ) ) {
return '';
}
return str_replace( '.php', '', $page_type );
}
function papi_filter_settings_show_page_type( $post_type, $page_type ) {
if ( is_object( $page_type ) && method_exists( $page_type, 'get_id' ) ) {
$page_type = $page_type->get_id();
}
$value = apply_filters( 'papi/settings/show_page_type_' . $post_type, $page_type );
if ( $value === $page_type ) {
return true;
}
if ( ! is_bool( $value ) ) {
return false;
}
return $value;
}
function papi_filter_settings_standard_page_type_description( $post_type ) {
$name = papi_get_post_type_label( $post_type, 'singular_name', 'Page' );
$tag = 'papi/settings/standard_page_type_description_' . $post_type;
$out = apply_filters( $tag, sprintf( __( '%s with WordPress standard fields', 'papi' ), $name ) );
$tag = 'papi/settings/standard_page_description_' . $post_type;
$out = apply_filters( $tag, $out );
return $out;
}
function papi_filter_settings_standard_page_type_name( $post_type ) {
$name = papi_get_post_type_label( $post_type, 'singular_name', 'Page' );
$tag = 'papi/settings/standard_page_type_name_' . $post_type;
$out = apply_filters( $tag, sprintf( __( 'Standard %s', 'papi' ), $name ) );
$tag = 'papi/settings/standard_page_name_' . $post_type;
$out = apply_filters( $tag, $out );
return $out;
}
function papi_filter_settings_show_standard_page_type( $post_type ) {
return ! apply_filters( 'papi/settings/show_standard_page_type_' . $post_type, false ) === false;
}
function papi_filter_settings_show_standard_page_type_in_filter( $post_type ) {
$tag = 'papi/settings/show_standard_page_type_in_filter_' . $post_type;
return ! apply_filters( $tag, papi_filter_settings_show_standard_page_type( $post_type ) ) === false;
}
function papi_filter_settings_standard_page_type_thumbnail( $post_type ) {
$tag = 'papi/settings/standard_page_type_thumbnail_' . $post_type;
$out = apply_filters( $tag, '' );
$tag = 'papi/settings/standard_page_thumbnail_' . $post_type;
$out = apply_filters( $tag, $out );
return $out;
}