Skip to content

Instantly share code, notes, and snippets.

@everaldomatias
Created September 28, 2023 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save everaldomatias/b8b6911f48387785e2d0ef5fa0920eec to your computer and use it in GitHub Desktop.
Save everaldomatias/b8b6911f48387785e2d0ef5fa0920eec to your computer and use it in GitHub Desktop.
Tentativas tainacan
<?php
$repo_collection = \Tainacan\Repositories\Collections::get_instance();
$repo_items = \Tainacan\Repositories\Items::get_instance();
$repo_metadata = \Tainacan\Repositories\Metadata::get_instance();
$acervo = $repo_collection->fetch_one( ['pagename' => 'acervo'] );
$unidade = $repo_metadata->fetch_one( ['name' => 'Unidade'] );
$item = new \Tainacan\Entities\Item( 7200 );
$get_metadata = new \Tainacan\Entities\Item_Metadata_Entity( $item, $unidade );
$meta = tainacan_get_the_metadata(['metadata' => $get_metadata], 7200);
$rand_offset = rand( 0, 9 );
$rest_url = get_rest_url( null, 'tainacan/v2/collection/' . $collection_id . '/items?offset=' . $rand_offset );
$strpos = strpos( $rest_url, "/wp-json/" ) + 9;
$base_rest_url = substr( $rest_url, 0, $strpos );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment