رفتن به مطلب

عکسها در تنظیمات


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

سلام ، دوستان چجوری میتونم کاری کنم ک مثلا چندتا عکسهای پوسته از قسمت تنظیمات پوسته بشه تغییرشون داد ؟

  • امتیاز 1
لینک به ارسال

فهمیدم چجوری اینکارو کنم

ولی ببینید مثلا برای فاو آیکون ، اینطوری اومده :

<tr valign="top">

<th scope="row"><?php _e( 'ایکون کنار نوار آدرس (favicon)' ); ?></th>

<td>

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

<br />

<label class="description abouttxtdescription" for="showcaser_theme_settings[favicon]"><?php _e( 'آپلود کنید یا آدرس ایکون را وارد کنید.' ); ?></label>

</td>

</tr>

برای هدر باید چی نوشت ؟؟

  • امتیاز 1
لینک به ارسال

آقا اینهارو خوندم ولی متوجه نشدم

میشه ساده تر توضیح بدید ؟

<tr valign="top">
<th scope="row"><?php _e( 'ایکون کنار نوار آدرس (favicon)' ); ?></th>
<td>
<input id="showcaser_theme_settings[favicon]" class="regular-text" type="text" size="36" name="showcaser_theme_settings[favicon]" value="<?php esc_attr_e( $options['favicon'] ); ?>" />
<br />
<label class="description abouttxtdescription" for="showcaser_theme_settings[favicon]"><?php _e( 'آپلود کنید یا آدرس ایکون را وارد کنید.' ); ?></label>
</td>
</tr>

کدهای بالارو برای تغییر هدر میخوام

  • امتیاز 1
لینک به ارسال

کد کامل را قرار دهید

در لینکهای آموزشی خیلی ساده توضح داده شده اند

  • امتیاز 3
لینک به ارسال

این کل کدهای تنظیمات هستش


<?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;
?>

<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="options.php">

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

<table class="form-table">

<tr valign="top">
<th scope="row">همکاران ساخت پوسته</th>
<td><p>پوسته <a href="[url="http://www.wpexplorer.com/showcaser-wordpress-theme.html%22>Showcaser</a>"]http://www.wpexplore...">Showcaser</a>[/url] ساخته شده توسط AJ Clarke <a href="[url="http://www.wpexplorer.com%22><strong>WPExplorer.com</strong></a></p>"]http://www.wpexplore...strong></a></p>[/url]
ويرايش و ترجمه پوسته توسط گروه <a href="[url="http://rooeen.com/"]http://rooeen.com/"[/url] style="color: rgb(0, 204, 204);"><strong>رويين</strong></a>
</td>
</tr>

<tr valign="top">
<th scope="row">لایک زدن صفحه سازنده پوسته</th>
<td><div id="fb-root"></div><script src="[url="http://connect.facebook.net/en_US/all.js#appId=215260205165212&xfbml=1%22></script><fb:like"]http://connect.faceb...script><fb:like[/url] href="[url="http://www.wpexplorer.com/"]http://www.wpexplorer.com/"[/url] send="true" layout="button_count" width="450" height="40" show_faces="false" font=""></fb:like></td>
</tr>

<tr valign="top">
<th scope="row"><?php _e( 'ایکون کنار نوار آدرس (favicon)' ); ?></th>
<td>
<input id="showcaser_theme_settings[favicon]" class="regular-text" type="text" size="36" name="showcaser_theme_settings[favicon]" value="<?php esc_attr_e( $options['favicon'] ); ?>" />
<br />
<label class="description abouttxtdescription" for="showcaser_theme_settings[favicon]"><?php _e( 'آپلود کنید یا آدرس ایکون را وارد کنید.' ); ?></label>
</td>
</tr>

<tr valign="top">
<th scope="row"><?php _e( 'لوگو' ); ?></th>
<td>
<input id="showcaser_theme_settings[logo]" class="regular-text" type="text" size="36" name="showcaser_theme_settings[logo]" value="<?php esc_attr_e( $options['logo'] ); ?>" />
<br />
<label class="description abouttxtdescription" for="showcaser_theme_settings[logo]"><?php _e( 'آپلود کنید یا آدرس تصویر لوگو را وارد کنید.' ); ?></label>
</td>
</tr>

<tr valign="top">
<th scope="row"><?php _e( 'کد آمارگیر آنالیزگر' ); ?></th>
<td>
<textarea id="showcaser_theme_settings[analytics]" class="regular-text" name="showcaser_theme_settings[analytics]" rows="5" cols="45"><?php esc_attr_e( $options['analytics'] ); ?></textarea>
<br />
<label class="description" for="showcaser_theme_settings[analytics]"><?php _e( 'کد آنالیزگر را وارد کنید' ); ?></label>
</td>
</tr>

<tr valign="top">
<th scope="row">دانلود پوسته های بیشتر</th>
<td>
<a href="[url="http://rooeen.com/category/wordpress/wp-themes"]http://rooeen.com/ca...ress/wp-themes"[/url] style="text-decoration:none;">پوسته های وردپرس رایگان</a>
</td>
</tr>

</table>
<p class="submit-changes">
<input 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;
}

?>

  • امتیاز 1
لینک به ارسال

برای قرار دادن کد در انجمن از تگ code (تصویر <> ) استفاده کنید

برای افزودن به بخش تنظیمات:


<tr valign="top">
<th scope="row">header:</th>
<td>
<input id="showcaser_theme_settings[header_img]" class="regular-text" type="text" size="36" name="showcaser_theme_settings[header_img]" value="<?php esc_attr_e( $options['header_img'] ); ?>" />
</td>
</tr>

فراخوانی آدرس تصویر:


<?php
$options = get_option( 'showcaser_theme_settings' );
echo $options['header_img'];
?>

  • امتیاز 2
لینک به ارسال

خیلی ممنون ازتون ، حالا اگ بخوام کاری کنم که اونجا ک آدرس وارد میکنی ی دکمه Browse داشته باشه برای آپلود عکس و قرار گرفتنش بجای هدر ، باید چیکار کنم ؟

لینک به ارسال

گوگل ترسنلیت میتونه فارسی کنه ;)

بقیه موارد هم کد هست و باید طبق توضیحات در پوسته جاسازی کنید

لینک به ارسال

اینقد سخته بهم توضیح بدید ؟

بابا من فارسی میگید شما بزور میفهمم ، : (

اگ ممکنه بهم بگید خیلی ممنون

لینک به ارسال

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


<script >
jQuery(document).ready(function($){
var _custom_media = true,
_orig_send_attachment = wp.media.editor.send.attachment;
$('.uploader .button').click(function(e) {
var send_attachment_bkp = wp.media.editor.send.attachment;
var button = $(this);
var id = button.attr('id').replace('_button', '');
_custom_media = true;
wp.media.editor.send.attachment = function(props, attachment){
if ( _custom_media ) {
$("#"+id).val(attachment.url);
} else {
return _orig_send_attachment.apply( this, [props, attachment] );
};
}
wp.media.editor.open(button);
return false;
});
$('.add_media').on('click', function(){
_custom_media = false;
});
});
</script>
<div class="uploader">
<input type="text" name="settings[_unique_name]" id="_unique_name" />
<input class="button" name="_unique_name_button" id="_unique_name_button" value="Upload" />
</div>

  • امتیاز 3
لینک به ارسال

این کد در هد:

<?php wp_enqueue_script('media-upload'); ?>

این در بدنه سایت:

<div class="uploader">
<input type="text" name="settings[_unique_name]" id="_unique_name" />
<input class="button" name="_unique_name_button" id="_unique_name_button" value="Upload" />
</div>

اینهم جاوااسکریپت:

jQuery(document).ready(function($){
var _custom_media = true,
_orig_send_attachment = wp.media.editor.send.attachment;

$('.stag-metabox-table .button').click(function(e) {
var send_attachment_bkp = wp.media.editor.send.attachment;
var button = $(this);
var id = button.attr('id').replace('_button', '');
_custom_media = true;
wp.media.editor.send.attachment = function(props, attachment){
if ( _custom_media ) {
$("#"+id).val(attachment.url);
} else {
return _orig_send_attachment.apply( this, [props, attachment] );
};
}

wp.media.editor.open(button);
return false;
});

$('.add_media').on('click', function(){
_custom_media = false;
});
});

  • امتیاز 2
لینک به ارسال

خیلی متشکر و سپاسگزارم

فقط ی سوال ؟

کدهای جاوارو کجا بزارم ؟

و منظور از بدنه کجاست ؟

و کدی هم ک برای هدر گفتید همون فراخوانیه ؟

لینک به ارسال

بخش تنظیمات پوسته رو خودتون نوشتید؟

همان جا قرار دهید

بخش header رو هم در فایل functions قرار دهید

  • امتیاز 1
لینک به ارسال

بخش تنظیمات رو کجا نوشتید؟

غیر functions جای بهتری نیست!

جاوا هم با همان html یک جا قرار دهید

مکان خاصی ندارد

  • امتیاز 1
لینک به ارسال

من جاواهارو قرار دادم

و در تم ادمین هم به این شکل اون کد رو گذاشتم :


<tr valign="top">
<th scope="row">هدر پوسته:</th>
<td>
<input id="showcaser_theme_settings[header_img]" class="regular-text" type="text" size="36" name="showcaser_theme_settings[header_img]" value="<?php esc_attr_e( $options['header_img'] ); ?>" /><div class="uploader">
<input type="text" name="settings[_unique_name]" id="_unique_name" />
<input class="button" name="_unique_name_button" id="_unique_name_button" value="Upload" />
</div>
</td>
</tr>

اما در قسمت تنظمات به این شکل میاد و با زدن دکمه آپلود هیچ اتفاقی نمی افته :

88.PNG

لینک به ارسال

لطفا برای ارسال دیدگاه وارد شوید

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



ورود به حساب کاربری
×
×
  • اضافه کردن...