Subscribe to RSS feed Assine o feed RSS or ou follow me siga-me on Twitter? no Twitter?
Haven't you come across some meaningless pile of text, after which nothing is displayed? Já não se deparou com algum significado pilha de texto, após o qual nada é exibido? It breaks down the whole theme, causing problems for visitors and search bots alike. Ela reparte-se a todo o tema, causando problemas para os visitantes e pesquisa bots similares.

Don't we all hate those error codes? Não que todos odeiam os códigos de erro?
What are function calls? Quais são as funções chamadas?
Function calls are bits of PHP code that looks like this: <?php ns_show_top_commentators(); ?> Função chamadas são pedaços de código PHP que se parece com isto: <?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. A maioria dos plugins possuem essas etiquetas para usos específicos; o referido código é a lista dos top comentadores usando o plugin Show Top comentadores.
The reason A razão
PHP function calls are notorious for breaking the theme, if the requested function does not exist. PHP função chamadas são notórios por quebrar o tema, se a função solicitada não existe. This usually happens when you add a function call for a plugin that you have disabled. Isso geralmente acontece quando você adiciona uma chamada de função para um plugin que você tenha desabilitado. The result will be unaccessible blogs, which are caused by the behaviour of broken function calls. O resultado será inacessível blogs, que são causados pelo comportamento de trincas de função chamadas. WordPress cuts off the rendering of page when it stumbles over a broken function all. WordPress corta a renderização da página quando ela tropeça mais de uma função quebrados todos. Thus, depending on where you placed the broken code(sidebar/header/footer), your content may not be displayed, sidebars hidden or footers gone awry. Assim, dependendo de onde você colocou o código quebrado (lateral / cabeçalho / rodapé), o seu conteúdo não pode ser exibido, sidebars ocultos ou rodapés ido torto.
The solution A solução
This problem can be overcome by using an if function_exists check. Este problema pode ser superado usando um if function_exists verificar. What does it do? O que faz? It checks whether the given function actually exists, and if it does, proceeds to call the function. Verifica se a dada função realmente existe, e se isso acontecer, procede à chamada a função. This way, your theme will work even when the function call is broken. Desta forma, o tema irá funcionar mesmo quando a função chamada é quebrado.
Let us see an example of the conditional code (for Alex King's Twitter Tools plugin, used here on the top navbar). Vejamos um exemplo do código condicional (por Alex King's Twitter Tools plugin, utilizado aqui no topo navbar).
The normal code for the Twitter tools is this: O normal para o código ferramentas Twitter é esta:
<?php aktt_latest_tweet (); ?>
The conditional code would be this: O código condicional seria esta:
<?php if(function_exists(' aktt_latest_tweet ')) { aktt_latest_tweet (); } ?> <? php if (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. Para usá-lo para qualquer outro plugin, localizar e copiar o que você encontrar no local de aktt_latest_tweet código no primeiro bloco. Then, paste that part in places of the code in red in the second code block. Em seguida, cole em lugares que parte do código em vermelho no segundo código.
This is a bit tricky, but play with it in a Isto é um pouco complicado, mas jogar com ela em um test blog installed locally on your PC teste blog instalado localmente no seu PC , and once you get it right, upload it to your server. E, uma vez que você começa a direita, faça o upload para seu servidor. Feel free to leave a comment on any issues that crop up on the way. Sinta-se livre para deixar um comentário sobre qualquer questão que surgir no caminho.
Hi Sumesh, Oi Sumesh,
Interesting post. Interesting post. I really love tech related stuff, as I can always learn more. Eu realmente adoro coisas relacionadas com tecnologia, como eu posso aprender sempre mais. PHP is one of my weak points as I never learned coding. PHP é um dos meus pontos fracos como eu nunca aprendeu codificação. Only trial by doing kind of stuff and reading about solutions like this is fascinating for me. Apenas julgamento, fazendo tipo de coisas e ler sobre soluções como esta é fascinante para mim.
Good luck with your entry.:-) Boa sorte com a sua entrada. :-)
Monika Monika
@Monika: Thanks. @ Monika: Obrigado. As regards PHP, neither did I – its just a matter of interest, time and No que diz respeito ao PHP, nem eu - o seu apenas uma questão de interesse, tempo e
elbow grease cotovelo graxaeffort, plus some cheat sheets to learn PHP (hint: codex.wordpress.org) esforço, além de algumas folhas para aprender PHP cheat (dica: codex.wordpress.org)That's a great tip Sumesh. Isso é uma grande dica 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. Pode não ser muito fácil de perceber esses erros, o tempo e voltar uns dias mais tarde para encontrar erros quando você menos espera.
@Andrew: Thanks. @ André: Obrigado. 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. De fato, eu caçados este bug depois esqueci-me de ver o meu soccerblog.in, que tinha o erro que você vê na imagem acima.
Thanks.. Obrigado ..
as im not expert in php… como especialista em php não im ...
so it helped me alot… and my problem is solved by reading ur post… thanks once again.. assim ele me ajudou muito ... e meu problema é resolvido através da leitura ur post ... obrigado mais uma vez ..