Posts

Showing posts from January, 2012

2021 Top 4 Best Upcoming Flagship Smartphones : which are the best mobile phones for you..?

Image
  Hi here are the top 8 best upcoming flagship smartphones of 2021 with high-end level features improved cameras stunning design and many other next-generation technologies will be applied that you will really enjoy also the price and the release date of the smartphones are discussed. Number four Asus Zenfone 8 Number three OnePlus 9 Number two Huawei P50 Number one Apple iPad Pro 12.9

Check who had read email?

In your email content add this code <img src="http://yourdomain.com/emailreceipt.php?receipt=<receiver_emailid" /> And in emailreceipt.php log it in to a database, although again this is restricted by the email client's ability to show images and sometimes it may even put the mail into junk because it doesn't detect an image... a workaround that would be to actually outputting an image (say your logo) at the end of that script.

How to sum total time utilize in each week of a month?

Image
Assuming that the attendance table has a date column attendance_date , the below query may give you total time utilized per week in the month: SELECT WEEK (` attendance_date `) ` attendance_week `, SEC_TO_TIME ( SUM ( TIME_TO_SEC (` time_utilize `))) ` attendance_time_utilized ` FROM ` attendance ` GROUP BY ` attendance_week `; In the above query, the attendance_week is calculated as the week of the year, between 1 and 52. Another form of output might be to show weeks as 1,2,3,4. For it, you may try this query: SELECT (` attendance_week ` - ` min_week ` + 1 ) ` att_week `, ` attendance_time_utilized `  FROM (  SELECT WEEK (` ATT `.` attendance_date `) ` attendance_week `,  SEC_TO_TIME ( SUM ( TIME_TO_SEC (` ATT `.` time_utilize `))) ` attendance_time_utilized `,   ` T1 `.` min_week `  FROM ` attendance ` ` ATT `   INNER JOIN ( SELECT MIN ( WEEK (` attendance_date `)) ` min_week ` FROM ` attendance `) T1  GROUP BY ` attendance_week ` ) T2 ;    H

Create div using jquery with fade in effect

Image
If you want to get some text from php file and display on a browser using jquery such that each time a new row will add at top of other and with fade in effect: Your script should like

Add Class for Image in Content

The given PHP example adds a class to the standard classes in Images in Posts/Pages in WordPress. <?php function bb_add_image_class($class){ $class .= ' scale-with-grid'; return $class; } add_filter('get_image_tag_class','bb_add_image_class'); ?>

Get URL Thumbnail

The given PHP example get the thumbnail URL in WordPress. <?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 140,140 ), false, '' ); echo $src[0]; ?>

Change Login Logo and Login Link

The given PHP example helps you to change the login logo and the login link into WordPress. <?php function custom_loginlogo() { echo ' '; } add_action('login_head', 'custom_loginlogo'); add_filter( 'login_headerurl', 'custom_loginlogo_url' ); function custom_loginlogo_url($url) { return 'http://www.wpbeginner.com'; } ?>

Hide The Front-End Dashboard Bar

The given PHP example helps you to hide the Front-End dashboard bar from WordPress. Place this in your index.php before wp_footer() is called. <?php show_admin_bar( false ); ?>

Get the First Image from the Post and Display it.

The given PHP example allows you to automatically get the first image from the current post, and display it into WordPress. <?php function catch_that_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/ /i', $post->post_content, $matches); $first_img = $matches [1] [0]; if(empty($first_img)){ //Defines a default image $first_img = "/images/default.jpg"; } return $first_img; } echo catch_that_image(); ?>

Display Post Views Within Admin Post Columns

The given PHP example will display the post views within admin post columns into WordPress. <php add_filter('manage_posts_columns', 'posts_column_views'); add_action('manage_posts_custom_column', 'posts_custom_column_views',5,2); function posts_column_views($defaults){ $defaults['post_views'] = __('Views'); return $defaults; } function posts_custom_column_views($column_name, $id){ if($column_name === 'post_views'){ echo getPostViews(get_the_ID()); } } ?>

Multidimensional Array Sort

The given PHP example order any multidimensional array based on a specific field. <php function orderMultiDimensionalArray ($toOrderArray, $field, $inverse = false) { $position = array(); $newRow = array(); foreach ($toOrderArray as $key => $row) { $position[$key] = $row[$field]; $newRow[$key] = $row; } if ($inverse) { arsort($position); } else { asort($position); } $returnArray = array(); foreach ($position as $key => $pos) { $returnArray[] = $newRow[$key]; } return $returnArray; } ?>

Filter Category

The given PHP example filter out a category from your WordPress. Add this code to your functions.php file. <?php function exclude_cat(){         if(is_home) {                 $query-> set('cat','-312');         }         return $query; } add_filter('pre_get_posts','exclude_cat'); ?>