رفتن به مطلب

هک مهم برای نویسنده


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

فرض کن من یه ف ی س ب و ک دارم یه گ و گ ل پلاس یه ت و ی ی ت ر خوب


<?php
$facebook_url = ( isset( get_the_author_meta('facebook') ) && !empty( get_the_author_meta('facebook') )
? '<a href="'.get_the_author_meta('facebook').'" class="icone-facebook">فیس بوک </a>'."\n";
: '';
$googleplus_url = ( isset( get_the_author_meta('googleplus') ) && !empty( get_the_author_meta('googleplus') )
? '<a href="'.get_the_author_meta('googleplus').'" class="icone-gplus">گوگل + </a>'."\n";
: '';
$twitter_url = ( isset( get_the_author_meta('twitter') ) && !empty( get_the_author_meta('twitter') )
? '<a href="'.get_the_author_meta('twitter').'" class="icone-twitter">تویتر </a>'."\n";
: '';
echo $facebook_url.$googleplus_url.$twitter_url;
?>

موقع استفاده از css selector name حتما توصیه میشه CamelCase rules رعایت شه .

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


<?php
$url_url = ( isset( get_the_author_meta('url') ) && !empty( get_the_author_meta('url') )
? '<a href="'.get_the_author_meta('url').'" class="Icone-url">وب سایت </a>'."\n";
: '';
$googleplus_url = ( isset( get_the_author_meta('googleplus') ) && !empty( get_the_author_meta('googleplus') )
? '<a href="'.get_the_author_meta('googleplus').'" class="icone-gplus">گوگل + </a>'."\n";
: '';
$facebook_url = ( isset( get_the_author_meta('facebook') ) && !empty( get_the_author_meta('facebook') )
? '<a href="'.get_the_author_meta('facebook').'" class="icone-facebook">فیس بوک </a>'."\n";
: '';
$twitter_url = ( isset( get_the_author_meta('twitter') ) && !empty( get_the_author_meta('twitter') )
? '<a href="'.get_the_author_meta('twitter').'" class="icone-twitter">تویتر </a>'."\n";
: '';
$linkedin_url = ( isset( get_the_author_meta('linkedin') ) && !empty( get_the_author_meta('linkedin') )
? '<a href="'.get_the_author_meta('linkedin').'" class="Icone-linkedin">لینکداین </a>'."\n";
: '';
echo $facebook_url.$googleplus_url.$twitter_url.$url_url.linkedin_url;
?>

لینک به ارسال

کد تصحیح شده:

<?php
$get_the_author_meta = get_the_author_meta('url');
if( isset( $get_the_author_meta ) && !empty( $get_the_author_meta ))
$url_url = '<a href="'.$get_the_author_meta.'" class="Icone-url">وب سایت </a>'."\n";
else '';
$get_the_author_meta = get_the_author_meta('googleplus');
if( isset( $get_the_author_meta ) && !empty( $get_the_author_meta ))
$googleplus_url = '<a href="'.$get_the_author_meta.'" class="icone-gplus">گوگل + </a>'."\n";
else '';
$get_the_author_meta = get_the_author_meta('facebook');
if( isset( $get_the_author_meta ) && !empty( $get_the_author_meta ))
$facebook_url = '<a href="'.$get_the_author_meta.'" class="icone-facebook">فیس بوک </a>'."\n";
else '';
$get_the_author_meta = get_the_author_meta('twitter');
if( isset( $get_the_author_meta ) && !empty( $get_the_author_meta ))
$twitter_url = '<a href="'.$get_the_author_meta.'" class="icone-twitter">تویتر </a>'."\n";
else '';
$get_the_author_meta = get_the_author_meta('linkedin');
if( isset( $get_the_author_meta ) && !empty( $get_the_author_meta ))
$linkedin_url = '<a href="'.$get_the_author_meta.'" class="Icone-linkedin">لینکداین </a>'."\n";
else '';
echo $facebook_url.$googleplus_url.$twitter_url.$url_url.$linkedin_url;
?>

لینک به ارسال

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

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

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

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

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

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

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

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

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