Monica 322 ارسال شده در آذر 95 گزارش بازنشر ارسال شده در آذر 95 باسلام ، دوتا سوال دارم اول اینکه من ی قالب برگه مشخص دارم که میخوام تو این برگه استایل و js فراخوانی بشه . از کد زیر استفاده کردم ، درسته ولی برگه خیلی دیر لود میشه . کد رو ببینید کجاش اشتباهه (لطفا راهنمایی کنید... <? function custom_styles() { wp_register_style( 'liv', get_template_directory_uri().'/A.3a51907qEU.css', false, false ); wp_register_style( 'liv2', get_template_directory_uri().'/A.307e5003.main.css', false, false ); wp_register_script( 'js-liv', get_template_directory_uri() . '/faf878b8.common.build.js', array(), false, true ); wp_register_script( 'js-liv2', get_template_directory_uri() . '/fronttournament.livee.js', array(), false, true );if ( is_page('1848') ): wp_enqueue_style( 'liv' ); wp_enqueue_style( 'liv2' ); wp_enqueue_script( 'js-liv' ); wp_enqueue_script( 'js-liv2' ); else:' '; endif; } add_action( 'wp_enqueue_scripts', 'custom_styles' ); ?> سوال دوم اینکه من ی نقش کاربری تعریف کردم و دسترسی ادیت دادم ولی نمیتونه بعد از انتشار ویرایش کنه ، کد زیر رو ببینید function snippets_add_role() { add_role( 'new-role', __( 'نویسنده ویژه' ), array( 'delete_posts' => true, 'delete_published_posts' => true, 'edit_posts' => true, 'edit_published_posts' => true, 'publish_posts' => true, 'read' => true, 'upload_files' => true, ) ); } add_action( 'init', 'snippets_add_role' ); لینک به ارسال
مهدی 1668 ارسال شده در آذر 95 گزارش بازنشر ارسال شده در آذر 95 سلام ج۱ مشکلی نداره ولی حالا اینمدلی هم تست کنید function custom_styles() { wp_register_style( 'liv', get_template_directory_uri().'/A.3a51907qEU.css' ); wp_register_style( 'liv2', get_template_directory_uri().'/A.307e5003.main.css' ); wp_register_script( 'js-liv', get_template_directory_uri() . '/faf878b8.common.build.js', '', '', true ); wp_register_script( 'js-liv2', get_template_directory_uri() . '/fronttournament.livee.js', '', '', true ); if ( is_page('1848') ) { wp_enqueue_style( 'liv' ); wp_enqueue_style( 'liv2' ); wp_enqueue_script( 'js-liv' ); wp_enqueue_script( 'js-liv2' ); } } add_action( 'wp_enqueue_scripts', 'custom_styles' ); ج۲ برای نقش کاربری level تعریف کنید (فک کنم حداقل باید ۵ باشه) بعد موارد اضافی رو غیرفعال کنید 2 لینک به ارسال
پست های پیشنهاد شده
لطفا برای ارسال دیدگاه وارد شوید
شما بعد از اینکه وارد حساب کاربری خود شدید می توانید دیدگاهی ارسال کنید
ورود به حساب کاربری