Skip to content

Instantly share code, notes, and snippets.

View sadrul's full-sized avatar

Sadrul sadrul

  • Salzburg, Austria
View GitHub Profile
@slaFFik
slaFFik / bp-xprofile-countries-list.php
Last active April 1, 2021 14:57 — forked from shanebp/BuddyPress xprofile add countries
BuddyPress xProfile - Add Countries
<?php
/**
* If you are using BP 2.1+, this will insert a Country selectbox.
* Add the function to bp-custom.php and then visit .../wp-admin/users.php?page=bp-profile-setup
*/
function bp_add_custom_country_list() {
if ( !xprofile_get_field_id_from_name('Country') && 'bp-profile-setup' == $_GET['page'] ) {
@mrded
mrded / gist:9e11aea4ff0592de586b
Last active February 15, 2017 14:32
Drupal: Database Abstraction Layer
<?php
// SELECT One field: SELECT title FROM {node} WHERE nid = 123
$title = db_select('node', 'n')
->fields('n', array('title'))
->condition('n.nid', 123)
->execute()
->fetchField();
// SELECT One object: SELECT title FROM {node} WHERE nid = 123
@RadGH
RadGH / wordpress-tinymce.js
Last active October 21, 2022 01:21
Get/Set content of a TinyMCE visual or text editor with JavaScript
/*
Based on: http://wordpress.stackexchange.com/questions/42652/#answer-42729
These functions provide a simple way to interact with TinyMCE (wp_editor) visual editor.
This is the same thing that WordPress does, but a tad more intuitive.
Additionally, this works for any editor - not just the "content" editor.
Usage:
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );