This file contains 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
WebSockets vs. Server-Sent events/EventSource | |
--------------------------------------------- | |
Both WebSockets and Server-Sent Events are capable of pushing data to browsers. To me they seem to be competing technologies. | |
What is the difference between them? When would you choose one over the other? | |
Websockets and SSE (Server Sent Events) are both capable of pushing data to browsers, however they are not competing technologies. | |
Websockets connections can both send data to the browser and receive data from the browser. | |
A good example of an application that could use websockets is a chat application. |
This file contains 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 | |
/** | |
* Retrieves the thumbnail from a youtube or vimeo video | |
* @param - $src: the url of the "player" | |
* @return - string | |
* @todo - do some real world testing. | |
* | |
**/ | |
function get_video_thumbnail( $src ) { |
This file contains 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: Restrict Content Pro - Custom User Fields | |
Description: Illustrates how to add custom user fields to the Restrict Content Pro registration form that can also be edited by the site admins | |
Version: 1.0 | |
Author: Pippin Williamson | |
Author URI: http://pippinsplugins.com | |
Contributors: mordauk | |
*/ |
This file contains 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: Convert Custom Taxonomy to Custom Post Type | |
Plugin URI: N/A | |
Description: A plugin to convert a Custom Taxonomy to a Custom Post Type and transfer associated metadata. | |
Version: 0.1 | |
Author: Strap1 | |
Author URI: http:/www.hiphopinenglish.com | |
/** Convert Taxonomy '%name%' to CPT '%name%' **/ |
This file contains 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
// Get And Cache Vimeo Thumbnails | |
function get_vimeo_thumb($id, $size = 'thumbnail_small') | |
{ | |
if(get_transient('vimeo_' . $size . '_' . $id)) | |
{ | |
$thumb_image = get_transient('vimeo_' . $size . '_' . $id); | |
} | |
else | |
{ | |
$json = json_decode( file_get_contents( "http://vimeo.com/api/v2/video/" . $id . ".json" ) ); |
This file contains 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 if (($wp_query->current_post +1) == ($wp_query->post_count)) { | |
echo 'This is the last post'; | |
} ?> | |
<?php if (($wp_query->current_post +1) != ($wp_query->post_count)) { | |
echo 'This is the not the last post'; | |
} ?> |
This file contains 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 | |
// LOGOUT LINK IN MENU | |
function diww_menu_logout_link( $nav, $args ) { | |
$logoutlink = '<li><a href="'.wp_logout_url().'">Logout</a></li>'; | |
if( $args->theme_location == 'primary' ) { | |
return $nav.$logoutlink ; | |
} else { | |
return $nav; |
This file contains 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 | |
function rkv_remove_columns( $columns ) { | |
// remove the Yoast SEO columns | |
unset( $columns['wpseo-score'] ); | |
unset( $columns['wpseo-title'] ); | |
unset( $columns['wpseo-metadesc'] ); | |
unset( $columns['wpseo-focuskw'] ); |
This file contains 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 | |
$post_type = get_post_type_object( get_post_type($post) ); | |
echo $post_type->labels->name; | |
?> |
This file contains 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
// rename existing sections | |
$wp_customize->add_section( 'section_id' , array( | |
'title' => __('Section Title','mytheme'), | |
'priority' => 20, | |
)); |