NEXT craftinamerica.org. Base setup for headless wordpress https://www.craftinamerica.org
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

shortcodes.php 727B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. class P2P_Shortcodes {
  3. static function init() {
  4. add_shortcode( 'p2p_connected', array( __CLASS__, 'connected' ) );
  5. add_shortcode( 'p2p_related', array( __CLASS__, 'related' ) );
  6. }
  7. static function connected( $attr ) {
  8. return self::get_list( $attr, 'get_connected' );
  9. }
  10. static function related( $attr ) {
  11. return self::get_list( $attr, 'get_related' );
  12. }
  13. private static function get_list( $attr, $method ) {
  14. global $post;
  15. $attr = shortcode_atts( array(
  16. 'type' => '',
  17. 'mode' => 'ul',
  18. ), $attr );
  19. return P2P_List_Renderer::query_and_render( array(
  20. 'ctype' => $attr['type'],
  21. 'method' => $method,
  22. 'item' => $post,
  23. 'mode' => $attr['mode'],
  24. 'context' => 'shortcode'
  25. ) );
  26. }
  27. }