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

Jquery function working in Dev Console but not otherwise [duplicate]

As toscho pointed out, use jQuery(document).ready(function($) { … }); instead of $( function() { … }); Edit: Main problem is WP rich text editor escaping your html <script> tags. See https://codex.wordpress.org/Using_Javascript at the bottom of the page for a plugin-based workaround to turn off formating for specific posts/pages, allowing you to insert code. Alternately, add … Read more

WordPress from url get external source title

Here you go: class UrlToTitleConverter{ public function convert($Url){ $response = wp_remote_get($Url); if ( is_array( $response ) ) { $body = $response[‘body’]; $title = substr($body, strpos($body, ‘<title>’)+7); $title = substr($title, 0, strpos($title, ‘</title>’)); } return $title; } }

Help with a $wpdb MySQL Query

is this what you’re after? Using the “Relation” for the Meta Query, you can select multiple Meta Keys. You can change the “Compare” to any of the operations available for that function. (From the Codex) compare (string) – Operator to test. Possible values are ‘=’, ‘!=’, ‘>’, ‘>=’, ‘<‘, ‘<=’, ‘LIKE’, ‘NOT LIKE’, ‘IN’, ‘NOT … Read more

Font Awesome changing default WordPress Font

It was not Font-Awesome that changed the default WordPress Style. I also use Bootstrap. One file called scaffolding.less overrides the WordPress defaults with: // Body reset html { font-size: 10px; -webkit-tap-highlight-color: rgba(0,0,0,0); } body { font-family: @font-family-base; font-size: @font-size-base; line-height: @line-height-base; color: @text-color; background-color: @body-bg; } I just added this to my custom CSS File … Read more

How to add different text in each result of foreach?

You can use the wp_get_attachment_metadata() function which returns an array of data. I would add it to your code <?php $id = 51; $count = 0; $is = get_children(“post_parent=$id&post_type=attachment&post_mime_type=image&order_by=ASC”); foreach($is as $i) { $url = wp_get_attachment_image_src($i->ID, ‘full’); $attachementMeta = wp_get_attachment_metadata($i->ID); ?> <img src=”https://wordpress.stackexchange.com/questions/298553/<?php echo $url[0]; ?>” alt=”<?php echo $attachementMeta[‘image_meta’][‘caption’]; ?>”> <?php } ?> Read more … Read more