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 | |
| add_filter( 'bulk_actions-edit-post', 'register_my_bulk_actions' ); | |
| function register_my_bulk_actions($bulk_actions) { | |
| $bulk_actions['email_to_eric'] = __( 'Email to Eric', 'email_to_eric'); | |
| return $bulk_actions; | |
| } | |
| add_filter( 'handle_bulk_actions-edit-post', 'my_bulk_action_handler', 10, 3 ); | |
| function my_bulk_action_handler( $redirect_to, $doaction, $post_ids ) { | |
| if ( $doaction !== 'email_to_eric' ) { |
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 | |
| add_theme_support( 'custom-header', array( | |
| 'video' => true, | |
| ) ); | |
| ?> |
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 | |
| function get_all_posts( $data, $post, $context ) { | |
| return [ | |
| 'id' => $data->data['id'], | |
| 'title' => $data->data['title']['rendered'], | |
| 'link' => $data->data['link'], | |
| ]; | |
| } | |
| add_filter( 'rest_prepare_post', 'get_all_posts', 10, 3 ); | |
| ?> |
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 | |
| function post_fetured_image_json( $data, $post, $context ) { | |
| $featured_image_id = $data->data['featured_media']; // get featured image id | |
| $featured_image_url = wp_get_attachment_image_src( $featured_image_id, 'original' ); // get url of the original size | |
| if( $featured_image_id ) { | |
| $data->data['featured_image_url'] = $featured_image_url[0]; | |
| } | |
| unset( $data->data['featured_media'] ); // remove the featured_media field |
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 | |
| function post_fetured_image_json( $data, $post, $context ) { | |
| $featured_image_id = $data->data['featured_media']; // get featured image id | |
| $featured_image_url = wp_get_attachment_image_src( $featured_image_id, 'original' ); // get url of the original size | |
| if( $featured_image_url ) { | |
| $data->data['featured_image_url'] = $featured_image_url[0]; | |
| } | |
| return $data; |
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 | |
| function filter_post_json( $data, $post, $context ) { | |
| $source = get_post_meta( $post->ID, '_source', true ); // get the value from the meta field | |
| if( $source ) { // include it in the response if not empty | |
| $data->data['custom_meta'] = array( 'source' => $source ); | |
| } | |
| return $data; | |
| } |
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 | |
| function hs_add_extra_links( $items ) { | |
| if( is_user_logged_in() ) { | |
| $items .= '<li><a href="' . wp_logout_url() . '">Logout</a></li>'; | |
| } else { | |
| $items .= '<li><a href="' . wp_login_url() . '">Login</a></li>'; | |
| } | |
| return $items; | |
| } | |
| add_filter( 'wp_nav_menu_items', 'hs_add_extra_links' ); |