Skip to content

Instantly share code, notes, and snippets.

View danielbenjamins's full-sized avatar

Daniel Benjamins danielbenjamins

View GitHub Profile
@danielbenjamins
danielbenjamins / Controller.php
Created March 15, 2024 23:18 — forked from gmazzap/Controller.php
WordPress plugin to ease the creation of virtual pages.
<?php
namespace GM\VirtualPages;
/**
* @author Giuseppe Mazzapica <[email protected]>
* @license http://opensource.org/licenses/MIT MIT
*/
class Controller implements ControllerInterface {
private $pages;
@danielbenjamins
danielbenjamins / api-requests.php
Created July 10, 2019 17:57 — forked from espiat/api-requests.php
api header request
function irgendwasenheader(){
$testrequest = wp_remote_get( 'https://www.domain.com/wp-json/wp/v2/CPT/' );
if( is_wp_error( $testrequest ) ) {
// Keine Daten
return false;
}
$testbody = wp_remote_retrieve_body( $testrequest );
$irgendwasengesamt = wp_remote_retrieve_header($testrequest, 'x-wp-total' );
$apiseiten = wp_remote_retrieve_header($testrequest, 'x-wp-totalpages' );