HTML/API Snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Load custom post type archive on home page | |
| * | |
| * Reference: http://www.wpaustralia.org/wordpress-forums/topic/pre_get_posts-and-is_front_page/ | |
| * Reference: http://wordpress.stackexchange.com/questions/30851/how-to-use-a-custom-post-type-archive-as-front-page | |
| */ | |
| function prefix_downloads_front_page( $query ) { | |
| // Only filter the main query on the front-end | |
| if ( is_admin() || ! $query->is_main_query() ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * 1. Go to Settings > Permalinks and select any page as home page | |
| * Then use the following code | |
| * | |
| * You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. | |
| * Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. | |
| * If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, | |
| * give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, | |
| * so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Plugin Name: Automatic Dark Mode | |
| * Plugin URI: https://github.com/danieltj27/Dark-Mode/ | |
| * Description: Lets your users make the WordPress admin dashboard darker. | |
| * Author: Daniel James | |
| * Author URI: https://www.danieltj.co.uk/ | |
| * Text Domain: auto-dark-mode | |
| * Version: 1.0 |
As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Grab the url of a publicly embeddable video hosted on vimeo | |
| * @param str $video_url The "embed" url of a video | |
| * @return str The url of the thumbnail, or false if there's an error | |
| */ | |
| function grab_vimeo_thumbnail($vimeo_url){ | |
| if( !$vimeo_url ) return false; | |
| $data = json_decode( file_get_contents( 'http://vimeo.com/api/oembed.json?url=' . $vimeo_url ) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Gets the thumbnail url for a vimeo video using the video id. This only works for public videos. | |
| * | |
| * @param string $id The video id. | |
| * @param string $thumbType Thumbnail image size. supported sizes: small, medium (default) and large. | |
| * | |
| * @return string|bool |