How to get year, month and hour in WordPress?

PHP Date Format in WordPress function: You’ll have to use the proper date format string (as used in PHP date function) in the WordPress get_the_date() function’s first parameter. For example, to get the Date & Time in the format like 2018-07-23 23:59 (i.e. YYYY-MM-DD HH:MM, where hour is in 24 hour format), you need CODE … Read more

Add dollar sign and commas to a number?

To format number, you can use the function number_format_i18n (it’s not documented now, but you can see its source here). Its work is format the number based on the language. You might want to look at number_format (PHP built_in function, and is used by number_format_i18n) to have more control to decimal point and thousand separator. … Read more

Email sent from WordPress has HTML tags

The default content type is ‘text/plain’ which does not allow using HTML. You can set the content type of the email by including a header like “Content-type: text/html” $headers=”Content-type: text/html;charset=utf-8″ . “\r\n”; $headers .= ‘From: XXXXXX.com <[email protected]>’ . “\r\n”; $subject=”Registration from xxxxx.com” . “\r\n”; $message = $result_email_text; wp_mail($_POST[‘admin_email’], $subject, $message, $headers ); Or you can … Read more

Remove hidden formatting when user paste text from MS Word into TinyMCE

I am interpreting the question to mean that you already have Word markup in your post and so you need to clean that up via PHP. If so… You can see the code that cleans up Word content here: http://core.trac.wordpress.org/browser/trunk/src/wp-includes/js/tinymce/plugins/paste/editor_plugin_src.js#L375 That is Javascript. With some work, you could convert that to PHP. PHP Tidy, if … Read more

Create a formatted table-like menu

I think your question is a perfect example for the XY Problem. In WordPress you do not create such a menu in a post editor. You use a menu. Once you start thinking about your problem from this point, everything is easy. 🙂 First register a custom navigation menu for this list in your theme’s … Read more

Automatically decrease font size for long words

I’ve done something similar taking the simple approach of adding a CSS class to titles based on their character count. That CSS class then decreases letter-spacing and/or font-size. // Count the characters, taking Unicode into account $chars = mb_strlen($post->post_title); // For every 10 characters after the first 20, add a size $size = max(0, ceil(($chars … Read more

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