Sha256: 00c1a76f3ad7cf0b71f191b610f700b3ab305bd2118d68030ea7a06a2d10fe42

Contents?: true

Size: 583 Bytes

Versions: 6

Compression:

Stored size: 583 Bytes

Contents

<?php

/*
  Custom WP Query
*/

class Post {
  public static function find($args = null) {
    wp_reset_postdata();
    
    if(empty($args) ) {
      $args = array(
        "post_type" => get_called_class()
      );
    } else {
      $args["post_type"] = get_called_class();
    }

    return new WP_Query($args);
  }


  public static function find_by($key, $value) {
    wp_reset_postdata();

    $args = array(
      $key => $value,
      "post_type" => get_called_class()
    );
    return new WP_Query($args);
  }
}

class Page extends Post {}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
edge_framework-1.3.1 template/wordpress/code/query.php
edge_framework-1.3.0 template/wordpress/code/query.php
edge_framework-1.2.9 template/wordpress/code/query.php
edge_framework-1.2.7 template/wordpress/code/query.php
edge_framework-1.2.6 template/wordpress/code/query.php
edge_framework-1.2.5 template/wordpress/code/query.php