Skip to content

Instantly share code, notes, and snippets.

Avatar

Kees Meijer keesiemeijer

View GitHub Profile
@keesiemeijer
keesiemeijer / gist:9320762
Created Mar 3, 2014
WordPress: Checks if new post is created
View gist:9320762
<?php
/**
* Checks if post status is new
*/
add_action( 'transition_post_status', 'post_unpublished', 10, 3 );
function post_unpublished( $new_status, $old_status, $post ) {
if ( $old_status == 'new' ) {
// do stuff for new post
}
@keesiemeijer
keesiemeijer / reversed-pagination.php
Last active Aug 29, 2015
Reversed WordPress Pagination
View reversed-pagination.php
<?php
/**
* Reversed Pagination for WordPress - proof of concept
*
* WARNING! Not suitable for use on a live website!
*
* Proof of concept for reversed pagination as discussed here
* http://nerd.vasilis.nl/problem-paginated-archive-pages-blogs/
* and here (Dutch)
* http://wasstra.at/035/
@keesiemeijer
keesiemeijer / poc-related-words-classes.html
Created Dec 12, 2014
Output for proof of concept to get related words from WordPress post title and filename. Classes
View poc-related-words-classes.html
@keesiemeijer
keesiemeijer / poc-related-posts.php
Last active Aug 29, 2015
Proof of concept to get related words from WordPress post title and filename.
View poc-related-posts.php
@keesiemeijer
keesiemeijer / poc-related-words-functions.html
Created Dec 12, 2014
Output for proof of concept to get related words from WordPress post title and filename. Functions.
View poc-related-words-functions.html
@keesiemeijer
keesiemeijer / poc-related-words-hooks.html
Created Dec 12, 2014
Output for proof of concept to get related words from WordPress post title and filename. Hooks.
View poc-related-words-hooks.html
@keesiemeijer
keesiemeijer / poc-related-words-methods.html
Created Dec 12, 2014
Output for proof of concept to get related words from WordPress post title and filename. Methods
View poc-related-words-methods.html
@keesiemeijer
keesiemeijer / excluded libs
Last active Aug 29, 2015
Exluded libraries for https://developer.wordpress.org/reference/ when parsing WordPress with the WP Parser
View excluded libs
excluded files
'wp-includes/class-snoopy.php',
'wp-includes/class-simplepie.php',
'wp-includes/class-IXR.php',
'wp-includes/class-phpass.php',
'wp-includes/class-phpmailer.php',
'wp-includes/class-pop3.php',
'wp-includes/class-json.php',
'wp-includes/class-smtp.php',
'wp-admin/includes/class-pclzip.php',
View gist:7b8b7e99a44b496659be
Processing file 427 of 479 "wp-includes/query.php".
Updated function "get_query_var"
Updated function "get_queried_object"
Updated function "get_queried_object_id"
Updated function "set_query_var"
Updated function "query_posts"
Updated function "wp_reset_query"
Updated function "wp_reset_postdata"
Updated function "is_archive"
Updated function "is_post_type_archive"
@keesiemeijer
keesiemeijer / functions.php
Last active Nov 16, 2015
Easy way to have text linking to images
View functions.php
<?php
add_filter( 'attachment_fields_to_edit', 'km_attachment_text_link_field', 10, 2 );
function km_attachment_text_link_field( $form_fields, $post ) {
$form_fields['km-text-link'] = array(
'label' => 'Text Link',
'input' => 'text',
'value' => '',
'helps' => 'If Text Link is provided, the image will be linked from a text link',