Skip to content

Instantly share code, notes, and snippets.

View EkoJR's full-sized avatar

EkoJR

View GitHub Profile
@mikeschinkel
mikeschinkel / posts-ordered-by-meta.php
Created November 6, 2010 09:05
Class to extended WordPress' 3.0.x WP_Query to allow sorting by a meta_key.
<?php
/*
PostsOrderedByMetaQuery class that extends WP_Query and sorts posts meta_key
Author: Mike Schinkel (http://mikeschinkel.com)
This example works, just drop into the root of your website and call directly.
Use the class in your plugins or themes.
See: http://stackoverflow.com/questions/4111255/how-to-sort-a-query-posts-function-by-custom-field-while-limiting-posts-by-ano
@luetkemj
luetkemj / wp-query-ref.php
Last active May 25, 2024 10:56
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@salcode
salcode / .gitignore
Last active February 10, 2024 10:56
See https://salferrarello.com/wordpress-gitignore/ for the latest version of my WordPress .gitignore file
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
@CoachBirgit
CoachBirgit / divi-lightbox-snippet-for-functions.php
Last active January 19, 2022 06:33
DIVI: add lightbox to regular content images
/* --- DEPRECATED --- */
/* add .et_pb_lightbox_image clss to content images */
add_filter('the_content', 'divi_add_lightbox');
function divi_add_lightbox($content) {
global $post;
$pattern ="/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i";
$replacement = '<a$1href=$2$3.$4$5 class="et_pb_lightbox_image" title="'.$post->post_title.'"$6>';
$content = preg_replace($pattern, $replacement, $content);
return $content;
}
@EkoJR
EkoJR / wp_query-args.md
Last active November 29, 2022 05:58
WP Query $args - Reference for params / args in . Ex. WP_Query( $args )