文件操作 - register-ajax-callbacks.php
返回文件管理
返回主菜单
删除本文件
文件: /storage/v12552/jimbrandstatter/public_html/wp-content/themes/Total/inc/register-ajax-callbacks.php
编辑文件内容
<?php namespace TotalTheme; use TotalTheme\Helpers\Add_Template; \defined( 'ABSPATH' ) || exit; /** * Registers ajax callbacks. */ class Register_AJAX_Callbacks { /** * Static-only class. */ private function __construct() {} /** * Hook into actions and filters. */ public static function init() { \add_action( 'wp_ajax_wpex_ajax_load_more', 'TotalTheme\Pagination\Load_More::get_posts' ); \add_action( 'wp_ajax_nopriv_wpex_ajax_load_more', 'TotalTheme\Pagination\Load_More::get_posts' ); if ( \is_admin() ) { \add_action( 'wp_ajax_totaltheme_add_template', [ self::class, 'add_template' ] ); } } /** * Adds a new template. */ public static function add_template(): void { if ( ! \current_user_can( 'publish_pages' ) || empty( $_POST['post_title'] ) || ! \post_type_exists( 'wpex_templates' ) ) { \wp_die(); } \check_ajax_referer( Add_Template::NONCE, 'nonce' ); $result = [ 'success' => 0 ]; $type = $_POST['type'] ?? ''; $template_id = (new Add_Template( $_POST['post_title'], $type))->template_id; if ( $template_id ) { $result['success'] = 1; $result['template_id'] = \absint( $template_id ); // $result['edit_url'] = \esc_url( \admin_url( 'post.php?post=' . \intval( $template_id ) . '&action=edit' ); } echo \wp_json_encode( $result ); \wp_die(); } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件