The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
| <?php | |
| if ( !function_exists( 'is_rest' ) ) { | |
| /** | |
| * Checks if the current request is a WP REST API request. | |
| * | |
| * Case #1: After WP_REST_Request initialisation | |
| * Case #2: Support "plain" permalink settings | |
| * Case #3: It can happen that WP_Rewrite is not yet initialized, | |
| * so do this (wp-settings.php) |
| <?php | |
| /** | |
| * Insert an attachment from an URL address. | |
| * | |
| * @param String $url | |
| * @param Int $parent_post_id | |
| * @return Int Attachment ID | |
| */ | |
| function crb_insert_attachment_from_url($url, $parent_post_id = null) { |
| <?php | |
| function themename_customize_register($wp_customize){ | |
| $wp_customize->add_section('themename_color_scheme', array( | |
| 'title' => __('Color Scheme', 'themename'), | |
| 'priority' => 120, | |
| )); | |
| // ============================= |
| <?php | |
| /* | |
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| import android.app.AlertDialog; | |
| import android.app.Service; | |
| import android.content.Context; | |
| import android.content.DialogInterface; | |
| import android.content.Intent; | |
| import android.location.Location; | |
| import android.location.LocationListener; | |
| import android.location.LocationManager; | |
| import android.os.Bundle; | |
| import android.os.IBinder; |
| <!-- wp:paragraph {"align":"center","customTextColor":"#000000","backgroundColor":"very-light-gray","fontSize":"small"} --> | |
| <p style="color:#000000;text-align:center" class="has-background has-small-font-size has-very-light-gray-background-color">Gutenberg Sample Content.<br/>Put together with ❤️ by <a href="https://artisanthemes.io/">Artisan Themes</a>.</p> | |
| <!-- /wp:paragraph --> | |
| <!-- wp:heading {"level":1} --> | |
| <h1>This is a heading (H1)</h1> | |
| <!-- /wp:heading --> | |
| <!-- wp:heading --> | |
| <h2>This is a heading (H2)</h2> |
| <?php | |
| /** | |
| * Export Data to CSV file | |
| * Could be used in WordPress plugin or theme | |
| */ | |
| // A sample link to Download CSV, could be placed somewhere in plugin settings page | |
| ?> | |
| <a href="<?php echo admin_url( 'admin.php?page=myplugin-settings-page' ) ?>&action=download_csv&_wpnonce=<?php echo wp_create_nonce( 'download_csv' )?>" class="page-title-action"><?php _e('Export to CSV','my-plugin-slug');?></a> |
| This example uses the Rest API PHP SDK of Paypal. To get it, just use composer. |
| // License: GPLv2+ | |
| var el = wp.element.createElement, | |
| registerBlockType = wp.blocks.registerBlockType, | |
| ServerSideRender = wp.components.ServerSideRender, | |
| TextControl = wp.components.TextControl, | |
| InspectorControls = wp.editor.InspectorControls; | |
| /* | |
| * Here's where we register the block in JavaScript. |