Skip to content

Instantly share code, notes, and snippets.

View ulziibat-n's full-sized avatar
💭
Everyday Hard Working ...

Ulziibat Nansaltsog ulziibat-n

💭
Everyday Hard Working ...
  • Mongolia
View GitHub Profile
@igorbenic
igorbenic / block.js
Last active April 22, 2022 22:25
Gutenberg Select Post - Duplicate Controls
/**
* BLOCK: my-block
*
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
*/
// Import CSS.
import './style.scss';
import './editor.scss';
@nicomollet
nicomollet / polylang-langswitcher-shortcode.php
Last active January 17, 2024 11:25
Polylang shortcode for lang switcher
<?php
/**
* Polylang Shortcode - https://wordpress.org/plugins/polylang/
* Add this code in your functions.php
* Put shortcode [polylang_langswitcher] to post/page for display flags
*
* @return string
*/
function custom_polylang_langswitcher() {
$output = '';
@aristath
aristath / custom-post-type-plugin.php
Last active July 21, 2021 13:08
sample theme to test REST
<?php
/**
* Plugin Name: Code Meta fields.
*
* @package My Theme
*/
/**
* Register the post-type.
*/
<?php
function idesign_customizer_config() {
$url = get_stylesheet_directory_uri() . '/inc/kirki/';
/**
* If you need to include Kirki in your theme,
* then you may want to consider adding the translations here
@nicomollet
nicomollet / elementorcssinhead.php
Last active December 6, 2022 09:21
Load Elementor styles on all pages in the head to avoid CSS files being loaded in the footer
<?php
/**
* Load Elementor styles on all pages in the head to avoid CSS files being loaded in the footer
*/
function elementor_css_in_head(){
if(class_exists('\Elementor\Plugin')){
$elementor = \Elementor\Plugin::instance();
$elementor->frontend->enqueue_styles();
}
if(class_exists('\ElementorPro\Plugin')){
@nicomollet
nicomollet / elementor-category-posts-per-page.php
Last active September 10, 2019 14:16
Elementor: Force posts per page number for posts widget on Category Pages
<?php
/**
* Elementor: Force posts per page number for posts widget on Category Pages
*
* @param $query
*/
function elementor_category_posts_per_page( $query ) {
$category_id_or_slug = 'myslug';
@nicomollet
nicomollet / yoastseo-add-breadcrumb-link.php
Last active June 9, 2023 12:51
Yoast SEO add first link in breadcrumb
@nicomollet
nicomollet / yoastseo-remove-breadcrumb-link.php
Last active June 1, 2023 01:11
Yoast SEO remove breadcrumb link
@aristath
aristath / aricolor.md
Last active December 18, 2020 10:48
ariColor PHP Library for WordPress plugins and themes

ariColor is a PHP library that will hopefully help WordPress theme developers do their job easier and more effectively.

It does not provide you with methods like lighten(), darken() etc. Instead, what it does is give you the ability to create these yourself with extreme ease by giving you all the properties of a color at hand, and allowing you to manipulate them however you see fit.

Example:

First, let's create our color object:

$color = ariColor::newColor( '#049CBE', 'hex' );
@rvl
rvl / git-pushing-multiple.rst
Created February 9, 2016 11:41
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just