رفتن به مطلب

مشکل در ارسال پست مهمان


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

سلام.من افزونه ارسال مطلب مهمان رو شخصی سازی کردم و به صورت زیر تبدیل کردم

http://karaj68.ir/?page_id=21

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

میخواستم ببینم مشکل از چی می تونه باشه؟!!

لینک به ارسال

خب مشکل چیه؟

ارور چیه ؟

در همین لینک که دادم اینجا بعضی از دوستان میگن وقتی آگهی درج میکنیم پیغام تایید نمیاد و کلا آگهی ارسال نمیشه در صورتی که خودم که انجام میدم درسته!!!

دوما به نظر شما مشکل از چی می تونه باشه؟!!

لینک به ارسال

برای دریافت پیغام تایید ساختار پیوند یکتاتون رو به نام پست تغییر بدید

تستش کردم الان مشکلی نداره و باید یک مطلب به عنوان تست اضافه شده باشه

لینک به ارسال

برای دریافت پیغام تایید ساختار پیوند یکتاتون رو به نام پست تغییر بدید

تستش کردم الان مشکلی نداره و باید یک مطلب به عنوان تست اضافه شده باشه

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

لینک به ارسال

ممکنه از فارسی بودن هم باشه خوب نامک مطلب را انگلیسی بگذارید

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

http://karaj68.ir/agahi/

لینک به ارسال

الان تو مقدار برگشتی ایراد داره

احتمالا اکشن فرمتون توی صفحه ی فرم و همین هم دلیل ارای نادرستشه

لینک به ارسال


<?php
/*
* Plugin Name: Guest Post With Payline
* Description: A simple and secure Guest Post/Blogging Plugin allow your visitors to submit contents for your site and published post after pay in payline website.
* Version: 1
* Author: hasan movahed
* Author URI: http://www.wallfa.com/
*/
/* include needed files
usage :
[guestpost image="true|false" ping="closed|open" comment="closed|open" redirect="URL to redirect after post submitted"]
[listguestspost redirect="URL to redirect after post published"]
*/
if ( ! defined( 'ABSPATH' ) ) {
exit();
} else {
require_once( ABSPATH . 'wp-includes/pluggable.php' );
}
include_once( 'inc/payline.class.php' );
$payline = new Payline;

/* GET option for use in class */
if ( get_option( 'wallfa_api' ) ) {
$payline->api = get_option( 'wallfa_api' );
}
if ( get_option( 'wallfa_price' ) ) {
$payline->Price = ( float ) get_option( 'wallfa_price' );
}

/* Add menu in admin wordpress */
add_action( 'admin_menu', 'baw_create_menu' );
function baw_create_menu() {
add_menu_page( 'تنظیمات پلایگن انتشار به ازای پرداخت', 'پست میهمان ', 'administrator', __file__,
'wallfa_settings_page'
);
add_action( 'admin_init', 'register_mysettings' );
}
function register_mysettings() {
register_setting( 'wallfa-settings-group', 'wallfa_api' );
register_setting( 'wallfa-settings-group', 'wallfa_price' );
}
/* admin page function */
function wallfa_settings_page() {
?>
<div class="wrap">
<h2>پست میهمان </h2>
<form method="post" action="options.php">
<?php
settings_fields( 'wallfa-settings-group' );
do_settings_sections( 'wallfa-settings-group' );
?>
<table class="form-table">
<tr valign="top">
<th scope="row">ای پی آی ، پی لاین خود را از درگاه گرفته و در اینجا وارد نمائید</th>
<td><input type="text" name="wallfa_api" value="<?php
echo esc_attr( get_option( 'wallfa_api' ) );
?>"/></td>
</tr>
<tr valign="top">
<th scope="row">قیمت را وارد نمائید</th>
<th scope="row">واحد ریال می باشد</th>
<td><input type="text" name="wallfa_price" value="<?php
echo esc_attr( get_option( 'wallfa_price' ) );
?>"/></td>
</tr>
</table>
<?php
submit_button();
?>
</form>
</div>
<?php
}

add_shortcode( 'guestspost', 'guestspostwallfa' );
function guestspostwallfa( $atts ) {
global $payline;
extract( shortcode_atts( array(
'image' => 0,
'ping' => 'closed',
'comment' => 'closed',
'redirect' => get_bloginfo( 'home' ),
), $atts
)
);
$retVal = '<form class="wallfa-Guest-Post" action="" method="post" enctype="multipart/form-data" autocomplete="on">';
$retVal .= '<p>فیلد هایی که با ستاره مشخص شده پر نمائید</p>';
$retVal .= '<div style="width:580px;border:1px solid #eeeeee;float:right;">';
$retVal .= ' <div style="width:578px;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'دسته بندی:*' ) . ' </strong>';
$retVal .= wp_dropdown_categories( 'show_option_none=هیچ کدام&tab_index=4&taxonomy=category&hide_empty=0&echo=0' );
$retVal .= ' <input type="hidden" required="required" value="0' . $cat .
'" name="category"><br />';
$retVal .= ' </div>';
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'موضوع</strong><strong>:*' ) .
'</strong><br />';
$retVal .= ' <input type="text" name="title" size="30" maxlength="120" required="required" placeholder="' .
__( 'مثال: فروش آپارتمان' ) . '" autofocus />';
$retVal .= ' </div>';
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'ایمیل:' ) .
'</strong><br />';
$retVal .= ' <input type="text" name="email" size="30" maxlength="120" placeholder="' .
__( 'example@yahoo.com' ) . '" autofocus />';
$retVal .= ' </div>';
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'تلفن:*' ) .
'</strong><br />';
$retVal .= ' <input type="text" name="phone" size="30" maxlength="120" required="required" placeholder="' .
__( 'شماره تماس خود ار اینجا بنویسید' ) . '" autofocus />';
$retVal .= ' </div>';
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'متراژ:*' ) .
'</strong><br />';
$retVal .= ' <input type="text" name="author" size="30" maxlength="120" required="required" placeholder="' .
__( 'متراژ ملک را وارد کنید.' ) . '" autofocus />';
$retVal .= ' </div>';
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'منطقه:*' ) .
'</strong><br />';
$retVal .= ' <input type="text" name="city" size="30" maxlength="120" required="required" placeholder="' .
__( 'مثال : گلشهر' ) . '" autofocus />';
$retVal .= ' </div>';
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'قیمت (تومان):*' ) .
'</strong><br />';
$retVal .= ' <input type="text" name="price" size="30" maxlength="120" required="required" placeholder="' .
__( 'به ازای هر متر' ) . '" autofocus />';
$retVal .= ' </div>';
/* Post Textbox Starts */
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'توضیحات:' ) . '</strong><br />';
$retVal .= wp_nonce_field( 'Wallfa_Post_Form', 'Wallfa_Post_Form_nonce' );
ob_start();
wp_editor( '', 'description', array(
"wpautop" => true,
"media_buttons" => ( $image ),
"textarea_name" => "description",
"textarea_rows" => "4",
"drag_drop_upload" => false
)
);
$retVal .= ob_get_clean();
$retVal .= ' </div>';
/* Post Textbox Ends */
$retVal .= '<div class="featured-img" style="float:right;">
<strong>' . __( 'وارد کردن عکس :' ) . '</strong><br />
<input name="featured-img[]" type="file" id="featured-img" multiple="multiple"><br>
</div>';
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <input type="hidden" name="tags" size="60" autocomplete="on">';
$retVal .= ' </div>';
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <input type="hidden" value="' . $redirect . '" name="redirect">';
$retVal .= ' <input type="hidden" value="' . $ping . '" name="ping">';
$retVal .= ' <input type="hidden" value="' . $comment . '" name="comment">';
$retVal .= ' <input type="hidden" value="' . get_home_url() . ' name="siteurl">';
$retVal .= ' <input style="float:right;border: 1px outset #CCC;padding: 3px;background: lightgrey;border-radius: 7px;height: 40px;" type="submit" value="' . __( '✓ ارسال نوشته',
'SLB-Guest-Post-Simplified'
) . '"><br />';
$retVal .= ' </div>';
$retVal .= '</div>';
$retVal .= '</form>';

/* this code help for create a draft or all status post */
if ( isset( $_POST['Wallfa_Post_Form_nonce'] ) || wp_verify_nonce( $_POST['Wallfa_Post_Form_nonce'],
'Wallfa_Post_Form'
)
) {
function insert_attachment( $file_handler, $post_id, $setthumb ) {
// check to make sure its a successful upload
if ( $_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK ) {
__return_false();
}
require_once( ABSPATH . "wp-admin" . '/includes/image.php' );
require_once( ABSPATH . "wp-admin" . '/includes/media.php' );
$attach_id = media_handle_upload( $file_handler, $post_id );
if ( $setthumb ) {
update_post_meta( $post_id, '_thumbnail_id', $attach_id );
}
return $attach_id;
}
$Post_Title = $_POST["title"];
$Post_Content = $_POST["description"];
$Post_Tags = $_POST["title"];
$Post_Category = $_POST["category"];
$Success_Redirect = $_POST["redirect"];
$Post_Ping = $_POST["ping"];
$Post_Comment = $_POST["comment"];
$author = $_POST['author'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$city = $_POST['city'];
$price = $_POST['price'];
global $current_user;
get_currentuserinfo();

$new_post = array(
'post_title' => sanitize_text_field( $Post_Title ),
'post_content' => sanitize_text_field( $Post_Content ),
'post_category' => array( $_POST['cat'] ),
'tags_input' => sanitize_text_field( $Post_Tags ),
'post_status' => 'draft',
'post_type' => 'post',
'ping_status' => $Post_Ping,
'comment_status' => $Post_Comment,
'post_author' => $current_user->ID
);
$New_PID = wp_insert_post( $new_post );
add_post_meta( $New_PID, 'author', $author, true );
add_post_meta( $New_PID, 'author-email', $email, true );
add_post_meta( $New_PID, 'author-phone', $phone, true );
add_post_meta( $New_PID, 'author-city', $city, true );
add_post_meta( $New_PID, 'author-price', $price, true );

if ( ! function_exists( 'wp_handle_upload' ) ) {
require_once( ABSPATH . 'wp-admin/includes/file.php' );
}
if ( $_FILES ) {
$files = $_FILES['featured-img'];
foreach ( $files['name'] as $key => $value ) {
if ( $files['name'][$key] ) {
$file = array(
'name' => $files['name'][$key],
'type' => $files['type'][$key],
'tmp_name' => $files['tmp_name'][$key],
'error' => $files['error'][$key],
'size' => $files['size'][$key]
);
$_FILES = array( "featured-img" => $file );
$counter = 1;
foreach ( $_FILES as $file => $array ) {
if ( $counter == 1 ) {
$newupload = insert_attachment( $file, $New_PID, true );
} else {
$newupload = insert_attachment( $file, $New_PID, false );
}
++ $counter;
} // End of inner foreach
} // End of if
} // End of outer foreach
} // End of if($_FILES)
echo '<a style="color:green;font-size:15px;">پس از تایید مدیر منتشر خواهد شد</a>';
/* if ( 'draft' == get_post_status( $New_PID ) ) {

$payline->ReturnPath = urlencode( 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] .
'&postid=' . $New_PID
);
$re = $payline->Request();
if ( $re > 0 ) {
add_post_meta( $New_PID, 'id_get', $re, true );
header( "Location: http://payline.ir/payment-test/gateway-$re " );
} elseif ( $re ) {
switch ( $re ) {
case '-1':
echo '<p class="error-payment">' . __( 'api ارسالی با نوع api تعریف شده در payline سازگار نیست.',
'payline'
) . '</p>';
break;
case '-2':
echo '<p class="error-payment">' . __( 'مقدار amount داده عددی نمی باشد.', 'payline' ) .
'</p>';
break;
case '-3':
echo '<p class="error-payment">' . __( 'مقدار redirect رشته null است.', 'payline' ) . '</p>';
break;
case '-4':
echo '<p class="error-payment">' . __( 'درگاهی با اطلاعات ارسالی شما یافت نشده و یا در حالت انتظار می باشد.',
'payline'
) . '</p>';
break;
}
}

}
*/
}
/*
if ( $_POST['trans_id'] ) {
switch ( $payline->Verify() ) {
case '-1':
echo '<p class="error-payment">' . __( 'api ارسالی با نوع api تعریف شده در payline سازگار نیست.',
'payline'
) . '</p>';
continue;
case '-2':
echo '<p class="error-payment">' . __( 'trans_id ارسال شده معتبر نمی باشد.', 'payline' ) .
'</p>';
continue;
case '-3':
echo '<p class="error-payment">' . __( 'id_get ارسالی معتبر نمی باشد.', 'payline' ) . '</p>';
continue;
case '-4':
echo '<p class="error-payment">' . __( 'چنین تراکنشی در سیستم وجود ندارد و یا موفقیت آمیز نبوده است.',
'payline'
) . '</p>';
continue;
case 1:
add_post_meta( ( int ) $_GET['postid'], 'trans_id', $payline->RefNumber, true );
wp_publish_post( ( int ) $_GET['postid'] );
echo '<p class="success-payment">' . sprintf( __( 'تراکنش موفقيت آميز بود. <br /> شماره رهگيري: %s ',
'payline'
), $payline->RefNumber
) . '</p>';
continue;
}
}*/
return $retVal;
}
?>

این کدشه

لینک به ارسال

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

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

[sharedmedia=tutorials:tutorials:655]

[sharedmedia=tutorials:tutorials:656]

[sharedmedia=tutorials:tutorials:658]

[sharedmedia=tutorials:tutorials:659]

لینک به ارسال

من فقط موندم چرا برای خودم درست کار میکنه ولی برای بقیه اینطور نیست!!!!!!!!!!!!

یکم عجیبه!!!اینکه بعد از زدن دکمه ارسال همون صفحه با همون آدرس لود میشه ولی میزنه صفحه پیدا نشد!!!!!!!!

لینک به ارسال

شاید دسترسی پست مهمان را باز نگذاشته باشید آموزش ها را با دقت بخوانید توضیح کامل داده شده

لینک به ارسال

من هنوز مشکلم حل نشده رو این پلاگینه خیلی کار کردم پلاگین ظاهرا درسته ولی بعضی وقتا توی برگشت مشکل داره موقع ارسال مطلب صفحه ریلود میشه میزنه برگه پیدا نشد!!!!

http://karajshahr.ir/?page_id=5

پیوندهای یکتا هم چک کردم بازم نشد قالب رو عوض کردم بازم همین مشکل هست.مثلا یه کاربر یه بار میاد ثبت میکنه یه بار میگه برگه پیدا نشد


<?php
/*
* Plugin Name: Guest Post With Payline
* Description: A simple and secure Guest Post/Blogging Plugin allow your visitors to submit contents for your site and published post after pay in payline website.
* Version: 1
* Author: hasan movahed
* Author URI: http://www.wallfa.com/
*/
/* include needed files
usage :
[guestpost image="true|false" ping="closed|open" comment="closed|open" redirect="URL to redirect after post submitted"]
[listguestspost redirect="URL to redirect after post published"]
*/
if ( ! defined( 'ABSPATH' ) ) exit() ;
else require_once ( ABSPATH . 'wp-includes/pluggable.php' ) ;
include_once ( 'inc/payline.class.php' ) ;
$payline = new Payline ;

/* GET option for use in class */
if ( get_option( 'wallfa_api' ) ) {
$payline->api = get_option( 'wallfa_api' ) ;
}
if ( get_option( 'wallfa_price' ) ) {
$payline->Price = ( float )get_option( 'wallfa_price' ) ;
}

/* Add menu in admin wordpress */
add_action( 'admin_menu', 'baw_create_menu' ) ;
function baw_create_menu() {
add_menu_page( 'تنظیمات پلایگن انتشار به ازای پرداخت', 'پست میهمان ', 'administrator', __file__,
'wallfa_settings_page' ) ;
add_action( 'admin_init', 'register_mysettings' ) ;
}
function register_mysettings() {
register_setting( 'wallfa-settings-group', 'wallfa_api' ) ;
register_setting( 'wallfa-settings-group', 'wallfa_price' ) ;
}
/* admin page function */
function wallfa_settings_page() { ?>
<div class="wrap">
<h2>پست میهمان </h2>
<form method="post" action="">
<?php
settings_fields( 'wallfa-settings-group' ) ;
do_settings_sections( 'wallfa-settings-group' ) ;
?>
<table class="form-table">
<tr valign="top">
<th scope="row">ای پی آی ، پی لاین خود را از درگاه گرفته و در اینجا وارد نمائید</th>
<td><input type="text" name="wallfa_api" value="<?php
echo esc_attr( get_option( 'wallfa_api' ) ) ;
?>" /></td>
</tr>

<tr valign="top">
<th scope="row">قیمت را وارد نمائید</th>
<th scope="row">واحد ریال می باشد</th>
<td><input type="text" name="wallfa_price" value="<?php
echo esc_attr( get_option( 'wallfa_price' ) ) ;
?>" /></td>
</tr>

</table>

<?php
submit_button() ;
?>
</form>
</div>
<?php
}
add_shortcode( 'guestspost', 'guestspostwallfa' ) ;
function guestspostwallfa( $atts ) {
global $payline ;

extract( shortcode_atts( array(
'image' => 0,
'ping' => 'closed',
'comment' => 'closed',
'redirect' => get_bloginfo( 'home' ),
), $atts ) ) ;
$retVal = '<form class="wallfa-Guest-Post" action="" method="post" enctype="multipart/form-data" autocomplete="on">' ;
$retVal .= '<p>فیلد هایی که با ستاره مشخص شده پر نمائید</p>' ;
$retVal .= '<div style="width:580px;border:1px solid #eeeeee;float:right;">' ;
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'موضوع</strong><strong>:*' ) .
'</strong><br />';
$retVal .= ' <input type="text" name="title" size="30" maxlength="120" required="required" placeholder="' .
__( 'مثال: فروش آپارتمان' ) . '" autofocus />';
$retVal .= ' </div>';
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'ایمیل:' ) .
'</strong><br />';
$retVal .= ' <input type="text" name="email" size="30" maxlength="120" placeholder="' .
__( 'example@yahoo.com' ) . '" autofocus />';
$retVal .= ' </div>';
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'تلفن:*' ) .
'</strong><br />';
$retVal .= ' <input type="text" name="phone" size="30" maxlength="120" required="required" placeholder="' .
__( 'شماره تماس خود ار اینجا بنویسید' ) . '" autofocus />';
$retVal .= ' </div>';
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'متراژ:*' ) .
'</strong><br />';
$retVal .= ' <input type="text" name="author" size="30" maxlength="120" required="required" placeholder="' .
__( 'متراژ ملک را وارد کنید.' ) . '" autofocus />';
$retVal .= ' </div>';
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'منطقه:*' ) .
'</strong><br />';
$retVal .= ' <input type="text" name="city" size="30" maxlength="120" required="required" placeholder="' .
__( 'مثال : گلشهر' ) . '" autofocus />';
$retVal .= ' </div>';
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'قیمت (تومان):*' ) .
'</strong><br />';
$retVal .= ' <input type="text" name="price" size="30" maxlength="120" required="required" placeholder="' .
__( 'به ازای هر متر' ) . '" autofocus />';
$retVal .= ' </div>';
/* Post Textbox Starts */
$retVal .= ' <div style="float:right;margin:5px auto;">';
$retVal .= ' <strong>' . __( 'توضیحات:' ) . '</strong><br />';
$retVal .= wp_nonce_field( 'Wallfa_Post_Form', 'Wallfa_Post_Form_nonce' );
ob_start();
wp_editor( '', 'description', array(
"wpautop" => true,
"media_buttons" => ( $image ),
"textarea_name" => "description",
"textarea_rows" => "4",
"drag_drop_upload" => false
)
);
$retVal .= ob_get_clean();
$retVal .= ' </div>';
/* Post Textbox Ends */
$retVal .= ' <div style="width:578px;margin:5px auto;float:right;">' ;
$retVal .= ' <strong>' . __( 'دسته بندی را انتخاب کنید:*' ) . ' </strong>' ;
$retVal .= wp_dropdown_categories( 'show_option_none=هیچ کدام&tab_index=4&taxonomy=category&hide_empty=0&echo=0' ) ;
$retVal .= ' <input type="hidden" required="required" value="0' . $cat .
'" name="category"><br />' ;
$retVal .= ' </div>' ;

$retVal .='<div class="featured-img" style="float:right;">
<strong>' . __( 'یک تصویر انتخاب کنید :*' ) . '</strong><br />
<input name="featured-img[]" type="file" id="featured-img" multiple="multiple"><br>
</div>';


$retVal .= ' <div style="width:578px;margin:5px auto;float:right;">' ;
$retVal .= ' <input type="hidden" value="' . $redirect . '" name="redirect">' ;
$retVal .= ' <input type="hidden" value="' . $ping . '" name="ping">' ;
$retVal .= ' <input type="hidden" value="' . $comment . '" name="comment">' ;
$retVal .= ' <input type="hidden" value="' . get_home_url() . ' name="siteurl">' ;
$retVal .= ' <input type="submit" value="' . __( '✓ ارسال نوشته',
'SLB-Guest-Post-Simplified' ) . '"><br />' ;
$retVal .= ' </div>' ;
$retVal .= '</div>' ;
$retVal .= '</form>' ;



/* this code help for create a draft or all status post */
if ( isset( $_POST['Wallfa_Post_Form_nonce'] ) || wp_verify_nonce( $_POST['Wallfa_Post_Form_nonce'],
'Wallfa_Post_Form' ) ) {
function insert_attachment($file_handler, $post_id, $setthumb) {

// check to make sure its a successful upload
if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();

require_once(ABSPATH . "wp-admin" . '/includes/image.php');
require_once(ABSPATH . "wp-admin" . '/includes/media.php');

$attach_id = media_handle_upload( $file_handler, $post_id );

if ($setthumb) update_post_meta($post_id,'_thumbnail_id',$attach_id);
return $attach_id;
}
try{
$Post_Title = $_POST["title"] ;
$Post_Content = $_POST["description"] ;
$Post_Tags = $_POST["title"] ;
$Post_Category = $_POST["category"] ;
$Success_Redirect = $_POST["redirect"] ;
$Post_Ping = $_POST["ping"] ;
$Post_Comment = $_POST["comment"] ;
$author = $_POST['author'];
$email = $_POST['email'];
$phone=$_POST['phone'];
$city = $_POST['city'];
$price=$_POST['price'];
get_currentuserinfo() ;
$new_post = array(
'post_title' => sanitize_text_field( $Post_Title ),
'post_content' => sanitize_text_field( $Post_Content ),
'post_category' => array( $_POST['cat'] ),
'tags_input' => sanitize_text_field( $Post_Tags ),
'post_status' => 'draft',
'post_type' => 'post',
'ping_status' => $Post_Ping,
'comment_status' => $Post_Comment ) ;

$New_PID = wp_insert_post( $new_post ) ;
add_post_meta($New_PID, 'author', $author, true);
add_post_meta($New_PID, 'author-email', $email, true);
add_post_meta($New_PID, 'author-phone', $phone, true);
add_post_meta($New_PID, 'author-city', $city, true);
add_post_meta($New_PID, 'author-price', $price, true);



if ( ! function_exists( 'wp_handle_upload' ) )
require_once( ABSPATH . 'wp-admin/includes/file.php' );
if ( $_FILES ) {
$files = $_FILES['featured-img'];
foreach ($files['name'] as $key => $value) {
if ($files['name'][$key]) {
$file = array(
'name' => $files['name'][$key],
'type' => $files['type'][$key],
'tmp_name' => $files['tmp_name'][$key],
'error' => $files['error'][$key],
'size' => $files['size'][$key]
);

$_FILES = array("featured-img" => $file);

$counter = 1;
foreach ($_FILES as $file => $array) {
if($counter == 1){
$newupload = insert_attachment($file,$New_PID, true);
}else{
$newupload = insert_attachment($file,$New_PID, false);
}
++$counter;
} // End of inner foreach
} // End of if
} // End of outer foreach
} // End of if($_FILES)
echo '<a style="color:green;font-size:15px;">پس از تایید مدیر منتشر خواهد شد</a>';

}catch(Exception $e)
{
var_dump($e);
}
}
return $retVal ;
}
?>

لینک به ارسال

اصولا چک کردن افزونه ی کس دیگه کار درستی نیست

من چهار بخش آموزش کامل در این سایت برای ارسال مطلب گذاشتم کار دیگه ای هم فعلا بخاطر مشغله کاری ازم بر نمی آد

لینک به ارسال

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

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

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

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

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

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

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

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

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