PHP – Trim a text string to max number of words
function trim_words($string, $max_words) { $stringArr = explode(' ', $string); if(count($stringArr) > $max_words && $max_words > 0) { $string…
function trim_words($string, $max_words) { $stringArr = explode(' ', $string); if(count($stringArr) > $max_words && $max_words > 0) { $string…
Reference: How to Upload Additional File Types in WordPress (by Antonio Villegas) WordPress only allows file uploading into…
is_front_page() is_single() Returns true if the item is post, not page. It also accepts ID and name parameter…
Reference: Add a new widget area to a WordPress theme (by Keith Curreri on October 26, 2010) Add…
Reference: HOW TO CREATE YOUR OWN WORDPRESS SHORTCODESBY SARA VIEIRA | JUN. 04, 2013 In functions.php, create the…
In the past, the approach for creating the BPC is to first create a page template using the…
Template hierarchy WordPress uses the query string to decide which template or set of templates should be used to display…
"The Loop" is the main process of WordPress. You use The Loop in your template files to show posts to visitors.…
The following security measures should be observed when creating new folders or files in Wordpress: Every folder should…
The cu-debug-functions.php contains two functions which can inspect variables in php codes. data_console( mixed $var, String $label =…
To have a more precise control of the scrolling to an 'a' tag, or anchor point, two methods…
There are two resources, the WP Hook Database by Adam Brown and WordPress’ Code Reference to search for hooks. These two are great,…
IntroductionWordPress-specific global variables are used throughout WordPress code for various reasons. Almost all data that WordPress generates can…
Using @font-face rules for custom fonts. Note that all font-family values are the same. Style and weight are set to the values corresponding…
In Dr Reborn Revamp project, it is necessary to pass a data from one page to another page…
https://www.youtube.com/watch?v=GyjoTwXR8gY 2020-08-10 The Load More button is required in the Dr Reborn project. Video source: Make Load more…
The CSS below is taken from the official website. When the page is displaying Traditional Chinese, only the…