Skip to content

Instantly share code, notes, and snippets.

View elias1435's full-sized avatar
🕋
Working from home

Md. Elias elias1435

🕋
Working from home
View GitHub Profile
@bueltge
bueltge / post-process.php
Created June 24, 2011 21:08
WordPress Custom Post Type: Insert post via Frontend
<?php
/**
* post-process.php
* make sure to include post-process.php in your functions.php. Use this in functions.php:
*
* get_template_part('post-process');
*
*/
function do_insert() {
if( 'POST' == $_SERVER['REQUEST_METHOD']
@mikejolley
mikejolley / gist:1597957
Created January 12, 2012 01:40
WooCommerce - Replace '' with 'Call for price' when price is left blank
/**
* This code should be added to functions.php of your theme
**/
add_filter('woocommerce_empty_price_html', 'custom_call_for_price');
function custom_call_for_price() {
return 'Call for price';
}
@BFTrick
BFTrick / gettext-filter-multiple.php
Last active March 30, 2023 07:18
Use the gettext WordPress filter to change any translatable string.
<?php
/**
* Change text strings
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Sale!' :
$translated_text = __( 'Clearance!', 'woocommerce' );
@ultimatemember
ultimatemember / gist:8cdaf61e7bd9de35512c
Last active April 19, 2021 20:35
Extending Ultimate Member Profile Menu using Hooks
/* First we need to extend main profile tabs */
add_filter('um_profile_tabs', 'add_custom_profile_tab', 1000 );
function add_custom_profile_tab( $tabs ) {
$tabs['mycustomtab'] = array(
'name' => 'My custom tab',
'icon' => 'um-faicon-comments',
);

Multiple Sticky Titles with CSS and JS

On some mobile platforms there are alphabetical lists that use the letter as a title. As you scroll down the list the current title follows you until you reach the next one at which point the current one is pushed up and the new title docks to the top. This snippet emulates this functionality.

Forked from Chris Spittles's Pen Multiple Sticky Titles with CSS and JS.

A Pen by Captain Anonymous on CodePen.

@ashwebstudio
ashwebstudio / woocommerce-acf-tabs
Created February 25, 2016 09:39
WooCommerce tabs using Advanced Custom Fields
// First create a field group assigned to the Product custom post type
// Make a repeater field with sub-fields "Title" (text) and "Content" (WYSIWYG)
add_filter( 'woocommerce_product_tabs', 'custom_tabs' );
function custom_tabs( $tabs ) {
global $post;
$priority = 100;
while ( has_sub_field( 'tabs', $post->ID ) ) {
$title = get_sub_field( 'title' );
@andrewlimaza
andrewlimaza / change-default-checkout-button-pmpro.php
Last active July 11, 2023 08:12
Change default checkout button text for Paid Memberships Pro
<?php
//copy lines 5 - 20 to your active theme's functions.php or custom plugin. (edit line 11 to change text of button).
function my_pmpro_change_default_button_text( ){
//copy over HTML code from checkout.php to keep styling and simply change the text value to 'Create Account'
?>
<span id="pmpro_submit_span">
<input type="hidden" name="submit-checkout" value="1" />
@lewebsimple
lewebsimple / acf-dynamic-role.php
Created August 10, 2017 15:01
ACF role-based conditions on user new / edit forms
<?php
// Change default role dynamically on role selection change
add_action( 'acf/input/admin_head', 'acf_dynamic_default_role' );
function acf_dynamic_default_role() {
global $pagenow;
if ( $pagenow == 'user-new.php' ) {
?>
<script>
@FranciscoG
FranciscoG / acf_repeater_shortcode.php
Last active April 18, 2024 00:00
An Advanced Custom Fields shortcode that allows to loop through a field with a repeater. This only handles simple cases, it can't handle nested repeater fields
<?php
/**
* ACF Pro repeater field shortcode
*
* I created this shortcode function because it didn't exist and it was being requested by others
* I originally posted it here: https://support.advancedcustomfields.com/forums/topic/repeater-field-shortcode/
*
* @attr {string} field - (Required) the name of the field that contains a repeater sub group
* @attr {string} sub_fields - (Required) a comma separated list of sub field names that are part of the field repeater group
* @attr {string} post_id - (Optional) Specific post ID where your value was entered. Defaults to current post ID (not required). This can also be options / taxonomies / users / etc
@rifkyfu32
rifkyfu32 / Allow everyone to upload profile registration pages.txt
Last active November 30, 2021 22:03
Customization allow everyone to upload profile on registration pages - Ultimate Member 2.0 +
1.Copy the bellow code in your theme's function.php file. Should be in public_html/wp-content/themes/your-themes-name/function.php
/**
* Ultimate Member 2.0 - Customization
* Description: Allow everyone to upload profile registration pages.
*/
add_filter("um_user_pre_updating_files_array","um_custom_user_pre_updating_files_array", 10, 1);
function um_custom_user_pre_updating_files_array( $arr_files ){
if( is_array( $arr_files ) ){