رفتن به مطلب

مشکل در پنل تنظیمات


پست های پیشنهاد شده

سلام

این پنل تنظیماتی هست که برای پوستم نوشتم

رو یه سایت دیگم همین هست و آپلود میکنه

ولی رو یه سایت دیگم کار نمیکنه

رو اون سایت اول که بود دقیقا همونو منتقل کردم رو سایت دوم ها

یعنی پوشه پوسته رو زیپ کردم و دانلود کردم و رو سایت جدید نصب کردم

قبلا هم همین کارو میکردم مشکلی نداشت پنل تنظیماتش ولی حالا

دکمه ذخیره رو میزنی هیچی رو سیو نگه نمیداره

نه چیزی که زدی آپلود بشه و نه چیزی که تایپ کردی

مشکلش چیه ؟


<?php
/**
* @package WordPress
* @subpackage Showcaser Theme
*/
//register settings
function showcaser_theme_settings_init(){
register_setting( 'showcaser_theme_settings', 'showcaser_theme_settings' );
}
//menu
function showcaser_add_settings_page() {
add_menu_page( __( 'Showcaser' ), __( 'تنظيمات پوسته' ), 'manage_options', 'showcaser-settings', 'showcaser_theme_settings_page');
}
add_action( 'admin_init', 'showcaser_theme_settings_init' );
add_action( 'admin_menu', 'showcaser_add_settings_page' );
//start settings page
function showcaser_theme_settings_page() {
global $slider_effects;
if ( ! isset( $_REQUEST['updated'] ) )
$_REQUEST['updated'] = false;
if(isset($_REQUEST['submit'])){


if (is_uploaded_file($_FILES['favicon']['tmp_name'])) {
$upload = wp_upload_bits($_FILES["favicon"]["name"], null, file_get_contents($_FILES["favicon"]["tmp_name"]));
$_REQUEST['showcaser_theme_settings']['favicon']= $upload['url'];
}

if (is_uploaded_file($_FILES['logo']['tmp_name'])) {
$upload = wp_upload_bits($_FILES["logo"]["name"], null, file_get_contents($_FILES["logo"]["tmp_name"]));
$_REQUEST['showcaser_theme_settings']['logo']= $upload['url'];
}

$showcaser_theme_settings = $_REQUEST['showcaser_theme_settings'];
$showcaser_theme_settings = $_REQUEST['showcaser_theme_settings'];
$options = get_option( 'showcaser_theme_settings' );
$showcaser_theme_settings = array_merge($options,$showcaser_theme_settings);
update_option( 'showcaser_theme_settings' , $showcaser_theme_settings);
}
?>
<div class="wrap">
<div id="icon-options-general" class="icon32"></div>
<h2><?php _e( 'تنظيمات پوسته' ) ?></h2>

<?php if ( false !== $_REQUEST['updated'] ) : ?>
<div class="updated fade"><p><strong><?php _e( 'Options saved' ); ?></strong></p></div>
<?php endif; ?>
<form method="post" action="" enctype="multipart/form-data">
<?php settings_fields( 'showcaser_theme_settings' ); ?>
<?php $options = get_option( 'showcaser_theme_settings' ); ?>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e( ' (favicon)' ); ?></th>
<td>
<input id="showcaser_theme_settings[favicon]" class="regular-text" type="file" size="36" name="favicon" /> <?php esc_attr_e( $options['favicon'] ); ?>
<br />
<label class="description abouttxtdescription" for="showcaser_theme_settings[favicon]"><?php _e( 'آپلود کنید یا آدرس ایکون را وارد کنید.' ); ?></label>
<br />
<img src="<?php esc_attr_e( $options['favicon'] ); ?>" />
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e( 'Logo' ); ?></th>
<td>
<input id="showcaser_theme_settings[logo]" class="regular-text" type="file" size="36" name="logo" /> <?php esc_attr_e( $options['logo'] ); ?>
<br />
<label class="description abouttxtdescription" for="showcaser_theme_settings[logo]"><?php _e( 'آپلود کنید یا آدرس تصویر لوگو را وارد کنید.' ); ?></label>
<br />
<img src="<?php esc_attr_e( $options['logo'] ); ?>" />
</td>
</tr>
<tr valign="top">
<th scope="row">About-Me:</th>
<td>
<input id="showcaser_theme_settings[About-Me]" class="regular-text" type="text" size="36" name="showcaser_theme_settings[About-Me]" value="<?php esc_attr_e( $options['About-Me'] ); ?>" />
</td>
</tr>
</table>
<p class="submit-changes">
<input name="submit" type="submit" class="button-primary" value="<?php _e( 'ذخیره تغییرات' ); ?>" />
</p>
</form>
</div><!-- END wrap -->
<?php
}
//sanitize and validate
function showcaser_options_validate( $input ) {
global $select_options, $radio_options;
if ( ! isset( $input['option1'] ) )
$input['option1'] = null;
$input['option1'] = ( $input['option1'] == 1 ? 1 : 0 );
$input['sometext'] = wp_filter_nohtml_kses( $input['sometext'] );
if ( ! isset( $input['radioinput'] ) )
$input['radioinput'] = null;
if ( ! array_key_exists( $input['radioinput'], $radio_options ) )
$input['radioinput'] = null;
$input['sometextarea'] = wp_filter_post_kses( $input['sometextarea'] );
return $input;
}
?>

لینک به ارسال

اگ مشکل از همین کدها باشه پس باید رو یه سایت دیگه هم همینطور باشه

پس چرا فقط رو این سایت مشکل داره ؟

لینک به ارسال

این رو تست کنید

<?php

/**

* @package WordPress

* @subpackage Showcaser Theme

*/

//register settings

function showcaser_theme_settings_init(){

register_setting( 'showcaser_theme_settings', 'showcaser_theme_settings' );

}

//menu

function showcaser_add_settings_page() {

add_menu_page( 'Showcaser', 'تنظيمات پوسته', 'manage_options', 'showcaser-settings', 'showcaser_theme_settings_page');

}

add_action( 'admin_init', 'showcaser_theme_settings_init' );

add_action( 'admin_menu', 'showcaser_add_settings_page' );

//start settings page

function showcaser_theme_settings_page() {

global $slider_effects;

if ( ! isset( $_REQUEST['updated'] ) )

$_REQUEST['updated'] = false;

if(isset($_REQUEST['submit'])){

if (is_uploaded_file($_FILES['favicon']['tmp_name'])) {

$upload = wp_upload_bits($_FILES["favicon"]["name"], null, file_get_contents($_FILES["favicon"]["tmp_name"]));

$_REQUEST['showcaser_theme_settings']['favicon']= $upload['url'];

}

if (is_uploaded_file($_FILES['logo']['tmp_name'])) {

$upload = wp_upload_bits($_FILES["logo"]["name"], null, file_get_contents($_FILES["logo"]["tmp_name"]));

$_REQUEST['showcaser_theme_settings']['logo']= $upload['url'];

}

$showcaser_theme_settings = $_REQUEST['showcaser_theme_settings'];

$showcaser_theme_settings = $_REQUEST['showcaser_theme_settings'];

$options = get_option( 'showcaser_theme_settings' );

$showcaser_theme_settings = array_merge($options,$showcaser_theme_settings);

update_option( 'showcaser_theme_settings' , $showcaser_theme_settings);

}

?>

<div class="wrap">

<div id="icon-options-general" class="icon32"></div>

<h2>تنظيمات پوسته</h2>

<?php if ( false !== $_REQUEST['updated'] ) : ?>

<div class="updated fade"><p><strong>Options saved</strong></p></div>

<?php endif; ?>

<form method="post" action="" enctype="multipart/form-data">

<?php settings_fields( 'showcaser_theme_settings' ); ?>

<?php $options = get_option( 'showcaser_theme_settings' ); ?>

<table class="form-table">

<tr valign="top">

<th scope="row"> (favicon)</th>

<td>

<input id="showcaser_theme_settings[favicon]" class="regular-text" type="file" size="36" name="favicon" /> <?php esc_attr_e( $options['favicon'] ); ?>

<br />

<label class="description abouttxtdescription" for="showcaser_theme_settings[favicon]">آپلود کنید یا آدرس ایکون را وارد کنید.</label>

<br />

<img src="<?php esc_attr_e( $options['favicon'] ); ?>" />

</td>

</tr>

<tr valign="top">

<th scope="row">Logo</th>

<td>

<input id="showcaser_theme_settings[logo]" class="regular-text" type="file" size="36" name="logo" /> <?php esc_attr_e( $options['logo'] ); ?>

<br />

<label class="description abouttxtdescription" for="showcaser_theme_settings[logo]">آپلود کنید یا آدرس تصویر لوگو را وارد کنید.</label>

<br />

<img src="<?php esc_attr_e( $options['logo'] ); ?>" />

</td>

</tr>

<tr valign="top">

<th scope="row">About-Me:</th>

<td>

<input id="showcaser_theme_settings[About-Me]" class="regular-text" type="text" size="36" name="showcaser_theme_settings[About-Me]" value="<?php esc_attr_e( $options['About-Me'] ); ?>" />

</td>

</tr>

</table>

<p class="submit-changes">

<input name="submit" type="submit" class="button-primary" value="ذخیره تغییرات" />

</p>

</form>

</div><!-- END wrap -->

<?php

}

//sanitize and validate

function showcaser_options_validate( $input ) {

global $select_options, $radio_options;

if ( ! isset( $input['option1'] ) )

$input['option1'] = null;

$input['option1'] = ( $input['option1'] == 1 ? 1 : 0 );

$input['sometext'] = wp_filter_nohtml_kses( $input['sometext'] );

if ( ! isset( $input['radioinput'] ) )

$input['radioinput'] = null;

if ( ! array_key_exists( $input['radioinput'], $radio_options ) )

$input['radioinput'] = null;

$input['sometextarea'] = wp_filter_post_kses( $input['sometextarea'] );

return $input;

}

?>

لینک به ارسال
  • 11 ماه بعد...

ممنون آقای فخار

وقتی میخوام آپلود کنم خط 34 یعنی :


$showcaser_theme_settings = array_merge($options,$showcaser_theme_settings);

ارور میده


Warning: array_merge(): Argument #1 is not an array in /home2/user/domains/test.com/public_html/wp-content/themes/theme-fa/admin/theme-admin.php on line 34

کار این خط چیه ؟ پاکش کردم درست شد مشکلی پیش نمیاد ؟


$showcaser_theme_settings = array_merge($options,$showcaser_theme_settings);

ویرایش شده توسط goldenfont
لینک به ارسال

این کد رو من پارسال دادم شما بعد از یک سال ارورش رو می گی من یادم نیست دیشب خوابیدم یا نه!!

باید از اول کدها را بخونم بعد از یک سال ارور رو مطرح کردن ده روز انتظار انصافه نه؟

لینک به ارسال

اون اکشن اجراست حذفش یعنی کار نکردن فرم

این دو خط را


$showcaser_theme_settings = $_REQUEST['showcaser_theme_settings'];
$showcaser_theme_settings = $_REQUEST['showcaser_theme_settings'];

به


$showcaser_theme_settings = $_REQUEST['showcaser_theme_settings'];
$showcaser_theme_settings = $showcaser_theme_settings[0];

تغییر بدید و تست کنید (لطفا قبل از یکسال نتیجه را بگید)

لینک به ارسال
  • 3 هفته بعد...

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع ...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

×
×
  • اضافه کردن...