Want to create a Gist from your editor, the command line, or the Services menu? Here's how.
// 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 | |
*/ |
'rewrite' => true | |
'public' => true 'publicly_queryable' => true /cpt-slug/cpt-post-slug Loads fine | |
'public' => false 'publicly_queryable' => true /cpt-slug/cpt-post-slug Loads fine | |
'public' => true 'publicly_queryable' => false /cpt-slug/cpt-post-slug 404 Error | |
'public' => false 'publicly_queryable' => true /cpt-slug-cpt-post-slug 404 Error | |
'rewrite' => false | |
'public' => true 'publicly_queryable' => true /?cpt-slug=cpt-post-slug Loads fine | |
'public' => true 'publicly_queryable' => true /?p=ID&post_type=cpt-slug Loads fine | |
'public' => false 'publicly_queryable' => true /?cpt-slug=cpt-post-slug Loads fine |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
<?php | |
/* | |
Plugin Name: Heartbeat API Demo | |
Plugin URI: http://www.strangerstudios.com/wp/heartbeat-api-demo | |
Description: Minimal example demonstrating the WordPress Heartbeat API being added in WP version 3.6. | |
Version: .1 | |
Author: strangerstudios | |
If logged in as a user and viewing the frontend of your website, | |
every 15 seconds you should see the following in your Javascript console: |
<?php | |
# Register custom post types on the 'init' hook. | |
add_action( 'init', 'my_register_post_types' ); | |
/** | |
* Registers post types needed by the plugin. | |
* | |
* @since 1.0.0 | |
* @access public |
//* Move Post Title and Post Info from inside Entry Header to Entry Content on Posts page | |
add_action( 'genesis_before_entry', 'reposition_entry_header' ); | |
function reposition_entry_header() { | |
if ( is_home() ) { | |
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 ); | |
remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); | |
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); | |
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 ); |
<?php | |
//* Remove breadcrumbs | |
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' ); | |
//* Force full width content | |
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); | |
//* Remove entry meta in entry header | |
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); |
#!/usr/bin/env osascript | |
# usage: sendmail.app [email protected] [email protected],[email protected] "have you seen this?" "a nice way to send mail/attachment from the shell in osx (if you have configured Mail.app) https://gist.github.com/andreineculau/38f6160cc9aa11956953" | |
on theSplit(theString, theDelimiter) | |
-- save delimiters to restore old settings | |
set oldDelimiters to AppleScript's text item delimiters | |
-- set delimiters to delimiter to be used | |
set AppleScript's text item delimiters to theDelimiter | |
-- create the array |
#Customize and display links to previous and next post, from a single post
This snippet is for displaying and customizing the links to previous and next posts, for single post entries within the Genesis Framework.
Normally the links to the previous and next post are displayed in the entry footer as the title of the next and previous posts. I wanted to customize the function to swap the link order so that the newest article was accessible from the link on the left and the previous article was accessible form the link on the right, to better navigate posts in an ascending order. I also wanted to add the text "Previous Post" and "next Post" above the linked post titles for better clarification. See the comment in the code for more detail.
For additional customizable permeates, see the codex links under References.