Sha256: c8ff1885808f8d22f1b671181a4365498ed6a1e923f6f91116f3ef572b69b655

Contents?: true

Size: 519 Bytes

Versions: 6

Compression:

Stored size: 519 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()
      );
    }

    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.2.4 template/wordpress/code/query.php
edge_framework-1.2.3 template/wordpress/code/query.php
edge_framework-1.2.2 template/wordpress/code/query.php
edge_framework-1.2.1 template/wordpress/code/query.php
edge_framework-1.2.0 template/wordpress/code/query.php
edge_framework-1.1.0 template/wordpress/code/query.php