Change the meta description on a specific page?

The meta description isn’t part of the Twenty Fifteen theme. You mentioned the Yoast plugin in a previous question yesterday, so I guess the meta description comes from there. According to their API page, there’s a filter called wpseo_metadesc that might be what you’re looking for. Here’s an untested example: /** * Change the Yoast … Read more

Change “en-US” to “en”

If you want to get the language of the browser do so: $lang = substr($_SERVER[‘HTTP_ACCEPT_LANGUAGE’], 0, 2); If you want to redirect to ?lang=en: header(“location: {$_SERVER[‘REQUEST_URI’]}?lang={$lang}”); You should read about HTTP_ACCEPT_LANGAUGE. There are many ways you can dance with languages but you should understand some key points. Chose the default language of your website (French … Read more

How can I use get_bloginfo(‘admin_email’) in a custom PHP file?

You can include the wp-load.php in your PHP file, but, I do not recommend this method. It’s better you use the wp_enqueue_script(). See this article to get more information. <?php include “../../../wp-load.php”; $headers = “MIME-Version: 1.0” . “\r\n”; $headers .= “Content-type:text/html;charset=UTF-8” . “\r\n”; $headers .= ‘From: <[email protected]>’ . “\r\n”; $headers .= ‘Bcc: <‘. get_bloginfo(‘admin_email’) . … Read more

php syntax – how to concatenate properly – echo bloginfo(‘stylesheet_directory)

bloginfo() does already an echo. It will be printed before everything else in your echo statement. Use get_bloginfo() instead. stylesheet_directory is one of these arguments where it is better just to use the function that is called by WordPress: get_stylesheet_directory_uri(). It is easier to understand, especially in this case where one could expect a path … Read more