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
<?php
function my_ap_user_link($links){
unset($links['profile']); //This will remove profile
unset($links['reputation']); // This will remove reputation
unset($links['questions']); // This will remove questions
unset($links['answers']); //This will remove answers
unset($links['followers']); // This will remove followers
unset($links['following']); // this will remove following
<?php
/**
* This filter will override AnsPress rewrite rule
* @param array $rules
**/
function my_custom_ap_rewrite($rules){
global $wp_rewrite;
$base_page_id = ap_opt('base_page');
<?php
function after_new_question($post_id, $post) {
update_post_meta($post_id, ANSPRESS_VOTE_META, '0');
update_post_meta($post_id, ANSPRESS_SUBSCRIBER_META, '0');
update_post_meta($post_id, ANSPRESS_CLOSE_META, '0');
update_post_meta($post_id, ANSPRESS_FLAG_META, '0');
update_post_meta($post_id, ANSPRESS_VIEW_META, '0');
update_post_meta($post_id, ANSPRESS_UPDATED_META, current_time('mysql'));
update_post_meta($post_id, ANSPRESS_SELECTED_META, false);
<?php
$db = @mysql_connect('localhost', 'username', 'password') or die(mysql_error());
mysql_select_db('database_name', $db) or die(mysql_error());
$qry_qbank = mysql_query("SELECT * FROM Table_Name limit 0, 100") or die(mysql_error());
require('wp-blog-header.php');
while ($row = mysql_fetch_array($qry_qbank)) {
$qno = $row['id'];
/*
Theme Name: AskBug Child
Theme URI: http://anspress.io/download/askbug/
Author: Rahul Aryan
Template: askbug
Author URI: http://anspress.io/
Description: AskBug is a theme for question and answer community site based on AnsPress plugin. This theme can be used to create a big community site or a simple support site.
Version: 1.2
License: GNU General Public License v3.0 /
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@rahularyan
rahularyan / functions.php
Created August 11, 2015 01:10
askbug child theme functions.php
<?php
/**
* Import parent theme style
*/
add_action( 'wp_enqueue_scripts', 'askbugchild_enqueue_styles' );
function askbugchild_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
<?php
$db = @mysql_connect('localhost', 'username', 'password') or die(mysql_error());
mysql_select_db('database_name', $db) or die(mysql_error());
$qry_qbank = mysql_query("SELECT * FROM Table_Name limit 0, 100") or die(mysql_error());
while ($row = mysql_fetch_array($qry_qbank)) {
$qno = $row['id'];
$question_title = $row['Question_Title'];
@rahularyan
rahularyan / blog-template.php
Last active August 29, 2015 14:27
Blog page template
<?php
/**
* Template Name: Blog Page
* Template used to display blog page
*
* @package ab
*/
get_header(); ?>
<div class="container">
CREATE TABLE IF NOT EXISTS `at_qa_dump` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Question_Title` text,
`Question_Content` text,
`Answer_Content` text,
`Category_Id` int(11) DEFAULT NULL,
`Tag_Id` int(11) DEFAULT NULL,
`Question_User_Id` int(11) DEFAULT 1,
`Answer_User_Id` int(11) DEFAULT 2,
`AnsPress_Question_Id` varchar(255) DEFAULT NULL,
<?php
function my_override_ap_icon($icon) {
if($icon == 'chevron-down')
return 'apicon-reputation';
return $icon;
}
apply_filter('ap_icon', 'my_override_ap_icon');