Changeset 2624971
- Timestamp:
- 11/05/2021 08:29:27 AM (4 years ago)
- Location:
- aztheme-toolkit/trunk
- Files:
-
- 2 edited
-
aztheme-toolkit.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
aztheme-toolkit/trunk/aztheme-toolkit.php
r2621903 r2624971 95 95 } 96 96 97 /** 98 * Count Post Visits 99 */ 100 function aztheme_toolkit_count_post_visits() 101 { 102 if( is_single() ) 103 { 104 global $post; 105 $views = get_post_meta( $post->ID, 'producta_post_viewed', true ); 106 if ( $views == '' ) { 107 update_post_meta( $post->ID, 'producta_post_viewed', '1' ); 108 } else { 109 $views_no = intval( $views ); 110 update_post_meta( $post->ID, 'producta_post_viewed', ++$views_no ); 111 } 112 } 113 } 114 115 add_action( 'wp_head', 'aztheme_toolkit_count_post_visits' ); 116 117 // Get Post View 118 function aztheme_toolkit_get_post_view() 119 { 120 global $post; 121 $view = get_post_meta( $post->ID, 'producta_post_viewed',true); 122 $view = (int)$view; 123 if ($view > 1 ) { 124 $view = $view . ' ' . esc_html__( 'views', 'producta' ); 125 } elseif ( $view == 1) { 126 $view = $view . ' ' . esc_html__( 'views', 'producta' ); 127 } else { 128 $view = '0'. ' ' . esc_html__( 'views', 'producta' ); 129 } 130 131 return $view; 132 } 133 134 97 135 if ( ! function_exists( 'aztheme_toolkit_load_scripts' ) ) { 98 136 /** -
aztheme-toolkit/trunk/readme.txt
r2621903 r2624971 4 4 Tags: toolkit, aztheme, categories, images, social, share 5 5 Requires at least: 5.0 6 Stable tag: 1.0. 26 Stable tag: 1.0.3 7 7 Tested up to: 5.8 8 8 Requires PHP: 7.4 … … 33 33 34 34 == Changelog == 35 = 1.0.3 = 36 * Released: November 05, 2021 37 - Add post view to posts 35 38 36 39 = 1.0.2 =
Note: See TracChangeset
for help on using the changeset viewer.