رفتن به مطلب

عیب یابی عدم ذخیره تنظیمات هنگام انتشار


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

با سلام!

نمی دونم در مکان مناسب و عنوان مناسبی تاپیک زدن یا نه

اینا کدهای فانشن من هستن هنگام ازسال نوشته یا post type اطلاعات زمینه های دلخواه در شون ذخیره نمی شن ممنون میشم کمک کنید

http://www.pasteall.org/48225

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

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

<?php

// Add Custom PostType

add_action('init', 'dit_register');

function dit_register() {

$labels = array(

'name' => _x('Director', 'post type general name'),

'singular_name' => _x('Director Item', 'post type singular name'),

'add_new' => _x('Add New', 'dit item'),

'add_new_item' => __('Add New Director Item'),

'edit_item' => __('Edit Directorr Item'),

'new_item' => __('New Director Item'),

'view_item' => __(),

'search_items' => __('Search Director'),

'not_found' => __('Nothing Director'),

'post_type' => 'dit',

'not_found_in_trash' => __('Nong Director in Trash'),

'parent_item_colon' => ''

);

$args = array(

'labels' => $labels,

'public' => true,

'publicly_queryable' => true,

'show_ui' => true,

'query_var' => true,

'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',

'rewrite' => true,

'capability_type' => 'post',

'hierarchical' => false,

'menu_position' => null,

'supports' => array('title','editor','thumbnail')

);

register_post_type( 'dit' , $args );

flush_rewrite_rules();

}

// Add Custom Data Fields

add_action("admin_init", "admin_inits");

// add_meta_box( $id, $title, $callback, $page, $context, $priority );

function admin_inits(){

add_meta_box("year_birtha-meta", "Year arth", "year_birtha", "dit", "side", "low");

add_meta_box("tedad_filma-meta", "Films ", "tedad_filma", "dit", "side", "low");

add_meta_box("imdb_linksa-meta", "Imdb Links", "imdb_linksa", "dit", "side", "low");

}

function tedad_filma(){

global $post;

$custom = get_post_custom($post->ID);

$year_completed = $custom["tedad_filma"][0];

?>

<label>Many Films</label>

<input name="year_birtha" value="<?php echo $year_completed; ?>" />

<?php

}

function year_birtha(){

global $post;

$custom = get_post_custom($post->ID);

$year_birth = $custom["year_birtha"][0];

?>

<label>Year:</label>

<input name="year_birtha" value="<?php echo $year_birth; ?>" />

<?php

}

function imdb_linksa(){

global $post;

$custom = get_post_custom($post->ID);

$year_birth = $custom["imdb_linksa"][0];

?>

<label>Imdb Link:</label>

<input name="year_birtha" value="<?php echo $year_birth; ?>" />

<?php

}

// Save Details

add_action('save_post', 'save_detailsa');

function save_detailsa(){

global $post;

update_post_meta($post->ID, "tedad_filma", $_POST["tedad_filma"]);

update_post_meta($post->ID, "imdb_linksa", $_POST["imdb_linksa"]);

update_post_meta($post->ID, "year_birtha", $_POST["year_birtha"]);

}

add_action("manage_posts_custom_column", "dit_custom_columns");

add_filter("manage_edit-dit_columns", "dit_edit_columns");

function dit_edit_columns($columns){

$columns = array(

"title" => "Director Title",

"descriptiona" => "Description",

"tedada" => "Much Films",

"imdblinksa" => "Imdb",

"yeara" => "Year Birth",

);

return $columns;

}

function dit_custom_columns($column){

global $post;

switch ($column) {

case "yeara":

$custom = get_post_custom();

echo $custom["year_completedsa"][0];

break;

case "tedada":

$custom = get_post_custom();

echo $custom["tedad_filma"][0];

break;

case "imdblinksa":

$custom = get_post_custom();

echo $custom["imdb_linksa"][0];

break;

}

}

add_theme_support( 'post-thumbnails' ); if (function_exists('add_image_size')){

add_image_size( 'firsts', 180, 260, true);

add_image_size( 'serialup', 292, 120, true);

add_image_size( 'third-thumb', 215, 295, true);

add_image_size( 'four-thumb', 185, 185, true);

}

// Add Custom PostType

add_action('init', 'star_register');

function star_register() {

$labels = array(

'name' => _x('Super Star', 'post type general name'),

'singular_name' => _x('Super Star Item', 'post type singular name'),

'add_new' => _x('Add New', 'star item'),

'add_new_item' => __('Add New Super Star Item'),

'edit_item' => __('Edit Super Star Item'),

'new_item' => __('New Super Star Item'),

'view_item' => __(),

'search_items' => __('Search Super Star'),

'not_found' => __('Nothing found'),

'post_type' => 'star',

'not_found_in_trash' => __('Nothing found in Trash'),

'parent_item_colon' => ''

);

$args = array(

'labels' => $labels,

'public' => true,

'publicly_queryable' => true,

'show_ui' => true,

'query_var' => true,

'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',

'rewrite' => true,

'capability_type' => 'post',

'hierarchical' => false,

'menu_position' => null,

'supports' => array('title','editor','thumbnail')

);

register_post_type( 'star' , $args );

flush_rewrite_rules();

}

// Add Custom Data Fields

add_action("admin_init", "admin_init");

// add_meta_box( $id, $title, $callback, $page, $context, $priority );

function admin_init(){

add_meta_box("year_birth-meta", "Year Birth", "year_birth", "star", "side", "low");

add_meta_box("tedad_film-meta", "Films ", "tedad_film", "star", "side", "low");

add_meta_box("imdb_links-meta", "Imdb Links", "imdb_links", "star", "side", "low");

add_meta_box("credits_meta", "Design & Build Credits", "credits_meta", "star", "normal", "low");

}

function tedad_film(){

global $post;

$custom = get_post_custom($post->ID);

$year_completed = $custom["tedad_film"][0];

?>

<label>Many Films</label>

<input name="year_completed" value="<?php echo $year_completed; ?>" />

<?php

}

function year_birth(){

global $post;

$custom = get_post_custom($post->ID);

$year_birth = $custom["year_birth"][0];

?>

<label>Year:</label>

<input name="year_birth" value="<?php echo $year_birth; ?>" />

<?php

}

function imdb_links(){

global $post;

$custom = get_post_custom($post->ID);

$year_birth = $custom["imdb_links"][0];

?>

<label>Imdb Link:</label>

<input name="year_birth" value="<?php echo $year_birth; ?>" />

<?php

}

// Save Details

add_action('save_post', 'save_details');

function save_details(){

global $post;

update_post_meta($post->ID, "tedad_film", $_POST["tedad_film"]);

update_post_meta($post->ID, "imdb_links", $_POST["imdb_links"]);

update_post_meta($post->ID, "year_birth", $_POST["year_birth"]);

}

add_action("manage_posts_custom_column", "star_custom_columns");

add_filter("manage_edit-portfolio_columns", "star_edit_columns");

function star_edit_columns($columns){

$columns = array(

"title" => "Super Star Title",

"description" => "Description",

"tedad" => "Much Films",

"imdblinks" => "Imdb",

"year" => "Year Birth",

"designers" => "Designer"

);

return $columns;

}

function star_custom_columns($column){

global $post;

switch ($column) {

case "description":

the_excerpt();

break;

case "year":

$custom = get_post_custom();

echo $custom["year_completed"][0];

break;

case "tedad":

$custom = get_post_custom();

echo $custom["tedad_film"][0];

break;

case "imdblinks":

$custom = get_post_custom();

echo $custom["imdb_links"][0];

break;

}

} ?>

لینک به ارسال

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

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

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

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

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

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

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

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

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