Subscribe to RSS feed اشترك في تغذية RSS or أو follow me بي on Twitter? على التغريد؟
Haven't you come across some meaningless pile of text, after which nothing is displayed? لا هل واجهتم بعض كومة من معنى النص ، وبعد ذلك يتم عرض أي شيء؟ It breaks down the whole theme, causing problems for visitors and search bots alike. انها تنهار الموضوع كله ، مما تسبب في مشاكل للزوار والبحث السير على حد سواء.

Don't we all hate those error codes? نحن لا نكره كل تلك المدونات خطأ؟
What are function calls? ما هي وظيفة ويدعو؟
Function calls are bits of PHP code that looks like this: <?php ns_show_top_commentators(); ?> الوظيفة المكالمات بت من رمز PHP يبدو أن هذا : <?php ns_show_top_commentators(); ?>
Most plugins have such tags for specific uses; the above-mentioned code is to list the top commentators using the Show Top Commentators plugin. معظم هذه الوظائف الاضافية علامات محددة الاستخدامات المذكورة أعلاه هي رمز لقائمة كبار المعلقين استخدام البرنامج المساعد المعلقون عرض أعلى.
The reason السبب
PHP function calls are notorious for breaking the theme, if the requested function does not exist. PHP هي وظيفة سيئة السمعة ويدعو للخروج من الموضوع ، إذا طلب وظيفة لا وجود لها. This usually happens when you add a function call for a plugin that you have disabled. وهذا يحدث في الغالب عند إضافة وظيفة الدعوة لهذا البرنامج المساعد لديك المعوقين. The result will be unaccessible blogs, which are caused by the behaviour of broken function calls. ستكون النتيجة غير ممكن بلوق ، والتي سببها سلوك يدعو إلى كسر وظيفة. WordPress cuts off the rendering of page when it stumbles over a broken function all. وورد يعزل جعل الصفحة عندما يتعثر أكثر من كسر في كل وظيفة. Thus, depending on where you placed the broken code(sidebar/header/footer), your content may not be displayed, sidebars hidden or footers gone awry. وهكذا ، تبعا للمكان الذي كنت قد وضعت كسر الشفرة (الشريط الجانبي / رأس / ذيل الصفحة) ، والمحتوى الخاص بك قد لا يتم ، sidebars الهوامش ذهب خفية أو غير سليمة.
The solution الحل
This problem can be overcome by using an if function_exists check. يمكن التغلب على هذه المشكلة باستخدام if function_exists تحقق. What does it do? ماذا يفعل؟ It checks whether the given function actually exists, and if it does, proceeds to call the function. انها عمليات تفتيش وظيفة معينة إذا كانت موجودة فعلا ، وإذا فعلت ذلك ، والدعوة إلى عائدات مهمة. This way, your theme will work even when the function call is broken. وبهذه الطريقة ، سيكون موضوع العمل الخاص بك حتى عندما تكون وظيفة الكلمة مكسورة.
Let us see an example of the conditional code (for Alex King's Twitter Tools plugin, used here on the top navbar). دعونا نرى مثالا المشروط مدونة (اليكس الملك التغريد أدوات البرنامج المساعد ، وتستخدم هنا على رأس navbar).
The normal code for the Twitter tools is this: مدونة العادية للالتغريد هذه الأدوات هي :
<?php aktt_latest_tweet (); ?>
The conditional code would be this: المشروط سيكون هذا الرمز :
<?php if(function_exists(' aktt_latest_tweet ')) { aktt_latest_tweet (); } ?> <؟ php اذا function_exists ( 'aktt_latest_tweet')) (aktt_latest_tweet () ؛)؟>
To use it for any other plugin, find and copy the what you find in place of aktt_latest_tweet in the first code block. لاستخدامها لأي غرض آخر البرنامج المساعد ، والعثور على نسخ ما تجده في مكان aktt_latest_tweet أول مدونة في الكتلة. Then, paste that part in places of the code in red in the second code block. ثم لصق هذا الجزء في أماكن الشفرة الحمراء في المدونة الثانية في الكتلة.
This is a bit tricky, but play with it in a وهذا صعب بعض الشيء ، ولكن لعب معه في test blog installed locally on your PC بلوق تركيبها محليا اختبار على جهاز الكمبيوتر , and once you get it right, upload it to your server. وبمجرد الحصول على حق ، وتحميله لملقمك. Feel free to leave a comment on any issues that crop up on the way. لا تتردد في ترك التعليق على أي من القضايا الملحة التي تبرز على الطريق.
Related reading يتصل ريدينج
- Follow CNNBrk on Twitter for breaking news updates CNNBrk على متابعة الأخبار العاجلة لالتغريد التحديثات
- Plugin Week promises a daily WordPress plugin for a week البرنامج المساعد أسبوع وعود وورد البرنامج المساعد يوميا لمدة أسبوع
- How to get Vista theme for Firefox in Windows XP كيفية الحصول على ويندوز فيستا موضوع فايرفوكس في ويندوز إكس بي
- Brighten up Firefox with Camifox theme سطع Camifox الموضوع مع فايرفوكس
Hi Sumesh, مرحبا Sumesh ،
Interesting post. وظيفة للاهتمام. I really love tech related stuff, as I can always learn more. أنا حقا أحب الأشياء التكنولوجيا ذات الصلة ، كما يمكن دائما معرفة المزيد. PHP is one of my weak points as I never learned coding. PHP بلدي هي واحدة من نقاط ضعف وأنا لا علم التشفير. Only trial by doing kind of stuff and reading about solutions like this is fascinating for me. محاكمة فقط عن طريق العمل النوع من الاشياء ، والقراءة عن حلول مثل هذه رائعة بالنسبة لي.
Good luck with your entry.:-) حظا سعيدا مع الدخول. :-)
Monika مونيكا
@Monika: Thanks. @ مونيكا : شكرا. As regards PHP, neither did I – its just a matter of interest, time and وفيما يتعلق PHP ، بل لم يكن الأول -- عن مجرد مسألة الاهتمام والوقت و
elbow grease كدحeffort, plus some cheat sheets to learn PHP (hint: codex.wordpress.org) الجهد ، بالإضافة إلى بعض الغش صحائف تعلم PHP (تلميح : codex.wordpress.org)That's a great tip Sumesh. هذا عظيم Sumesh الحافة. It can be really easy not to notice these errors at the time and come back a few days later to find errors where you least expect them. ويمكن أن يكون حقا وليس من السهل ملاحظة هذه الأخطاء في ذلك الوقت والعودة بعد أيام قليلة على وجود أخطاء حيث نتوقع منهم على الأقل.
@Andrew: Thanks. @ أندرو : شكرا. As a matter of fact, I hunted down this bug after I forgot to check my soccerblog.in, which had the error you see in screenshot above. كما واقع الأمر ، أنا تعقبت هذه علة بعد نسيت للتأكد لي soccerblog.in التي الخطأ الذي تراه في الصورة أعلاه.
Thanks.. الشكر..
as im not expert in php… كما لا الدردشة الخبراء في php...
so it helped me alot… and my problem is solved by reading ur post… thanks once again.. لذلك ساعدني كثيرا... ورسالتي إلى حل للمشكلة من خلال قراءة ما بعد جولة أوروغواي... الشكر مرة أخرى..