Skip to content

Instantly share code, notes, and snippets.

View icetee's full-sized avatar
:atom:
Development

Tamás András Horváth icetee

:atom:
Development
View GitHub Profile
@icetee
icetee / pll_change_language_nav.js
Last active August 29, 2015 14:23
Create polylang dropdown nav + remove old element
(function pll_change_language_nav() {
var $lang = $('html').attr('lang');
var $navbar = $('.navbar-nav');
var $navitem = 'li.lang-item';
var $changelang = "";
var lang = {};
if ( !$navbar.find($navitem).hasClass( "pll-lang" ) ) {
@icetee
icetee / wp_ext_pll_functions.php
Last active March 20, 2023 12:54
Polylang function_exists (active the plugin) - WordPress - Paste the code into functions.php
/*
* Polylang Language API functions tester - WordPress
* Github: https://gist.github.com/icetee/fbbfef5534fead58611e
*
*/
function ex_pll_the_languages($arg = '') {
if ( function_exists('pll_the_languages') ) {
return pll_the_languages($arg);
}
<?php
/*
* A walker class to use that extends wp_dropdown_categories and allows it to use the term's slug as a value rather than ID.
*
* See http://core.trac.wordpress.org/ticket/13258
*
* Usage, as normal:
* wp_dropdown_categories($args);
*
@icetee
icetee / wp_add_pll_lang_filter.php
Last active November 2, 2018 11:05
Polylang Language Filter for the post - WordPress
/*
* Polylang Language Filter for the post - WordPress
* Github: https://gist.github.com/icetee/2f7db2d4105006cb1080
*
* Require:
* SH_Walker_TaxonomyDropdown()
* https://gist.github.com/2902509
*
* Polylang function_exists (or no use ex_pll__() instead __() )
* https://gist.github.com/icetee/fbbfef5534fead58611e
@icetee
icetee / wp_get_custom_categories.php
Last active August 29, 2015 14:23
get_custom_categories() in WordPress
function get_custom_categories($slug) {
$args = array(
'hide_empty' => 1,
'orderby' => 'name',
'show_count' => 0,
'pad_counts' => 0,
'hierarchical' => 1,
'taxonomy' => $slug,
'title_li' => '',
@icetee
icetee / wp_remove_a_tag.php
Created June 22, 2015 08:19
remove_a_tag() in Wordpress
function remove_a_tag($string, $postid, $slug = true) {
$return = array();
preg_match_all("/<a.*?>(.*?)<\/a>/", $string, $matches);
foreach ($matches[1] as $key => $value) {
if ($slug == true) {
$return[] = sanitize_title($value);
@icetee
icetee / wp_create_category_translate.php
Last active August 29, 2015 14:23
Polylang translatable categories in WordPress
function create_category_translate() {
$currentScreen = get_current_screen();
if ( $currentScreen->base == "settings_page_mlang" ) {
$categories = get_custom_categories("portfolio_category");
foreach ($categories[1] as $cat) {
pll_register_string("Category", $cat);
@icetee
icetee / safari_font_fix
Created July 9, 2015 13:42
Safari font smoothing fix
body {
-webkit-font-smoothing: antialiased;
}
@icetee
icetee / squares_content.js
Created July 15, 2015 09:00
squares_content
(function squares_content($) {
var $selector = $('.views-row');
var max = Math.max.apply(Math, $selector.map(function(){ return $(this).height(); }).get());
$selector.height(max);
})(jQuery);
@icetee
icetee / config.json
Created July 28, 2015 15:18 — forked from anonymous/config.json
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",