Skip to content

Instantly share code, notes, and snippets.

View rahularyan's full-sized avatar
🏠
Working from home

Rahul Arya rahularyan

🏠
Working from home
View GitHub Profile
<scrip>
$.ajax({
type:'post',
url : ajax_url,
data: {
action:'hello_ajax'
},
success: function (response) {
consloe.log(responce);
},
<?php
// register javascripts
qw_apply_filter('enqueue_scripts','qw_admin_enqueue_scripts');
function qw_admin_enqueue_scripts($src){
if (qa_request() == 'themeoptions') {
$src['qw_admin'] = QW_CONTROL_URL . '/js/admin.js';
}
$src['jquery'] = QW_CONTROL_URL. '/js/jquery-1.11.0.min.js';
return $src;
<?php
//like you want to override form_field($field, $style), then do this:
qw_add_action('form_field', 'my_form_field_override');
function my_form_field_override($themeclass, $field, $style){
if (@$field['type'] == 'qw_qaads_multi_text') {
$themeclasss->form_prefix($field, $style);
$themeclass->qw_qaads_form_multi_text($field, $style);
$themeclass->form_suffix($field, $style);
<?php
qw_apply_filter('doctype','navigation');
function navigation($themeclass) {
$link = array(
'label' => qa_lang_html('notification/notf_settings_user_nav'),
'url' => qa_path_html('notification-settings'),
'icon' => 'icon-cog' ,
);
if(qa_is_logged_in()) {
@rahularyan
rahularyan / add_widget_position.php
Created June 19, 2014 03:06
Add custom widget positions in qawork
<?php
// register position name
qw_apply_filter('widget_positions', 'qw_register_widget_positions');
function qw_register_widget_positions($positions){
$new_positions = array(
'My Custom Position' => 'Below header',
'My Custom Footer' => 'Custom footer position',
);
return array_merge($positions, $new_positions);
// Short version: you can simply use below line
add_filter('ap_user_profile_active', '__return_false');
//Long version: if you dont understand what above code is for then this code will will tell you
function my_disable_anspres_profile(){
return false;
}
add_filter('ap_user_profile_active', 'my_disable_anspres_profile');
@rahularyan
rahularyan / gist:5e6932f36cbbd2938de9
Created May 10, 2015 11:24
Alter AnsPress tab titles
/**
* Filter for altering link from question list tab
* @param array $nav contain link of tab in array
* @return array
*/
function my_alter_ap_tab_item($nav){
$nav['newest']['title'] = __('Latst');
return $nav;
}
add_filter('ap_questions_tab', 'my_alter_ap_tab_item');
// Short version: you can simply use below line
add_filter('ap_user_profile_active', '__return_false');
<?php the_widget( 'AnsPress_Subscribe_Widget' ); ?>
/**
* add category field in ask form
* @param array $validate
* @return void
*/
function ask_from_category_field($args, $editing){
if(wp_count_terms('question_category') == 0)
return $args;
global $editing_post;