Where to place PHP for shortcodes

Shortcodes are processed on display so the code must be available on the front end when the shortcode is processed. Superficially, that means frontend.php. I have never tried to split shortcode code in this way. You may have trouble splitting it off from the backend. The add_shortcode function is in wp-includes/shortcodes.php which loads for both … Read more

need help to arabic text in wordpress

Make sure all your files are encoded in UTF-8. Keep your theme language agnostic: Write all strings in English and use the proper translation functions to get the translated string (eg. Arabic): _e( ‘Hello world!’, ‘your_text_domain’ );

Outputting a custom field in PHP

Setting the third parameter of get_post_meta to true does not guarantee that you get a string. What that parameter does is control how many rows of the database get returned. When true you only get a single result and not an array of all of the rows in the database that match. You will get … Read more

Highlight main menu when on specific posts or pages

As noted in comments above, the OP’s code generates malformed CSS. Per request, here is corrected code. It should help solve part of the issue (or prevent other issues) but I doubt it solves all of it. function blog_link_genesis() { if( is_single() || in_category(‘investors’) || is_page( array(4, 30))) { $current=”#header #nav #menu-item-133 a”; ?> <style … Read more

two sites, same code, different presentation

After walking through the code and examining everything else, I (finally) revisited the page definition in the Dashboard. There I noticed that the page was not associated with the page template I was working with. I assume that during the migration from the development web site to the production web site, the association went missing. … Read more