Skip to content

Instantly share code, notes, and snippets.

View ihorvorotnov's full-sized avatar
🇺🇦
Working remotely since 1999

Ihor Vorotnov ihorvorotnov

🇺🇦
Working remotely since 1999
View GitHub Profile
<?php
add_action('gform_after_submission', 'gfToAcfListToRepeater', 10, 2);
function gfToAcfListToRepeater($entry, $form)
{
foreach ($form['fields'] as $field) {
if (!($field['type'] == 'post_custom_field' && $field['inputType'] == 'list' && $field['enableColumns'] == true)) {
continue;
}
$id = $field['id'];
/**
* Get post thumbnail url
*/
function get_image_url(){
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src( $image_id, 'full', false );
$image_url = $image_url[0];
echo $image_url;
@ihorvorotnov
ihorvorotnov / index.html
Last active August 29, 2015 22:42 — forked from benschwarz/index.html
Using ARIA roles with <header>, <footer> and <aside>
<!doctype html>
<html>
<body>
<header role="banner">
<a href="/" rel="home">My company</a>
<nav role="navigation">
<a href="/about">About</a>
<a href="/contact">Contact</a>
</nav>
</header>
@ihorvorotnov
ihorvorotnov / .gitconfig
Last active September 20, 2015 14:04 — forked from shawndumas/.gitconfig
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@ihorvorotnov
ihorvorotnov / full-image-quality.php
Last active September 20, 2015 20:51 — forked from raewrites/full-image-quality.php
Full Image Quality
add_filter( 'jpeg_quality', create_function( '', 'return 100;' ) );
# Create a repository archive
# Format: git archive {branchname} --format={compression} --output={filename}
git archive master --format=tar --output=kuma.tar
git archive some-feature-branch --format=tar --output=kuma.tar
@ihorvorotnov
ihorvorotnov / gist:6e2acd9badecea2b0f77
Created September 30, 2015 15:15
Remove WP.org logo and links from toolbar
add_action( 'admin_bar_menu', 'remove_wp_logo', 999 );
function remove_wp_logo( $wp_admin_bar ) {
$wp_admin_bar->remove_node( 'wp-logo' );
}
@ihorvorotnov
ihorvorotnov / publickey-git-error.markdown
Created October 3, 2015 01:31 — forked from adamjohnson/publickey-git-error.markdown
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "[email protected]". Th
@ihorvorotnov
ihorvorotnov / wp-translation-strings.php
Last active October 22, 2015 14:49
Complex translation strings in WordPress themes and plugins
<?php
/**
* The following is the proper way to handle complex translation strings.
* By Justin Tadlock
* @see https://wpchat.com/t/do-you-use-format-placeholders-s-and-d-in-translatable-strings/1138/11
*/
$number = get_donation_count();
$string = sprintf(
// translators: %s is the number of donations.
@ihorvorotnov
ihorvorotnov / nav_metabox.php
Last active February 3, 2016 18:42 — forked from johnmorris/gist:5221875
Custom metabox for navigation menus
if ( !class_exists('JMO_Custom_Nav')) {
class JMO_Custom_Nav {
public function add_nav_menu_meta_boxes() {
add_meta_box(
'wl_login_nav_link',
__('WishList Login'),
array( $this, 'nav_menu_link'),
'nav-menus',
'side',
'low'