WordPress1 364 ارسال شده در شهریور 96 گزارش بازنشر ارسال شده در شهریور 96 (ویرایش شده) با سلام میخواستم کد زیر رو به انتهای functions.php اضافه کنم. function my_theme_styles() { wp_enqueue_style('my-theme-style', get_bloginfo('template_directory') . '/style.css', false, 2); } add_action('wp_print_styles', 'my_theme_styles'); کد functions.php هم به صورت زیر هست: <?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' ); /** * Include all the needed files * * (!) Note for Clients: please, do not modify this or other theme's files. Use child theme instead! */ if ( ! defined( 'US_ACTIVATION_THEMENAME' ) ) { define( 'US_ACTIVATION_THEMENAME', 'Zephyr' ); } //add_filter( 'us_blog_listing_classes', 'zephyr_listing_classes' ); add_filter( 'us_portfolio_listing_classes', 'zephyr_listing_classes' ); add_filter( 'us_gallery_listing_classes', 'zephyr_listing_classes' ); function zephyr_listing_classes( $classes ) { if ( strpos( $classes, 'type_masonry' ) !== FALSE ) { return $classes; } else { return $classes . ' animate_revealgrid'; } } //add_filter( 'us_blog_listing_item_classes', 'zephyr__listing_item_classes' ); add_filter( 'us_portfolio_listing_item_classes', 'zephyr_listing_item_classes' ); add_filter( 'us_gallery_listing_item_classes', 'zephyr_listing_item_classes' ); function zephyr_listing_item_classes( $classes ) { return $classes . ' animate_reveal'; } // Using labels instead of placeholders in comments form add_filter( 'us_comment_form_fields', 'zephyr_comment_form_fields' ); function zephyr_comment_form_fields( $fields ) { foreach ( $fields as &$field ) { $field['title'] = $field['placeholder']; unset( $field['placeholder'] ); } return $fields; } $us_theme_supports = array( 'plugins' => array( 'js_composer' => '/framework/plugins-support/js_composer/js_composer.php', 'Ultimate_VC_Addons' => '/framework/plugins-support/Ultimate_VC_Addons.php', 'revslider' => '/framework/plugins-support/revslider.php', 'contact-form-7' => NULL, 'woocommerce' => '/framework/plugins-support/woocommerce/woocommerce.php', 'codelights' => '/framework/plugins-support/codelights.php', 'wpml' => NULL, 'us-header-builder' => '/framework/plugins-support/us_header_builder.php', ), ); require dirname( __FILE__ ) . '/framework/framework.php'; انتهای کد php فانکشن بسته نشده و کد (<?) نیامده است. وقتی کد خودم رو اضافه میکنم هیچ اتفاقی نمیفته یعنی انتهای فانکشن رو می بندم و کد خودم رو هم داخل (php?> و <?) قرار میدم فایده نداره. فکر کنم مشکل از کد اولیه باشه و wp_enqueue_style که باید فراخوانی رو عوض کنم ولی نمیدونم به چه شکل. فکر کنم مشکلم شبیه این تاپیک باشه: لطفا کمک کنید. مرسی از همه ویرایش شده شهریور 96 توسط yaali نقل قول لینک به ارسال
mehran-b 2385 ارسال شده در شهریور 96 گزارش بازنشر ارسال شده در شهریور 96 تگ پایان PHP حتما نیاز نیست که اخر فایل های PHP باشه. کدتون رو دقیقا به این شکل به آخر فایل functions.php اضافه کنید. wp_enqueue_style('my_theme_style', get_template_directory_uri() . '/style.css', array(), '2'); 1 نقل قول لینک به ارسال
WordPress1 364 ارسال شده در شهریور 96 مالک گزارش بازنشر ارسال شده در شهریور 96 در 24 دقیقه قبل، mehran-b گفته است : تگ پایان PHP حتما نیاز نیست که اخر فایل های PHP باشه. کدتون رو دقیقا به این شکل به آخر فایل functions.php اضافه کنید. wp_enqueue_style('my_theme_style', get_template_directory_uri() . '/style.css', array(), '2'); مرسی مهران جان کدتون خطا نمیده. ولی کار هم نمی کنه کد من رو نمیشه به این فرمت تغییر داد؟ یعنی از echo استفاده بشه؟ add_action('admin_head', 'add_your_css'); function add_your_css() { echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('template_directory') . '/cigicigi-post-guest/cigicigi_style.css" />' . "\n"; echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('template_directory') . '/cigicigi-post-guest/bbcode/cigicigi-editor.css" />' . "\n"; } نقل قول لینک به ارسال
mehran-b 2385 ارسال شده در شهریور 96 گزارش بازنشر ارسال شده در شهریور 96 در هم اکنون، yaali گفته است : مرسی مهران جان کدتون خطا نمیده. ولی کار هم نمی کنه کد من رو نمیشه به این فرمت تغییر داد؟ یعنی از echo استفاده بشه؟ add_action('admin_head', 'add_your_css'); function add_your_css() { echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('template_directory') . '/cigicigi-post-guest/cigicigi_style.css" />' . "\n"; echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('template_directory') . '/cigicigi-post-guest/bbcode/cigicigi-editor.css" />' . "\n"; } آها شما میخواید به داشبورد وردپرس این استایل رو اضافه کنید؟ نقل قول لینک به ارسال
mehran-b 2385 ارسال شده در شهریور 96 گزارش بازنشر ارسال شده در شهریور 96 در 13 دقیقه قبل، mehran-b گفته است : آها شما میخواید به داشبورد وردپرس این استایل رو اضافه کنید؟ برای اضافه کردن به داشبورد وردپرس به این شکل عمل کنید. add_action('admin_enqueue_scripts', 'load_admin_style'); function load_admin_style() { wp_register_style('my_theme_style', get_template_directory_uri() . '/style.css', array(), '2'); wp_enqueue_style('my_theme_style', get_template_directory_uri() . '/style.css', array(), '2'); } نقل قول لینک به ارسال
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .