Following code will retrieve all file names from a specified folder. <?php $filePath = "/var/www/public_html/mysite/images";/* Enter path to the folder */ $string=""; $fileCount=0; $dir = opendir($filePath); while ($file = readdir($dir)) { if (eregi("\.png",$file)) { /* Look for files with .png extension */ $string .= "$file<br />"; $fileCount++; } } if ($fileCount > 0) { echo [...]
On Internet you would have come across many html forms where the value of certain fields depends on the values selected in the first select box. So if we create this using server side script then many page loads will be needed. So if you want to create this at client side then you can [...]
This Error message comes when you are trying to upload image,music or video files which are not supported by wordpress. WordPress have some whitelist of file types which are allowed to upload, Other files are not allowed to upload due to the security reasons. Accepted Filetypes Images .jpg .jpeg .png .gif For More information Read [...]
If you want to display most commented post or most popular post on your blog, you can display that using following code. WordPress Popular Post or Most Commented Post without a Plugin <h2>Popular Posts</h2> <ul> <?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 5"); foreach ($result as $post) { [...]