GithubHelp home page GithubHelp logo

daggerhart / query-wrangler Goto Github PK

View Code? Open in Web Editor NEW
15.0 6.0 6.0 1.49 MB

A Query page and widget creator for Wordpress. Based on Drupal Views

CSS 2.40% JavaScript 9.17% PHP 88.25% Hack 0.18%
wordpress wp-query

query-wrangler's Introduction

Query Wrangler

Query Wrangler is a WordPress plugin that provides an intuitive interface for creating complex WP queries as shortcodes and widgets. UI based on Drupal Views.

This plugin lets you create new WP queries as widgets, and use shortcodes for to show queries in your content. Additionally, it allows you to override the way category and tag pages display without editing tempalte files.

Supports:

  • Most post data, including meta fields
  • Taxonomy data
  • Advanced Custom Fields
  • Custom Content Type Manager
  • Some exposed filters

Some examples of how you would use this plugin include:

  • Create a list posts with featured images
  • Create a list of pages or posts within a specific category or tag
  • Create an image gallery
  • Modify the way your category pages look

Frequently Asked Questions

How do I use query shortcodes?

Easy, the code you're looking for is like this. [query id=2] , where the number 2 is the query id. When viewing the list of queries each one will have 2 options for shortcode. One that uses the query's id, and the other using the query's slug. I recommend using the query's slug for future maintainability.

  • By id: [query id=2]
  • By slug: [query slug="my-query"]
  • Customize WP_Query arguments: [query id=2 args="posts_per_page=1&post_type=page"]
  • Customize WP_Query arguments with contextual data: [query id=1 args="author={{post:post_author}}&post_type={{post:post_type}}"]

What are overrides and how do I use them?

Overrides allow you to alter the display and information given on category and tag archive pages.

For a simple example, add a new query and chose the type override. Choose how you want the content to display, then examine the Overrides box in the center column. From there you can add taxonomies and terms this query will override.

Other

query-wrangler's People

Contributors

daggerhart avatar forrest-livengood avatar itsmariosouza avatar jpsimkins avatar mikevanwinkle avatar yvickers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

query-wrangler's Issues

Does `qw_get_meta_keys` need to be called on the frontend?

Hello,

I have a question:

Does qw_get_meta_keys need to be called on the frontend? I am asking because this query is taking ~2 seconds to load (due to filter qw_fields). I had to add caching to it since it's so slow. I'll provide that here too (sorry, no PR for this). I am thinking of increasing the cache lifetime to 24 hours since this doesn't change unless I am importing new content.

I currently have 1,864,773 records in the postmeta table. This query is single-handedly causing my site to load ~2 seconds longer.

I also don't see why this is being loaded on the frontend. Perhaps this is due to using views? I am not using views and only use the query building part, as the heart of another system I built.

I'm just trying to figure out if this is actually necessary to be loaded on the frontend or is this only needed on the backend.

For now, I have wrapped the filter qw_fields in a is_admin() check in both meta_value.php and meta_value_new.php (seems like this is for the backend, not the fronend). I don't have any issues... yet.

From a performance perspective, fetching the meta keys on every page load is not ideal at all. The table can get extremely bloated with data so I wouldn't recommend doing this on the frontend. The backend makes sense as it's necessary but definitely not on the frontend.

Thanks!


Cache for qw_get_meta_keys:

function qw_get_meta_keys() {
	global $wpdb;
	$keys = get_transient('qw_meta_keys');
	if (false === $keys) {
		$keys = $wpdb->get_col("
			SELECT meta_key
			FROM $wpdb->postmeta
			GROUP BY meta_key
			ORDER BY meta_key");
		set_transient('qw_meta_keys', $keys, 900);
	}
	return $keys;
}

Feature Requests

Hi,
First off - this is truly an amazing plugin; has some incredible potential and have been very excited to test this out! I made a forum post that had a few questions on (some of which the dev version with exposed filters seems to partly solve), but wanted to post it here in-case this was the more appropriate area for it: http://www.widgetwrangler.com/forum/query-wrangler/general/intro-query-wrangler#comment-5

Again - thank you very much for making this. I'll be willing to test anything you can throw at me! :)

Options override does not work as expected

In query.php line 78 you are using array_merge_recursive. This is the incorrect method and should be using array_replace_recursive instead. The issue is that values are stacked instead of replaced.

e.g posts_per_page will become an array with two values instead of using the override value.

Using simple text meta tag as field results in output: 'Array'

I've added a custom field using a post meta. In the database this meta has a plain text value but the output results in 'Array'.
Im using row style 'fields'.
Seems like the issue is somewhere within the qw_make_fields_rows(). Would it be possible to keep the raw php data of the result? This would be really good for theming.

Stacking filters

Hello,

Very nice this plugin! I am especially happy about the ability to stack filters:

  • post-type = my-custom-post-type
  • search = value1
  • meta-query : my-key1 LIKE meta-value-1

However It would be nice if can stack another meta-query, like

  • meta-query : my-key1 LIKE meta-value1
  • meta-query : my-key2 LIKE meta-value2

The UI seems to allow it, but the whenever I hit save , only the bottom meta-query is kept, with the other one gone. Is this a bug?

Another question : Is it possible to combine (nested) boolean AND / OR expressions ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.