Skip to content

Instantly share code, notes, and snippets.

@wpweb101
wpweb101 / wpw_fp_post_display_followers_count.php
Created January 28, 2019 13:06
Display followers count after "Noify followers for this update" option
<?php // Do not add this if it's already added
function wpw_fp_display_followers_count ( $post ) {
$post_ID = $post->ID;
$followers_count = wpw_fp_get_post_followers_count( $post_ID );
echo '<div class="misc-pub-section misc-pub-section-last">
<span id="timestamp">
<label for="wpw_fp_followers_count"> '.__( 'Followers Count:', 'wpwfp' ).'
@wpweb101
wpweb101 / wpw_fp_post_update_email_notify_field.php
Created January 4, 2019 12:59
Follow My Blog Post - default selected the "Notify followers for this update" option to page or post
<?php
function wpw_fp_default_update_email_notify_field($notify_field) {
$notify_field['default'] = true;
return $notify_field;
}
// add filter to default check notify followers email checkbox
@wpweb101
wpweb101 / woo_vou_pdf_land_custom_height_width
Created December 1, 2018 12:31
Pdf Voucher code to set custom background image height and width for landscape view
<?php
// Code to set custom width for the pdf background image
function woo_vou_set_custom_bg_width( $height, $width){
return $width;
}
add_filter( 'woo_vou_pdf_land_bg_img_width', 'woo_vou_set_custom_bg_width', 10,2);
// Code to set custom height for the pdf background image
function woo_vou_set_custom_bg_height( $width, $height){
@wpweb101
wpweb101 / woo_vou_unlimited_code_pattern_modification
Last active November 30, 2018 07:26
PDF Voucher code for 4272
<?php
//Change voucher code to order number and 3-digit random number
function woo_vou_unlimited_code_pattern_modification( $voucodes_args = array() ) {
if( !empty( $voucodes_args ) && array_key_exists( 'order_id', $voucodes_args ) ) {
$digits = 3; // Amount of digits
$min = pow(10, $digits - 1 );
@wpweb101
wpweb101 / woo_vou_pdf_order_items_meta_shortcodes.php
Last active September 26, 2018 05:53
WooCommerce Pdf Vouchers - Create custom shortcode for display order item meta download PDF
<?php
/**
* Adding order meta value to the Custom shortcode in PDF voucher
*/
function woo_vou_pdf_order_items_meta_shortcodes( $voucher_template_html, $orderid, $item_key, $items, $voucodes, $productid) {
$hidden_order_itemmeta = apply_filters( 'woocommerce_hidden_order_itemmeta', array(
'_qty',
@wpweb101
wpweb101 / wpw_auto_poster_relative_image_src.php
Last active September 15, 2018 07:25
Social Auto Poster - Filter code for allowed relative image url instead of full image url
<?php // Do not add this if it's already added on your file.
// Filter code for allowed relative image url instead of full image url
add_filter('wpw_auto_poster_social_media_posting_image', 'wpw_sap_custom_relative_image_src');
function wpw_sap_custom_relative_image_src( $img_src ) {
if( !empty( $img_src ) ){
if( is_array( $img_src ) ){
@wpweb101
wpweb101 / wp-sap-change-table-collection.php
Last active September 10, 2018 07:54
Social Auto Poster - Change table collection and character set
<?php
/**
* Add this in child theme function.php file.
*/
add_action('wp', 'wp_change_table_collection');
function wp_change_table_collection() {
global $wpdb;
@wpweb101
wpweb101 / class-woo-cl-model.php
Created August 20, 2018 11:59
Modify Collection Author URL to BuddyPress Member Page
<?php
/**
* Change collection author url to buddypress member page.
*/
add_filter( 'woo_cl_get_collection_page_url', 'custom_woo_cl_get_collection_page_url', 10, 2 );
function custom_woo_cl_get_collection_page_url( $coll_page_url, $user_name ) {
//Check if buddypress active
if( class_exists( 'BuddyPress' ) ) {
return bp_get_members_directory_permalink() . $user_name;
@wpweb101
wpweb101 / woo_vou_remove_dashboard_widget_for_vendor
Created August 20, 2018 11:21
WooCommerce Pdf Vouchers - Code to remove Voucher status Widget area from the admin dashboard for Voucher Vendor role
// code to remove WooCommerce Pdf Voucher dashboard widget
global $woo_vou_admin;
if( is_user_logged_in() ){
$user = wp_get_current_user();
// woo_vou_vendors you can change user role if you want to remove dashboard for any other role
if( !empty( $user ) && in_array( 'woo_vou_vendors' , $user->roles ) ) {
remove_action('wp_dashboard_setup', array( $woo_vou_admin,'woo_vou_add_dashboard_widgets') );
}
}
@wpweb101
wpweb101 / woo-vou-compatibility-with-jupiter.php
Last active June 27, 2018 13:34
WooCommerce PDF Voucher - Recipient details not showing on variable product with Jupiter theme
<?php
/*
* Jupiter (version 5.6) theme have overide tempalte called "variation-add-to-cart-button.php".
*
* Path: jupiter/woocommerce/singe-product/add-to-cart/variation-add-to-cart-button.php
*
* PDF Voucher using "woocommerce_before_add_to_cart_button" action which is provided by WooCommerce but jupiter removed that.
* That's why on variable product it's not showing recipient details
*