PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : فراخوانی js در فانکشن وردپرس



sonly
March 7th, 2018, 16:32
با سلام
دوستان یه قالب html و دارم به وردپرس تبدیل میکنم و مشکلی که دارم اینه نمیتونم فایل های js رو در فانکشن فراخوانی کنم و با فراخوانی فایل ها لود نمیشن.

آموزش های تحت وبم انجام دادم اما اصلا پاسخ نمیده.

نام فایل های بنده به این شکله:

custom
jquery.adipoli.min
jquery.easytabs.min
jquery.fancybox-1.3.4.pack
jquery.gmap.min
jquery.isotope.min
jquery.min
respond.min




فایل های css بنده به صورت کامل و درست لود میشن و فقط فایل های js این مشکل و دارند.

ممنون





فایل کامل قالب بارگذاری شد.
ممنون میشم اگر کسی میتونه ی نگاهی بندازه در صورت دونستن مشکل کمک کنه.
:53::53::53:

sonly
March 7th, 2018, 18:03
اینم کدی که برای css و js استفاده می کنم:




function myptest_script() { wp_enqueue_style('style', get_template_directory_uri() . '/css/style.css', array(), '1', 'all' ); wp_enqueue_style('reset', get_template_directory_uri() . '/css/reset.css', array(), '1', 'all' ); wp_enqueue_style('fancybox', get_template_directory_uri() . '/css/fancybox.css', array(), '1', 'all' );
wp_enqueue_script('custom', get_template_directory_uri().'/js/custom.js', array(), false ); wp_enqueue_script('respond', get_template_directory_uri().'/js/respond.min.js', array(), false ); }add_action( 'wp_enqueue_scripts', 'myptest_script' );

function myptest_scripts() { wp_register_script('custom', plugins_url('js/custom.js', __FILE__), array('jquery'), true);wp_enqueue_script('custom');
wp_register_script('jquery.adipoli.min', plugins_url('js/jquery.adipoli.min.js', __FILE__), array('jquery'), true);wp_enqueue_script('jquery.adipoli.min');
wp_register_script('jquery.easytabs.min', plugins_url('js/jquery.easytabs.min.js', __FILE__), array('jquery'), true);wp_enqueue_script('jquery.easytabs.min');
wp_register_script('jquery.fancybox-1.3.4.pack', plugins_url('js/jquery.fancybox-1.3.4.pack.js', __FILE__), array('jquery'), true);wp_enqueue_script('jquery.fancybox-1.3.4.pack');
wp_register_script('jquery.gmap.min', plugins_url('js/jquery.gmap.min.js', __FILE__), array('jquery'), true);wp_enqueue_script('jquery.gmap.min');
wp_register_script('jquery.isotope.min', plugins_url('js/jquery.isotope.min.js', __FILE__), array('jquery'), true);wp_enqueue_script('jquery.isotope.min');
wp_register_script('jquery.min', plugins_url('js/jquery.min.js', __FILE__), array('jquery'), true);wp_enqueue_script('jquery.min');
wp_register_script('respond.min', plugins_url('js/respond.min.js', __FILE__), array('jquery'), true);wp_enqueue_script('respond.min');
}add_action( 'wp_enqueue_scripts', 'myptest_scripts' );

T.Toosi
March 7th, 2018, 19:50
باسلام، کد هایی که قرار دادید مشکلی ندارند همچنین JS ها در فوتر بارگذاری می شود، در صورتی که داخل فوتر هم نبود احتمالا روی اکشن wp_enqueue_scripts توسط افزونه یا کد های داخل function *****ی قرار گرفته است.

sonly
March 7th, 2018, 20:09
باسلام، کد هایی که قرار دادید مشکلی ندارند همچنین JS ها در فوتر بارگذاری می شود، در صورتی که داخل فوتر هم نبود احتمالا روی اکشن wp_enqueue_scripts توسط افزونه یا کد های داخل function *****ی قرار گرفته است.
ممنون ولی هیچ افزونه ای نصب نیست.
این کدای فانکشنه قالبمه:





<?php function myptest_script() { wp_enqueue_style('style', get_template_directory_uri() . '/css/style.css', array(), '1', 'all' ); wp_enqueue_style('reset', get_template_directory_uri() . '/css/reset.css', array(), '1', 'all' ); wp_enqueue_style('fancybox', get_template_directory_uri() . '/css/fancybox.css', array(), '1', 'all' ); wp_enqueue_script('custom', get_template_directory_uri().'/js/custom.js', array(), false ); wp_enqueue_script('respond', get_template_directory_uri().'/js/respond.min.js', array(), false ); } add_action( 'wp_enqueue_scripts', 'myptest_script' );
function myptest_scripts() { wp_register_script('custom', plugins_url('js/custom.js', __FILE__), array('jquery'), true);wp_enqueue_script('custom');wp_register_scri pt('jquery.adipoli.min', plugins_url('js/jquery.adipoli.min.js', __FILE__), array('jquery'), true);wp_enqueue_script('jquery.adipoli.min');wp_r egister_script('jquery.easytabs.min', plugins_url('js/jquery.easytabs.min.js', __FILE__), array('jquery'), true);wp_enqueue_script('jquery.easytabs.min');wp_ register_script('jquery.fancybox-1.3.4.pack', plugins_url('js/jquery.fancybox-1.3.4.pack.js', __FILE__), array('jquery'), true);wp_enqueue_script('jquery.fancybox-1.3.4.pack');wp_register_script('jquery.gmap.min', plugins_url('js/jquery.gmap.min.js', __FILE__), array('jquery'), true);wp_enqueue_script('jquery.gmap.min');wp_regi ster_script('jquery.isotope.min', plugins_url('js/jquery.isotope.min.js', __FILE__), array('jquery'), true);wp_enqueue_script('jquery.isotope.min');wp_r egister_script('jquery.min', plugins_url('js/jquery.min.js', __FILE__), array('jquery'), true);wp_enqueue_script('jquery.min');wp_register_ script('respond.min', plugins_url('js/respond.min.js', __FILE__), array('jquery'), true);wp_enqueue_script('respond.min');}add_action ( 'wp_enqueue_scripts', 'myptest_scripts' );



/*---------------------------------------------------ساخت تنظیمات----------------------------------------------------*/function theme_settings_init(){ register_setting( 'theme_settings', 'theme_settings' );wp_enqueue_style("panel_style", get_template_directory_uri()."/panel.css", false, "1.0", "all");wp_enqueue_script("panel_script", get_template_directory_uri()."/panel_script.js", false, "1.0");
register_setting( 'theme_settings', 'theme_settings' );} /* ---------------------------------------------------------تعریف آرایه های تنظیمات----------------------------------------------------------- */ $theme_options = array ( array( "name" =>" تنظیمات" . $themename, "type" => "title"), /* --------------------------------------------------------- بخش تنظیمات عمومی ----------------------------------------------------------- */ array( "name" => "عمومی", "type" => "section"), array( "type" => "open"), array( "name" => "لوگو سایت", "desc" => "عکس لوگو را وارد کنید", "id" => "logo", "type" => "upload", "std" => ""), array( "name" => "عنوان سایت", "desc" => "عنوان سایت شما", "id" => "iname", "type" => "text", "std" => ""), array( "name" => "توضیحات مختصر", "desc" => "توضیحات مختصر سایت شما", "id" => "ides", "type" => "text", "std" => ""), array( "name" => "متن کپی رایت فوتر", "desc" => "متن کپی رایت را وارد کنید", "id" => "des_full", "type" => "textarea", "std" => ""), array( "name" => "آیکن سایت", "desc" => "آیکن سایت باید در اندازه 16*16 باشد ", "id" => $shortname."_favicon", "type" => "image_upload", "std" => get_bloginfo('url') ."/images/favicon.ico"), array( "type" => "close"), /* --------------------------------------------------------- شخصینظیمات عمومی ----------------------------------------------------------- */ array( "name" => "اطلاعات شخصی", "type" => "section"), array( "type" => "open"), array( "name" => "نام", "desc" => "نام شما", "id" => "imyneme", "type" => "text", "std" => ""), array( "name" => "تاریخ تولد", "desc" => "تاریخ تولد شما", "id" => "itavalod", "type" => "text", "std" => ""), array( "name" => "آدرس", "desc" => "آدرس شما", "id" => "iaddres", "type" => "text", "std" => ""), array( "name" => "ایمیل", "desc" => "ایمیل خود را بنویسید", "id" => "imail", "type" => "text", "std" => ""), array( "name" => "تلفن", "desc" => "شماره تلفن همراه", "id" => "iphone", "type" => "text", "std" => ""), array( "name" => "تلگرام", "desc" => "آی دی تلگرام", "id" => "itelegram", "type" => "text", "std" => ""), array( "type" => "close"),
/* --------------------------------------------------------- بخش تنظیمات صفحه نخست ----------------------------------------------------------- */ array( "name" => "صفحه نخست", "type" => "section"), array( "type" => "open"), array( "name" => "مطالب ویژه صفحه نخست", "desc" => "دسته مطالب ویژه را انتخاب کنید", "id" => $shortname."_feat_cat", "type" => "select", "options" => $all_cats, "std" => "انتخاب دسته"), array( "type" => "close"), /* --------------------------------------------------------- بخش تنظیمات فوتر ----------------------------------------------------------- */ array( "name" => "فوتر", "type" => "section"), array( "type" => "open"), array( "name" => "متن کپی رایت فوتر", "desc" => "متن کپی رایت را وارد کنید", "id" => $shortname."footer_text", "type" => "textarea", "std" => ""), array( "type" => "close") ); /*---------------------------------------------------افزودن تنظیمات به منو پیشخوان----------------------------------------------------*/function add_settings_page() {add_menu_page( __( 'تنظیمات' . 'wpschool' ), __( 'تنظیمات' . 'wpschool' ), 'manage_options', 'settings', 'theme_settings_page');} add_action( 'admin_init', 'theme_settings_init' );add_action( 'admin_menu', 'add_settings_page' );/*---------------------------------------------------خروجی پنل تنظیمات----------------------------------------------------*/function theme_settings_page() { global $themename,$theme_options; $i=0; $message=''; if ( 'save' == $_REQUEST['action'] ) { foreach ($theme_options as $value) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } foreach ($theme_options as $value) { if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } } $message='saved'; } else if( 'reset' == $_REQUEST['action'] ) { foreach ($theme_options as $value) { delete_option( $value['id'] ); } $message='reset'; } ?> <div class="wrap options_wrap"> <div id="icon-options-general"></div> <h2><?php _e( ' تنظیمات قالب' ) //your admin panel title ?></h2> <?php if ( $message=='saved' ) echo '<div class="updated settings-error" id="setting-error-settings_updated"> <p>تنظیمات قالب '.$themename.' ذخیره شد.</strong></p></div>'; if ( $message=='reset' ) echo '<div class="updated settings-error" id="setting-error-settings_updated"> <p>'.$themename.' settings reset.</strong></p></div>'; ?> <ul> <li>قالب وردپرس : تست</li> </ul> <div class="content_options"> <form method="post"> <?php foreach ($theme_options as $value) { switch ( $value['type'] ) { case "open": ?> <?php break; case "close": ?> </div> </div><br /> <?php break; case "title": ?> <div class="message"> <p>برای باز شدن تنظیمات هر بخش روی نام بخش مورد نظر کلیک کنید</p> </div> <?php break; case 'text': ?> <div class="option_input option_text"> <label for="<?php echo $value['id']; ?>"> <?php echo $value['name']; ?></label> <input id="" type="<?php echo $value['type']; ?>" name="<?php echo $value['id']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id']) ); } else { echo $value['std']; } ?>" /> <small><?php echo $value['desc']; ?></small> <div class="clearfix"></div> </div> <?php break; case 'textarea': ?> <div class="option_input option_textarea"> <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label> <textarea name="<?php echo $value['id']; ?>" rows="" cols=""><?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id']) ); } else { echo $value['std']; } ?></textarea> <small><?php echo $value['desc']; ?></small> <div class="clearfix"></div> </div> <?php break; case 'select': ?> <div class="option_input option_select"> <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label> <select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>"> <?php foreach ($value['options'] as $option) { ?> <option <?php if (get_settings( $value['id'] ) == $option) { echo 'selected="selected"'; } ?>><?php echo $option; ?></option> <?php } ?> </select> <small><?php echo $value['desc']; ?></small> <div class="clearfix"></div> </div> <?php break; case "checkbox": ?> <div class="option_input option_checkbox"> <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label> <?php if(get_option($value['id'])){ $checked = "checked=\"checked\""; }else{ $checked = "";} ?> <input id="<?php echo $value['id']; ?>" type="checkbox" name="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> /> <small><?php echo $value['desc']; ?></small> <div class="clearfix"></div> </div> <?php break; case "section": $i++; ?> <div class="input_section"> <div class="input_title"> <h3><img src="<?php echo get_template_directory_uri();?>/images/options.png" alt="">&nbsp;<?php echo $value['name']; ?></h3> <span class="submit"><input name="save<?php echo $i; ?>" type="submit" class="button-primary" value="ذخیره" /></span> <div class="clearfix"></div> </div> <div class="all_options"> <?php break; } }?> <input type="hidden" name="action" value="save" /> </form> <form method="post"> <p class="submit"> <input name="reset" type="submit" value="بازنشانی تنظیمات" /> <input type="hidden" name="action" value="reset" /> </p> </form> </div> <div class="footer-credit"> <p>ا <a title=" " href="********" target="_blank" > ********* </a> </p> </div> </div> <?php}



ممنون میشم اگر میتونید یه نگاهی بهشون بندازید.

sonly
March 8th, 2018, 10:47
آپ ...

- - - Updated - - -

فایل کامل قالب بارگذاری شد.
ممنون میشم اگر کسی میتونه ی نگاهی بندازه در صورت دونستن مشکل کمک کنه.
:53::53::53:

sonly
March 8th, 2018, 12:12
اینم تصویر console فایرفاکس:

37700

sonly
March 8th, 2018, 13:22
دوستان ی سری تغیرات دادم الان تو فایرفاکس لود میشه ولی کروم خیر