Skip to content

Instantly share code, notes, and snippets.

View pedro-mendonca's full-sized avatar
:octocat:

Pedro Mendonça pedro-mendonca

:octocat:
View GitHub Profile
@Zodiac1978
Zodiac1978 / strings.md
Last active June 9, 2023 04:56
Strings in WordPress which are settings and should not be translated
Context Possibe values
default GMT offset or timezone string Must be either a valid offset (-12 to 14) or a valid timezone string (America/New_York)
start of week 0 = Sunday, 1 = Monday (0 or 1)
Events widget offset prefix Used as part of a string like GMT+5 in the Events Widget. (?)
draft_length Maximum number of words used in a preview of a draft on the dashboard. (number)
Comment number declension: on or off If comment number in your language requires declension, translate this to ‘on’. (on or off)
decline months names: on or off If months in your language require a genitive case, translate this to ‘on’. (on or off)
Word count type. Do not translate! If your word count is based on single characters (e.g. East Asian characters), enter ‘characters_excluding_spaces’ or ‘characters_including_spaces’. Otherwise, enter ‘words’.
Google Font Name and Variants Use this to specify the proper Google Font name and variants to load that is supporte
name: Version checks
on:
push:
branches:
- master
pull_request:
jobs:
# Compares the header information in the readme.txt and the main plugin file
@trey8611
trey8611 / wpai-check-if-image-exists.md
Created December 3, 2020 20:51
WP All Import | Check if images exist/are downloadable before trying to download them.

If you provide an image URL that's invalid or that's not available to the server, it can take a while for WP All Import to fail when attempting to download it. To get around this, you can pass your images to a function (see https://www.wpallimport.com/documentation/developers/custom-code/inline-php/) like this:

[my_output_imgs(array({img1[1]},{img2[1]},{img3[1]}))]

Then, use PHP to test them before outputting them in the import template:

<?php
function my_search_media_library( $image ) {
global $wpdb;
$all_images = array();
$query = "SELECT * FROM " . $wpdb->posts . " WHERE guid LIKE '%" . $image . "%'";
$results = $wpdb->get_results( $query );
if ( $results ) {
foreach ( $results as $result ) {
@lukecav
lukecav / functions.php
Last active September 7, 2018 07:39
Remove the try Gutenberg panel from the dashboard in WordPress admin (WP 4.9.7)
remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );
@akshaynagpal
akshaynagpal / filter-gallery.js
Last active August 24, 2020 08:29
Filter Gallery using HTML5, JavaScript, JQuery & Bootstrap Demo: https://jsbin.com/jeyadac
@rveitch
rveitch / sync_acf_post_title.php
Last active December 7, 2022 21:40
Update WordPress post title from an ACF field value on save. (Advanced Custom Fields)
<?php
/**
* Update Post Title from an ACF field value on post save.
*
* Triggers on save, edit or update of published posts.
* Works in "Quick Edit", but not bulk edit.
*/
function sync_acf_post_title($post_id, $post, $update) {
$acf_title = get_field('my_acf_field_name', $post_id); // NOTE: enter the name of the ACF field here
@bekarice
bekarice / wc-sku-sorting.php
Last active April 8, 2024 17:56
Sort WooCommerce Products by SKU
<?php // ONLY COPY THIS LINE IF NEEDED!
/**
* Adds the ability to sort products in the shop based on the SKU
* Can be combined with tips here to display the SKU on the shop page: https://www.skyverge.com/blog/add-information-to-woocommerce-shop-page/
*
* @param array $args the sorting args
* @return array updated args
*/
function sv_add_sku_sorting( $args ) {
@fatihacet
fatihacet / jquery.ajax-queue.js
Created October 15, 2011 21:46
Simple and easy jQuery AJAX queue implementation trying - this is draft version -
$.ajaxQueue = [];
var que = $.ajaxQueue;
$.ajaxSetup({
beforeSend: function(){
if (this.queue) {
que.push(this);
}
else {
return true;