| Server IP : 43.130.17.34 / Your IP : 216.73.217.6 Web Server : nginx/1.28.0 System : Linux VM-4-12-opencloudos 6.6.92-34.1.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 25 21:32:13 CST 2025 x86_64 User : www ( 1000) PHP Version : 8.0.26 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/yespkg.com/wp-content/plugins/theme-customization-settings/src/ |
Upload File : |
<?php
/**
* 后台操作
*/
if ( !function_exists( 'customPostType' ) ) {
function customPostType ()
{
register_post_type( 'home', customPostTypeArgs( "home" ) );
}
add_action( 'init', 'customPostType' );
}
//$secureAdminUrls = new \App\Admin\SecureAdminUrlsClass();
function eric_updata_thumb ( $post_ID )
{
$thumbnail_id = '';
$images = get_field( 'product_gallery' );
if ( !empty( $images ) && count( $images ) > 0 ) {
$thumbnail_id = $images[0]['id'];
}
set_post_thumbnail( $post_ID, $thumbnail_id );
}
add_action( 'save_post', 'eric_updata_thumb', 10, 2 );
function register_my_menus ()
{
register_nav_menus( array(
'primary' => __( '主导航菜单' ),
'footer' => __( '页脚菜单' )
) );
}
add_action( 'init', 'register_my_menus' );
function custom_post_news ()
{
$labels = array(
'name' => _x( 'News', 'post type general name' ),
'singular_name' => _x( '新闻', 'post type singular name' ),
'add_new' => _x( '添加新闻', 'book' ),
'add_new_item' => __( '添加新闻' ),
'edit_item' => __( '编辑新闻' ),
'new_item' => __( '新建新闻' ),
'all_items' => __( '全部新闻' ),
'view_item' => __( '查看新闻' ),
'search_items' => __( '搜搜新闻' ),
'not_found' => __( '未找到新闻' ),
'not_found_in_trash' => __( '垃圾桶里找不到消息' ),
'parent_item_colon' => '',
'menu_name' => '新闻'
);
$args = array(
'labels' => $labels,
'description' => 'Holds our product and product specific data',
'public' => true,
'menu_position' => 10,
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt' ),
'has_archive' => true,
);
register_post_type( 'news', $args );
}
add_action( 'init', 'custom_post_news' );
//Custom Taxonomies (news Categories)
function taxonomies_news ()
{
$labels = array(
'name' => _x( '新闻分类', 'taxonomy general name' ),
'singular_name' => _x( '新闻分类', 'taxonomy singular name' ),
'search_items' => __( '搜索新闻分类' ),
'all_items' => __( '新闻分类' ),
'parent_item' => __( '新闻分类' ),
'parent_item_colon' => __( '新闻分类:' ),
'edit_item' => __( '新闻分类修改' ),
'update_item' => __( '新闻分类更新' ),
'add_new_item' => __( '新增新闻分类' ),
'new_item_name' => __( '新新闻分类' ),
'menu_name' => __( '新闻分类' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
);
register_taxonomy( 'news_catalog', 'news', $args );
}
add_action( 'init', 'taxonomies_news', 0 );