Skip to content

Instantly share code, notes, and snippets.

View nmedia82's full-sized avatar

Najeeb Ahmad nmedia82

View GitHub Profile
@nmedia82
nmedia82 / functions.php
Created April 25, 2018 04:30
Change admin admin to get WooConvo notification
// Add this code at theme's function.php at bottom
add_filter('wooconvo_message_receivers', 'wooconvo_change_admin_email', 10, 2)
function wooconvo_message_receivers($receivers, $is_admin) {
if( $is_admin ) {
$receivers = array('your@email.com'); // add more email if need in array
}
return $receivers;
}
@nmedia82
nmedia82 / nmInputs.php
Last active September 21, 2017 04:24
NM Input Class
<?php
/**
* Inputs rendering class
**/
// constants/configs
define( 'ECHOABLE', false );
class NM_Form {
@nmedia82
nmedia82 / nm-wp-helper-functions.php
Created March 16, 2017 12:32
N-Media Helper Functions File
/**
* WPML
* registering and translating strings input by users
*/
if( ! function_exists('nm_wpml_register') ) {
function nm_wpml_register($field_value, $domain) {
$field_name = $domain . ' - ' . sanitize_key($field_value);
@nmedia82
nmedia82 / files-in-um-profile-tabs
Last active October 9, 2016 03:35
Adding Profile Tab in Ultimate Member Plugin to show Member Uploaded Files on Frontend
// this will add tab heading
add_filter('um_profile_tabs', 'user_files', 1000 );
function user_files($tabs) {
$tabs['userfiles'] = array(
'name' => 'My Files', // you can change this
'icon' => 'um-faicon-file', // you can change this
);
return $tabs;
@nmedia82
nmedia82 / wp-dynamic-css.php
Created October 6, 2016 04:43
How add dynamic css in WP plugin while rendering shortcode
function render_shortcode_template($atts){
extract(shortcode_atts(array(), $atts));
if($this -> get_option("_show_icons") == 'yes'){
wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css');
}
wp_enqueue_style($this->plugin_meta['shortname'].'-styles', $this->plugin_meta['url'].'templates/post-frontend-style.css');
//getting dynamic css
{
"name" : "File Upload and Download Manager",
"slug" : "nm-file-upload-manager-pro",
"download_url" : "",
"version" : "10.7",
"author" : "N-Media",
"sections" : {
"description" : "<h2>10.6 September 21, 2016 </h2>
<ul>
<li>Bug fixed: Files were renaming to 'blob', now it's fixed.</li>
@nmedia82
nmedia82 / secure-wp-query.php
Last active September 5, 2016 05:11
Wordpress secure way query into Database
// assumng col is a int value
$wpdb->query( $wpdb->prepare ("INSERT into table_name (col1, col2, col3) VALUES (%d, %s, %s)",
array('$value1','$value2', '$value3')
)
);
@nmedia82
nmedia82 / gist:2413afbc20bb7559de12
Last active August 29, 2015 14:23
N-Media File upload and download manager plugin hooks - wordpress plugin
// visit plugin url: http://najeebmedia.com/wordpress-plugin/wp-front-end-file-upload-and-download-manager/
/**
* change FROM EMAIL
* Notification when file uploaded by user
**/
add_filter('fileupload_from_email', 'change_from_email');
function change_from_email($dedault_email){
return 'any@otheremail.com';
@nmedia82
nmedia82 / gist:2875ca133caab3c90ddd
Last active August 29, 2015 14:22
N-Media Website Contact Form Filters
/**
** Following filter can be used to change FROM Email When Form is Submitted
** Plugin URL: http://najeebmedia.com/wordpress-plugin/wp-contact-form-file-upload/
**/
add_filter('webcontact_from_email', 'set_my_email', 10, 2);
/**
** @param:
** $email - default email
@nmedia82
nmedia82 / render-taxonomy-tree.php
Last active April 22, 2019 13:46
Rendering Taxonomy Tree for custom post types in Wordpress Plugin or Theme as checkbox input
/**
* Following script will render Taxonomy Tree attached with specified post type
* in following example post_type use: books
* output can be seen here: https://www.diigo.com/item/image/4xv00/xrhq
*/
$posttype = 'books'
//getting all taxonomies with attached with $posttype
$taxonomy_names = get_object_taxonomies( $posttype );