Skip to content

Instantly share code, notes, and snippets.

View joviczarko's full-sized avatar
🎯
Focusing

Jović Žarko joviczarko

🎯
Focusing
View GitHub Profile
@joviczarko
joviczarko / import-taxonomy-terms.php
Last active August 4, 2024 10:46
Import taxonomy countries but have country codes as slug
<?php function insert_country_terms() {
$taxonomy = 'country'; // Your custom taxonomy slug
// Define the countries hierarchy with country codes as values
$countries_hierarchy = array(
'Africa' => array(
'Algeria' => 'DZ',
'Angola' => 'AO',
'Benin' => 'BJ',
'Botswana' => 'BW',
@joviczarko
joviczarko / import-taxonomy-terms.php
Created July 29, 2024 09:05
Importing countries in taxonomy hierarchically per region/continent
<?php
/**
* Intended to run via WP-CLI using 'wp eval-file import-taxonomy-terms.php' command
*/
// Ensure WordPress is loaded
if ( ! defined('WPINC') ) {
die;
}
Hash change of Bootstrap Tab
----------------------------
customized bootstrap tab component. here hash address will be changing on clicking on the tabs. and when ever copy this changed address to a browser url address accordingly it will show corresponding content in tabs
@joviczarko
joviczarko / function.php
Created November 19, 2020 00:11
Add countries as a custom taxonomy term
<?php
add_action('init', 'add_countries', 100);
function add_countries()
{
$country_array = array (
'AF' => 'Afghanistan',
'AX' => 'Åland Islands',
'AL' => 'Albania',
@joviczarko
joviczarko / style.scss
Created September 10, 2020 14:01
Ordered list number
.ordered-numbers-list {
list-style: none;
counter-reset: order-counter;
li {
counter-increment: order-counter;
margin-bottom: 30px;
display:flex;
&::before {
content: counter(order-counter);
font-weight: bold;
@joviczarko
joviczarko / style.css
Last active May 13, 2020 23:12
Equal height of bootstrap 4 columns
.row.equalize {
display: flex;
flex-wrap: wrap;
}
.row.equalize > [class*="col-"] {
display: flex;
flex-direction: column;
}
@joviczarko
joviczarko / style.scss
Last active April 25, 2020 17:38
Five columns Bootstrap grid (BOOTSTRAP v4!) (Adding five column layout for bootstrap)
// *** Bootstrap five columns *** //
.col-5th {
flex: 0 0 20%;
max-width: 20%;
}
@include r("tablet") {
.col-sm-5th {
flex: 0 0 20%;
@joviczarko
joviczarko / mixins.scss
Last active April 25, 2020 16:32
Responsive utility (tweaked)
// Media query mixins
@mixin r($point) {
@if $point== "mobile" {
@media (max-width: 767px) {
@content;
}
}
@if $point==768 or $point== "tablet" {
@media (min-width: 768px) {
@content;
@joviczarko
joviczarko / functions.php
Last active April 18, 2020 11:25
Wordpress numbered pagination
<?php
/**
* Set text domain
*/
function get_text_domain() {
return 'textdomain';
}
/**
@joviczarko
joviczarko / header.php
Created September 26, 2019 15:41
Display WPML language buttons custom with current language
<?php
$languages = icl_get_languages('skip_missing=0');
if(1 < count($languages)){
echo '<ul>';
foreach($languages as $l){
if(!$l['active']) {
$lang = '<li class="lang-button"><a href="'.$l['url'].'">'.$l['language_code'].'</a></li>';
} else {
$lang = '<li class="lang-button"><a class="current-lang" href="'.$l['url'].'">'.$l['language_code'].'</a></li>';
}