Skip to content

Instantly share code, notes, and snippets.

@goliver79
goliver79 / functions.php
Created February 5, 2014 14:17
[WORDPRESS] Load Textdomain
<?php
// textdomain
add_action( 'after_setup_theme', 'my_theme_setup' );
function my_theme_setup(){
load_theme_textdomain( 'my_textdomain', get_stylesheet_directory(). '/lang' );
}
@goliver79
goliver79 / functions.php
Last active May 19, 2016 14:02
[WOOCOMMERCE] Translate product variations labels and names using filters
<?php
/**
*
* Translate product variations labels and names with filters
* lgpd_translate_attributes_label
* lgpd_translate_variation_option_name
*/
add_filter( 'woocommerce_variation_option_name', 'translate_variation_option_name' );
add_filter( 'woocommerce_attribute_label', 'translate_attributes_label' );
function translate_attributes_label( $result ){
@goliver79
goliver79 / functions.php
Created February 5, 2014 14:32
[WORDPRESS] Register scripts, styles and shortcodes
<?php
/**
* register scripts
*
*/
add_action( 'init', 'lgpd_register_scripts' );
function lgpd_register_scripts(){
/* zebra datepickeer: http://stefangabos.ro/jquery/zebra-datepicker/ */
wp_register_script( 'js-zebra-datepicker', get_stylesheet_directory_uri() . '/inc/js/zebra_datepicker.js', array( 'jquery' ), '1.0' );
wp_register_script( 'js-lgpd', get_stylesheet_directory_uri() . '/inc/js/lgpd.js', array( 'jquery' ), '1.0' );
@goliver79
goliver79 / functions.php
Created February 5, 2014 14:35
[WOOCOMMERCE] Modify navigation search form
<?php
/**
* modify search form
* - "search for products" string translate
* - language for qTranslate
*/
add_action( 'after_setup_theme', 'lgpd_change_search_nav' );
function lgpd_change_search_nav(){
remove_action('woo_nav_before', 'wootique_header_search');
add_action('woo_nav_before', 'lgpd_wootique_header_search');
@goliver79
goliver79 / functions.php
Created February 5, 2014 14:36
[WORDPRESS] Show current cookies
<?php
/**
* Function for show current cookies
* @param string $paras
* @param string $content
* @return Ambigous <string, string, mixed>
*/
function lgpd_get_cookies( $paras = '', $content = '' ) {
if ( strtolower( $paras[ 0 ] ) == 'novalue' ) {
$novalue = true;
@goliver79
goliver79 / functions.php
Created February 5, 2014 14:38
[WORDPRESS] Get post by slug
<?php
/*
* get post by slug
*/
function wp_get_post_by_slug( $slug, $post_type = 'post', $unique = true ){
$args=array(
'name' => $slug,
'post_type' => $post_type,
'post_status' => 'publish',
'posts_per_page' => 1
@goliver79
goliver79 / gists-eclipse.md
Created February 7, 2014 07:17
[ECLIPSE] Gists in Eclipse
@goliver79
goliver79 / FirstActivity.java
Last active December 23, 2020 08:43
[ANDROID] Start new Activity
public void sendMessage(View view) {
Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
EditText editText = (EditText) findViewById(R.id.edit_message);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
@goliver79
goliver79 / ActivityTwo.java
Created February 8, 2014 08:24
[ANDROID] Close Activity on click button
// using finsih()
Button closeButton = (Button) findViewById(R.id.bClose);
closeButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ActivityTwo.this.finish();
}
});
@goliver79
goliver79 / adb_dumpsys.bat
Created February 10, 2014 07:00
[ANDROID] Get installed apps permissions
adb shell dumpsys package