رفتن به مطلب

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


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

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


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

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

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

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



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