Skip to content

Instantly share code, notes, and snippets.

View krzyspmac's full-sized avatar

Krzysztof Pawłowski krzyspmac

View GitHub Profile
@Mosharush
Mosharush / functions.php
Created September 27, 2017 10:48
WordPress PolyLang translate shortcode & function - use in customizer texts
<?php
// If Polylang is active, hook function on the admin pages
if ( function_exists( 'pll_register_string' ) ) add_action( 'admin_init', 'pll_tc_strings_setup' );
function pll_tc_strings_setup() {
// Add text to Polylang's string translation panel
pll_register_string( 'fl-topbar-col1-text', 'Contact_Data', 'wipi', true );
pll_register_string( 'fl-arrow-breadcrumbs', 'arrow_mulilang', 'wipi', true );
}
function polylanguage_shortcode( $atts ) {
local vector = {}
vector.__index = vector
local function is_vector(t)
return getmetatable(t) == vector
end
function vector.new(x, y)
return setmetatable({ x = x or 0, y = y or 0 }, vector)
end