Skip to content

Instantly share code, notes, and snippets.

View hayatbiralem's full-sized avatar

Ömür Yanıkoğlu hayatbiralem

View GitHub Profile
@hayatbiralem
hayatbiralem / runcloud-hub.php
Created May 13, 2022 22:57
RunCloud Hub WPML Support
<?php
/**
* @wordpress-plugin
* Plugin Name: RunCloud Hub
* Description: RunCloud server-side caching for WordPress, Nginx FastCGI/Proxy Cache and Redis Object Cache
* Author: RunCloud
* Author URI: https://runcloud.io/
* Version: 1.2.1
* Requires at least: 4.9
* License: GPL-2.0 or later
@hayatbiralem
hayatbiralem / gist:eb25df49899cd1f97616ce72253724e0
Created July 14, 2021 09:07
Parse published (public) Google Spreadsheet HTML data into Javascript array
// Thanks to this gist: [Sample HTML/JS to parse a Google Spreadsheet](https://gist.github.com/terrywbrady/a03b25fe42959b304b1e)
var htmlEndPoint = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vREXBtuL2uKofq9ufXsIlytbONUR0-q_tf1Ucm14JpeE5KAdry97CCwvivf3e5NkCAnZ1Xg4qYa0RCo/pubhtml';
(function($){
var parseHtmlTableToJson = function($table){
var data = [];
var $headers = $("tr:first-child td", $table);
var headers = [];
@hayatbiralem
hayatbiralem / parseGoogleSpreadsheetJsonIntoArray.js
Created July 14, 2021 08:34
Parse published (public) Google Spreadsheet JSON data into Javascript array
// Thanks to this gist: [Sample HTML/JS to parse a Google Spreadsheet](https://gist.github.com/terrywbrady/a03b25fe42959b304b1e)
var id = '1g3471DBNQEg0v_ByMBx1gNDx5cmlN5Ikn3f1DgJtQY8';
var jsonEndPoint = 'https://spreadsheets.google.com/feeds/cells/'+id+'/1/public/values?alt=json';
var parseGoogleSpreadsheetJsonIntoArray = function (response){
// Check the markup hasn't changed
if(response.feed && response.feed.entry && response.feed.entry[0] && response.feed.entry[0].gs$cell) {
var headings = [];
var data = [];
@hayatbiralem
hayatbiralem / filter_ct_template_archive_among_taxonomies.php
Last active July 11, 2021 21:39
WPML support for Oxygen Builder's taxonomy templates
<?php
function my_prefix_filter_ct_template_archive_among_taxonomies($metadata, $object_id, $meta_key, $single)
{
$meta_needed = 'ct_template_archive_among_taxonomies';
if (!is_admin() && isset($meta_key) && $meta_needed == $meta_key) {
remove_filter('get_post_metadata', 'my_prefix_filter_ct_template_archive_among_taxonomies', 100);
$current_meta = get_post_meta($object_id, $meta_needed, true);
add_filter('get_post_metadata', 'my_prefix_filter_ct_template_archive_among_taxonomies', 100, 4);
@hayatbiralem
hayatbiralem / email.js
Last active April 13, 2021 23:14
Email PHP and jQuery Ajax Scripts for Webflow HTML Export with Google Recaptcha
(function ($) {
var Webflow = window.Webflow || [];
Webflow.push(function () {
// === Custom Form Handling ===
// unbind webflow form handling
$(document).off('submit');
// new form handling
@hayatbiralem
hayatbiralem / remove_noindex_category_posts_from_sitemap.php
Created March 1, 2021 07:49
Yoast WP Seo - How to remove noindex category posts from sitemap
<?php
if (!class_exists('myprefix_remove_noindex_category_posts_from_sitemap')) {
class myprefix_remove_noindex_category_posts_from_sitemap
{
function __construct()
{
add_action('wpseo_exclude_from_sitemap_by_post_ids', [$this, 'exclude']);
@hayatbiralem
hayatbiralem / wp-all-import-functions.php
Last active July 2, 2021 08:26
WP All Import helper functions
<?php
// WP All Import strip host from single image url
function reboot_strip_host_from_url_single($featured_image_url){
return str_replace('http://www.example.com/wp-content/', '', $featured_image_url);
}
// WP All Import strip host from image urls
function reboot_strip_host_from_url($featured_image_url, $content_image_urls){
$result = [];
@hayatbiralem
hayatbiralem / wp-all-export-functions.php
Last active April 17, 2024 17:08
WP All Export get the image urls from the post content
<?php
function reboot_remove_image_dimensions($str){
$re = '/-\d+x\d+\./m';
return preg_replace($re, '.', $str);
}
function reboot_get_content_images($id){
$p = get_post($id);
$doc = new DOMDocument();
@hayatbiralem
hayatbiralem / country-codes-with-locales.json
Created June 29, 2020 18:36
Country Codes with Locales
[
{
"country": "AD",
"en_name": "Andorra",
"native_name": "Andorra",
"locales": "ca"
},
{
"country": "AE",
"en_name": "United Arab Emirates",
@hayatbiralem
hayatbiralem / mark-selectors-has-tags.js
Last active June 24, 2020 14:18
Mark selectors has tags
(function ($) {
$(document).ready(function(){
var selectorMap = {
'div': ['h2', 'h3', 'h4'],
'.some-class': ['h2', 'h3', 'h4']
};
var prefix = 'has-';
var prefixDirect = 'has-direct-';
$.each(selectorMap, function(selector, tags){
$.each(tags, function(tagIndex, tag){