Skip to content

Instantly share code, notes, and snippets.

View wbcomdev's full-sized avatar

Wbcom Dev wbcomdev

View GitHub Profile
@wbcomdev
wbcomdev / redirect-to-custom-login.php
Created October 23, 2024 13:37
redirect-to-custom-login.php
<?php
add_filter( 'buddyxpro_register_page_login_url', 'custom_register_page_login_url' );
function custom_register_page_login_url( $default_login_url ) {
// Replace 'your-custom-login-page' with the slug or URL of your custom login page.
$custom_login_url = home_url( '/your-custom-login-page/' );
// Return the custom login URL.
return $custom_login_url;
}
@wbcomdev
wbcomdev / custom-tab-page.php
Last active October 7, 2024 10:01
Custom Tab page
<?php
/**
* Business Single Custom Tab template file
*
* @package WordPress
* @subpackage bp-business-profile
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
@wbcomdev
wbcomdev / create-custom-tab.php
Created October 7, 2024 09:56
Create a custom tab
<?php
add_filter( 'bp_business_profile_single_menu_items', 'custom_business_tabs', 10, 2);
function custom_business_tabs($items, $endpoints) {
$items['custom-tab'] = 'Custom Tab';
return $items;
}
@wbcomdev
wbcomdev / Business-search.php
Created October 7, 2024 09:42
Search Businesses through Terms in search Box
<?php
add_filter( 'bp_business_profile_filter', 'bp_business_profile_search_filter', 99);
function bp_business_profile_search_filter( $args ) {
if ( isset( $_REQUEST['search_terms'] ) && ! empty( $_REQUEST['search_terms'] ) ) {
$new_args = $args;
$new_args['posts_per_page'] = '-1';
$new_args['meta_query']['relation'] = 'OR';
/*
* Add Multipal Meta Meta which also want to search results.
@wbcomdev
wbcomdev / change-ld-dashboard-in-loggedout-mode.php
Created September 16, 2024 14:04
change-ld-dashboard-in-loggedout-mode.php
<?php
add_filter('gettext', 'remove_admin_stuff', 20, 3);
/**
* Remove the text at the bottom of the Custom fields box in WordPress Post/Page Editor.
*
* @link https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function remove_admin_stuff( $translated_text, $untranslated_text, $domain ) {
$ld_dashboard_logout_message = 'Please try to login to website to access dashboard. Dashboard are disabled for logout members. ';
@wbcomdev
wbcomdev / woocommerce-enquiry-fields.php
Created June 19, 2024 08:27
create new field in woocommerce enquiry form
<?php
function add_more_fields_to_quotation_form() {
?>
<tr>
<th><?php esc_html_e( 'Phone', 'woocommerce-price-quote-pro' ); ?></th>
<td>
<input type="text" value="" id="mobile" name="mobile">
</td>
</tr>
<tr>
@wbcomdev
wbcomdev / 24hour-time-format.php
Created January 24, 2024 07:23
Change the default time format into 24 hor in BP Business Profile
<?php
/**
* Change business hr in 24hr format
*/
function wbcom_business_work_hour_24_hr_format( $work_hours ) {
$work_hours = array(
'00:00' => '00:00',
'00:15' => '00:15',
'00:30' => '00:30',
'00:45' => '00:45',
@wbcomdev
wbcomdev / shortcodefree-posting-form.php
Created January 23, 2024 06:22
Hide activities and show posting form only
/**
<?php
* Wbcom shortcode activity
*
*/
add_action('wp_head','wbcom_shortcode_activity_hide');
function wbcom_shortcode_activity_hide(){
global $post;
if( has_shortcode( $post->post_content, 'activity-listing' ) ){
?>
@wbcomdev
wbcomdev / restrict_cart_quantity.php
Created December 27, 2023 11:57
Restrict the user to checkout more than one services
<?php
function restrict_cart_quantity( $item ) {
$cart_items = edd_get_cart_contents();
if ( ! empty( $cart_items ) ) {
foreach ( $cart_items as $cart_item ) {
$product_type = get_post_meta( $cart_item['id'], '_edd_product_type', true );
if ( 'service' === $product_type ) {
edd_set_error( 'edd_one_product_limit', __( 'You can only add one service product to the cart.', 'your-textdomain' ) );
@wbcomdev
wbcomdev / upload-file-size.php
Created December 7, 2023 07:39
Restrict instructors to upload course images of particular sizes while creating new courses
<?php
add_filter( 'ld_dashboard_course_form_fields', function( $fields ) {
if( ! empty( $fields ) ) { //First we check fields are not empty
foreach ( $fields as $key => $field ) {
if( 'field_61fcef414383d' === $fields[$key]['key'] ){
$fields[$key]['max_width'] = 600; //Provide the value of maximum with of image that would be uploaded by instructor
$fields[$key]['max_height'] = 600; //Provide the value of maximum height of image that would be uploaded by instructor
$fields[$key]['max_size'] = 600; //Provide the value of size of image that would be uploaded by instructor
}