Performance-wise, is it better to enqueue a (small) script on every page or test to see if it’s needed?

What happens on the user’s side is off topic as @bungeshea said already. Once the user has loaded the file it will stay in the browser cache for a while, so you don’t have to worry about double loaded files anyway. But let’s look at the server side and how WordPress handles this. If you … Read more

Checking if a Page has an Associated Term?

Hi @NetConstructor: First thing, assuming your logic worked you can use the ternary operator to simplify your example: <li id=”kids-<?php echo is_term(‘Kids’,’age_groups’) ? ‘on’ : ‘off’; ?>”>Kids Programs</li> The issue seems to be that is_term() is used to check if a term exists, not if it is associated with a particular post. I think what … Read more

Is there a PHP function that can match anything after the given URL, so my IF statement will work in each instance?

look for the string page/ and capture just the part of the url before it with strpos and substr: $url=”/players/type/pros/page/3/”; $find = ‘page/’; $trimmed_url = substr( $url, 0, strpos($url, $find) ); EDIT – so in the context of your question you could use: $url = $_SERVER[‘REQUEST_URI’]; $find = ‘page/’; $pos = strpos($url, $find); if($pos): $url … Read more

How to hide and content from auto-generated excerpts?

To filter the content only when an auto-excerpt is generated you have to chain the hooks: Hook into get_the_excerpt and register a filter for the_content. In the second filter remove both elements and their content before the excerpt can see it. Sample: add_filter( ‘get_the_excerpt’, ‘t5_excerpt_clean_up’, 1 ); /** * Register handler for auto-generated excerpt. * … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)