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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Bouncing balls</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<h1>bouncing balls</h1> | |
<canvas></canvas> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="Writing JavaScript in the Browser"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<link rel="stylesheet" href="style.css" media="screen"> | |
<title>JavaScript for WordPress</title> | |
<style id="jsbin-css"> | |
form { |
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 | |
// Attention name filter & action: change "slug-cpt" | |
add_filter('manage_slug-cpt_posts_columns', 'pc_columns_head'); | |
add_action('manage_slug-cpt_posts_custom_column', 'pc_columns_content', 10, 2); | |
// ADD NEW COLUMN | |
function pc_columns_head($defaults) { | |
$defaults['categorias'] = 'Categorías'; | |
return $defaults; | |
} |
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 | |
// To plugin or functions.php | |
add_filter( 'posts_where', 'your_title_func', 10, 2 ); | |
function your_title_func( $where, &$the_query ) | |
{ | |
global $wpdb; | |
if ( $search_title = $the_query->get( 'search_title' ) ) { | |
$where .= ' AND ' . $wpdb->posts . '.post_title LIKE \'' . esc_sql( like_escape( $search_title ) ) . '%\''; | |
} |
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 ob_start(); ?> | |
<CENTER> | |
<FORM> | |
<input type="button" value="Submit"> | |
</FORM> | |
</CENTER> | |
<?php $to_lock = ob_get_contents(); ob_end_clean(); ?> | |
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 | |
/** | |
* Adds icons for any custom order statuses | |
**/ | |
add_action( 'wp_print_scripts', 'pc_add_custom_order_status_icon' ); | |
function pc_add_custom_order_status_icon() { | |
if( ! is_admin() ) { | |
return; | |
} |
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 | |
// Example 1 | |
function add_cap_upload_files_to_user_id() { | |
$user = new WP_User( $user_id ); | |
$user->add_cap( 'upload_files' ); | |
} | |
add_action( 'admin_init', 'add_cap_upload_files_to_user_id'); | |
// Example 2 | |
function allow_contrib_upload() { |
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 | |
add_filter('display_post_states', 'pc_custom_post_states', 10 , 2); | |
function pc_custom_post_states($states, $post) { | |
if( ('page'==get_post_type($post->ID)) && ('page-templates/custom-page-template.php'==get_page_template_slug($post->ID)) ) { | |
$states[] = __('Custom state'); | |
} | |
return $states; | |
} |
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 | |
// Example SQL Get a custom field | |
SELECT meta_value | |
FROM wp_postmeta | |
WHERE post_id IN (8) AND meta_key = 'subtitle'; | |
add_action( 'genesis_entry_header', 'pc_render_the_subtitle', 11 ); | |
function pc_render_the_subtitle() { | |
$subtitle = get_post_meta( get_the_ID(), 'subtitle', true ); | |
if ( ! $subtitle ) { |
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 | |
/** | |
* User Blueprint | |
* | |
* @package PCianes\OOPSandbox | |
* @since 1.0.0 | |
* @author Pablo Cianes | |
* @link https://pablocianes.com | |
* @license GNU-2.0+ | |
*/ |
NewerOlder