by Puneet Kalra | Aug 23, 2017 | All , Gists |
Load Beaver Builder layouts and templates from PHP.
Load Beaver Builder layouts, templates and rows from PHP and render the content from specific post.
<?php
global $post ;
$post_ID = 123 ;
$module_ID = 234 ;
$post = get_post ( $post_ID ) ; // Set the post ID to render from
FLBuilderModel:: set_post_id ( $post_ID ) ; // Use the same post ID on Beaver
FLBuilder:: enqueue_layout_styles_scripts_by_id ( $module_ID ) ; // Load related styles and scripts.
FLBuilder:: render_content_by_id ( $module_ID ) ; // Layout, Template or row ID
FLBuilderModel:: reset_post_id ( ) ; // Reset post to original on Beaver
wp_reset_query ( ) ; // Reset query on WP
?>
by Puneet Kalra | Aug 22, 2017 | All , Gists |
How to check if a user is in a specific role in WordPress?
To get user roles of currently logged in user and match it against a specific user role.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
// Get current logged in users object
$current_user = wp_get_current_user ( ) ;
// Make sure it is WP_User object
if ( ! ( $current_user instanceof WP_User ) ) { return ; }
// Get user roles from object
$roles = $current_user -> roles ;
// Match it against the 'administrator' user role
if ( in_array ( 'administrator' , $roles ) ) {
// Logged user is admin. Code here
} else {
// Logged user is NOT admin. Show error
}
?>
by Puneet Kalra | Jun 12, 2015 | All , Videos |
Speech Recognizer in java using Eclipse SDK.
I’m using Sphinx 4. It’s a Speech Recognizer API (no synthesizer) written in java. Sphinx 4 is an implementation of Java Speech API (JSAPI) 1.0.
Requirements to work according to the tutorial :
1 ) JDK 6 ( J2SE )
2 ) Eclipse SDK ( Im using Eclipse 3.4.0 )
3 ) Sphinx 4.0
4 ) JSAPI ( Included in Sphinx 4.0 )
VIDEO
Other Articles :
Basics of Java Speech Grammar Format ( JSGF )
https://puneetk.com/basics-of-java-speech-grammar-format-jsgf
Expanding Dictionary Of Acoustic Model
https://puneetk.com/expanding-dictionary-of-acoustic-model
How To Improve Accuracy ( Sphinx 4 )
https://puneetk.com/how-to-improve-accuracy-sphinx-4
by Puneet Kalra | Jun 12, 2015 | All , Videos |
Object Detection and Segmentation application for Android.
Screenshots and video, both are taken on Samsung Galaxy Tab 2 7.0
I developed this application as project assignment which unfortunately didn’t go well. So, I’m sharing results here. Please feel free to share your thoughts.
VIDEO
by Puneet Kalra | Jun 12, 2015 | All , Videos |
Speech Recognizer in java using Eclipse SDK.
Im using Sphinx 4.0. Its a Speech Recognizer (no synthesizer) written in java. Sphinx is an implementation of Java Speech
API (JSAPI) 1.0 and you must have JSAPI installed on your machine.
Part Three
VIDEO
Recent Comments