Skip to content

Instantly share code, notes, and snippets.

View fatihtoprak's full-sized avatar
🎯
Focusing

Fatih Toprak fatihtoprak

🎯
Focusing
View GitHub Profile
@fatihtoprak
fatihtoprak / wp-image-filters.php
Created January 15, 2023 22:20 — forked from davidsword/wp-image-filters.php
WordPress - All filters to modify an images URL (as far as I could find)
<?php
// Images in post galleries
add_filter( 'get_post_galleries', '_img_url_filter', PHP_INT_MAX );
add_filter( 'widget_media_image_instance', '_img_url_filter', PHP_INT_MAX );
// Core image retrieval
add_filter( 'image_downsize', '_img_url_filter', 10, 3 );
// Responsive image srcset substitution
<?php
function ohub_cf7_handle_success_submission( $contact_form ) {
global $wpdb;
$title = $contact_form->title;
$submission = WPCF7_Submission::get_instance();
$table_name = $wpdb->prefix.'log_mail';
if ( $submission ) {
$posted_data = $submission->get_posted_data();
$wpdb->insert(
$table_name,
@Oceas
Oceas / wds-hello-world.php
Last active June 2, 2023 10:03
WDS WP-CLI 101 Complete
<?php
/*
Plugin Name: WDS Hello World
Plugin URI: https://webdevstudios.com/
Description: Teaching the basics of WP-CLI
Author: Web Dev Studios
Version: 1.0.0
Author URI: https://webdevstudios.com/
*/
class WDS_CLI {
@fatihtoprak
fatihtoprak / remove_DS_store_files.md
Last active May 24, 2019 07:13
How to remove .DS_Store files.

Tüm DS_Store dosyalarını kaldırma

sudo crontab -e

Vi editor'da klavyenizden bir kez I harfine basın ve aşağıdaki komutu girin:

*/10 * * * * root find / -name ".DS_Store" -depth -exec rm {} \;

  • Bu crontab girişi aşağıdaki formata sahiptir:
@davidsword
davidsword / wp-image-filters.php
Last active September 24, 2024 00:24
WordPress - All filters to modify an images URL (as far as I could find)
<?php
// Images in post galleries
add_filter( 'get_post_galleries', '_img_url_filter', PHP_INT_MAX );
add_filter( 'widget_media_image_instance', '_img_url_filter', PHP_INT_MAX );
// Core image retrieval
add_filter( 'image_downsize', '_img_url_filter', 10, 3 );
// Responsive image srcset substitution
@RadGH
RadGH / rs_upload_from_url.php
Last active March 10, 2025 21:21
Upload a file from a URL to the WordPress media gallery. Supports images, PDFs, and other file types.
<?php
/**
* This function uploads a file from a URL to the media library, designed to be placed in your own theme or plugin.
* Metadata will be generated and images will generate thumbnails automatically.
*
* HOW TO USE:
* 1. Add the function below to your theme or plugin
* 2. Call the function and provide the URL to an image or other file.
* 3. If successful, the attachment ID will be returned.
@cfaria
cfaria / migrateorders.php
Last active January 16, 2025 10:51 — forked from maddisondesigns/migrateorders.php
Migrate WooCommerce Orders
<?php
//increase max execution time of this script to 150 min:
ini_set('max_execution_time', 9000);
//increase Allowed Memory Size of this script:
ini_set('memory_limit','960M');
// Copies woocommerce orders and users over from source to target.
// I use this on my local machine - loading both db's up there side by side
// could easily adjust the connect strings to connect elsewhere if needed.
@yasinkuyu
yasinkuyu / paribu_api
Last active March 13, 2025 13:27
Paribu Bitcoin Rates
Paribu.com - Türkiye'nin Bitcoin Borsası
2021 (update)
Api endpoint
https://v3.paribu.com/app/markets/btc-tl?interval=1000
Ticker
@mariovalney
mariovalney / woo-enable-reviews-bulk-edit.php
Created August 7, 2017 19:55
WooCommerce Enable Reviews - Bulk Edit
<?php
/**
*
* Plugin Name: WooCommerce Enable Reviews - Bulk Edit
* Description: Allow enable reviews by bulk edit into WooCommerce
* Version: 1.0.0
* Author: Mário Valney
* Author URI: http://mariovalney.com
* Text Domain: woo-enable-reviews-bulk-edit
*
@jgamblin
jgamblin / slackspotify.sh
Created April 19, 2017 01:10
A Script To Set Current Spotify Song As Slack Status
#!/bin/bash
APIKEY="From Here https://api.slack.com/custom-integrations/legacy-tokens"
SONG=$(osascript -e 'tell application "Spotify" to name of current track as string')
URLSONG=$(echo "$SONG" | perl -MURI::Escape -ne 'chomp;print uri_escape($_),"\n"')
while true
do
curl -s -d "payload=$json" "https://slack.com/api/users.profile.set?token="$APIKEY"&profile=%7B%22status_text%22%3A%22"$URLSONG"%22%2C%22status_emoji%22%3A%22%3Amusical_note%3A%22%7D" > /dev/null
sleep 60
done