Created: 14/06/2011
Version: 1.0.0.0
By: Günter Schönmann
Contact: click here
Informations about updates are always announced on Twitter and at Inoplugs.com.
Hey! First of all I would like to thank you for purchasing my plugin!
If you have any questions that are beyond the scope of this help file, please feel free to ask your question at the
support forum.
This file will teach you how to set up and use the "Multiselect Ultimate Query" - WordPress plugin.
This file is extensive so you might think the plugin is hard to use -
but actually its not. You'll find examples in an own section, that will help you to understand, how to implement your own queries and
achieve the results, you want to have. Of course, the better you understand, how to build the queries, the
better you can use this powerful plugin. You must spend some time in learning and trying everything by yourself.
Here you will find the latest version of this documentation with the newest examples added online.
Have fun with this plugin! I hope you like it and find it useful :)
Best regards
Günter Schönmann
This plugin allows you to create your own query of posts and pages and displays the result wherever you like it on a page only by adding a shortcode to the page. The great feature is, that you can use nearly all the capabilities of a Wordpress query without having to change anything in the themecode of the page and this is completly independent from the internal Wordpress-loop for the page.
You can query posts by custom defined taxonomies (if supported by your theme) as well as custom and standard catagories, post-types, meta-data and other parameters and combine them to your wishes.
An installed parser checks your input and supports you with Errormessages and helps you to form a correct query.
There are predefined output sections, that allow you to choose, what parts of information of your queryresults you want to show.
The output is styled with CSS-classes and has therefore a standard behaviour, that can be used without any changes by many themes. An extensive set of custom CSS-classes, which are bound to the query, allow you to customize the output of each query independently in nearly any way you like.
An Administration panel allows you to write your queries and select the output you want and stores the information in a database, so you can reuse the same query on multiple pages. (this feature is NOT available in the free lite version). As you only have to write the ID or the name of the query in the shortcode, it helps you to keep your pagecontent more clearly.
Most of the code is based on modern OOP-Technics (object orientated programming), that ensures a high stability of this plugin. Also the possibility of interfering with other plugins due to identical functionnames is very low.
This plugin is currently available in 2 versions:
It offers you the follwing two possibilities to place your query and output selection:
The option panel also supports you with a syntaxchecker - button and shows you the SQL-statement generated by WordPress immidiatly, so you can form your query on the production site without interferring and disturbing it. It also assists you in defining the output sections.
It offers you the possibility to use some of the features. You can form nearly all the queries as in the premium version, but it has only a limited output capability and no administration panel, so you cannot store the queries for reuse in a database.
The downloadable .zip package contains the following folders and files:
To install, follow the following steps:
To uninstall, follow the following steps:
To upgrade to the Premium version, follow the following steps:
To use this plugin you create your page with the content, you need. At the point, where you want to implement the query and show the results, you write the shortcode. If you wish, you can place multiple shortcodes on a page. You have two possibilities to implement it.
You will find a general overview, how to build the shortcode first, later a detailed specification about possible parameters and syntax will follow.
You define the complete query and the selection of the output directly in the shortcode. You have several keywords, which are described later. Do not nest any other shortcode inside (currently not supported by WP !!!).
[inoplugs_multiselect parameter="value" {parameter="value" ....}] $$query$$ ... place querystring here .... $$display$$ $$section-name$$ {$$section-name$$ ........} [/inoplugs_multiselect]
All parameters for the query and display have already been set in the optionpanel, therefore you only need to set the parameter "queryid" to "ID" or the "shortcode-slug" of the desired query. This option is not available in the free lite version.
[inoplugs_multiselect queryid="ID"] [/inoplugs_multiselect]
or in a single line:
[inoplugs_multiselect queryid="ID"/]
The parameters for the shortcode are placed directly after the shortcodename "inoplugs_multiselect" seperated by spaces. The values for the parameters must be put in "" or ''. The following parameters are possible for the shortcode:
Parameter | Possible values | Description |
---|---|---|
queryid | number|name | This is the only parameter needed for a query generated with the administration panel and stored in an independent database-table - Use the value of "Unique ID" (= generated by the Database) or "Shortcode-slug" (unique name for this query given by you), whatever you prefer. |
cssid | string | This is the unique identifier and allows you to style your output specially for
this query. Be sure to make it unique for every styling you need. This string is
added with '-' to the classes in multiselect.css (e.g. cssid="mystyle"
results in ipms-divtitle-mystyle). This styling can be reused in different queries.
Default: "" |
showposts | 0|1|true|false | When using "categoryselection" would result in no posts, because the custom categories
you chose lead to no possible posts (e.g. you select custom taxonomies that are not active
in the theme you use), setting to true shows posts of other categories known to the theme
according to the other selectionparameters outside categoryselection.
False will lead to no posts and to no output. Default or anything else than 1 or true: false. |
error | 0|1|true|false | Shows Errors and Warnings that occur in this plug-in. Helpful to find syntax errors in
the query or if the query yields to unexpected results. It also prints out the data
structure of the query that is passed to WP. You should deactivate this feature in the
final release version due to safty reasons. Default or anything else than 1 or true: false. |
The querystring tells WP, which posts or pages should be selected. As this is a very powerfull tool, there are some syntax rules to be followed, so the internal parser can translate it for WP. You will find examples in an own chapter to help you understand the syntax and be able to create your custom queries in a short time.
These are special characters interpreted by the parser to seperate information. They do not become part of the text to interpret but have only informational character. Any 'space', 'new line', 'tabulator' around them will also be ignored.
If you want to use one of these characters in a string, see the next section.
Strings are a sequence of characters and numbers to be interpreted as text. You have 3 possibilities to define a string:
Examples:
this is an unquoted text this isn’t new\, but \"hot\" \& spicy "this is a quoted text & new" "say \"hello\" now" ‘this is another quoted text & new’ ‘it isn\’t new’ "Text1" , "Text2" Text1, Text2, 'Text3' , "Text4"
Numbers are a sequence of characters from 0 - 9, and can also be written similar to strings. For decimal numbers '.' is needed (e.g. 5.3). Other numberformats are not supported yet.
35 15.25 “35” “15, 25” “15”, “25”, 35
The querystring syntax can consist of several lines. Linebreaks are ignored and can be put anywhere to make the code readable. Keywords must not be seperated.
keyword = value [, value, ....] [& keyword = value [, value, ....] [& .... ]]
All possible keywords and the appropriate possible values are clearly described in the WP documentation of WP-Query object under the section "Parameters".
For syntax like 'category_name=staff' you write similarily to WP:
category_name=staff author = 123, 135 author=-12,-34,-56 tag= bread, baking
For syntax described with array(...) you write the values similarily to the above syntax:
tag__and = 37, 47 post__in = 2, 5, 12, 14, 20 post_type = 'post', 'page', 'movie', 'book'
To query categories and taxonomies you don't have to take care, whether a category belongs to a custom taxonomy or not. Simply select or deselect the categories as you like. You can also query all categories, which belong to a taxonomy.
There is a special syntax and keywords for querying categories, taxonomies and also for custom fields (described in the next section):
categoryselection = {{ select = { [cats | catsname | taxs] = value [& operator = value] } [relation = value & select = { [cats | catsname | taxs] = value [& operator = value] } ][ select = { [cats | catsname | taxs] = value [& operator = value] } ][....] ] }}
Keyword | Possible values | Description |
---|---|---|
categoryselection | is the keyword, that starts this entry, the sequence after = must be put in {{ ... }} | |
select | contains the selection of categories, the sequence after = must be put in { ... } | |
relation | "AND", "OR" to concatenate subsequent "select" (OR is default, only 1 entry allowed) and must be followed by "&". There is a limitation of WP 3.1 to the relation "AND": This relation cannot be used, when you want to have different categories in a single SELECT (as these have to be concatenated intermally by OR). If you do so, only the first select will be used. If you want to query different categories, put each category in a single SELECT. There is no restriction for the relation "OR". | |
operator | "IN", "NOT IN" to include or exclude ("IN" is default), "LIKE", "NOT LIKE", "BETWEEN", "NOT BETWEEN" | |
cats | number | string | either ID or slugname of the desired category (correspond to term_id or slug in Database table ~terms) |
catsname | string | name of the desired category (correspond to name in Database table ~terms) |
taxs | string | name of user defined custom taxonomy, built in or user defined category (correspond to taxonomy in Database table ~termtaxonomy). This parameter includes all the terms defined for the taxonomy or category |
To query custom fields you have to take the following syntax. A description of the parameters and values inside {....} you find in the WP documentation at WP-Query object under the section "Custom Field Parameters". All {{, { and & must be placed as described below.
meta_query = {{ select = { key = value & value = value & compare = value [& type = value] } [select = { key = value & value = value & compare = value [& type = value] } [ …. ] }}
For experienced users it is possible to make a direct pass through taxonomy query. The keywords and values correspond to WP and is very similar to the array in array structure of WP.
tax_query = {{ select = { taxonomy = value & field = value & terms = value [& operator = value] } [relation = value & select = { taxonomy = value & field = value & terms = value [& operator = value] } ][ select = { taxonomy = value & field = value & terms = value [& operator = value] } ][.... ] }}
If both "categoryselection" and "tax_query" are present in a query, "categoryselection" will be ignored.
The desired output is selected with keywords. You can combine as many keywords you like and as often as you like. All resulting posts of the query have the same output. You cannot change the output within a query. If you need this, you have to put several shortcodes with queries on the page.
Keyword | Description |
---|---|
$$thetitle$$ | Displays the title of the post |
$$thecontent$$ | Displays the complete content of the post |
$$theexcerpt$$ | Displays the excerpt of the post if defined or what the WP-function get_excerpt() returns (usually the first 50 words with 'continue reading..' or depending on your settings). |
$$thepermalink$$ | Displays a link to the page with the complete post |
$$thecategories$$ | Displays a list of the categories of the post with a link to the archive pages of the categories |
$$thetags$$ | Displays a list of the tags of the post with a link to the archive pages of the tags |
$$customfields$$ | Displays a list of the non hidden customfields (not beginning with '_') and their values |
$$attachmentlinks$$ | Displays a list of links to the attachments of the post |
$$theauthor$$ | Displays a link to a page with the other posts of the author |
$$thedate$$ | Display the date, when the post was posted |
The free lite version only supports the following keywords: $$thetitle$$, $$theexcerpt$$, $$thedate$$.
Example:
[inoplugs_multiselect] $$query$$ ... place your querystring here .... $$display$$ $$thetitle$$ $$theexcerpt$$ $$thedate$$ [/inoplugs_multiselect]
The output has a default styling in multiselect.css located in the subfolder /css of the plugin. There are a lot of classes added to the HTML output, so you are able to make your own styling by changing the standard settings.
You are also able to adopt the styling depending on the query you make. If the parameter 'cssid' is set to a string, this string will be added to the classnames and this class will be added additionally. If it is not set, no extra class will be added.
The classnames all start with 'ipms-' to seperate them from any theme-classes used.
'ipms-bgskin-light' (= default) or 'ipms-bgskin-dark' are bound to the surrounding <div>-container only. 'ipms-bgskin-dark' can only be activated via the administration panel, where they are bound to each query independently.
The name of the displayed section is part of the classname preceded by 'div' for the surrounding <div>-container. The post-ID is also integrated in the classes added. If there are any links or other elements in the section you will also find classes to style them.
Do not alter any of the original css-files, because they are always part of the download in future releases and will therefore override your changes !!!
Instead use the file multiselect_custom.css to make your customizations. If this file is present, it will be loaded as the last of all inoplugs_multiselect stylesheets and therefore override the values of the others. For your convienience you find an empty file multiselect_custom_template.css, which you only need to rename.
The following snipplet of the output html code shows you the created classes. cssid was set to 'custcss'.
<div class="ipms-bgskin-light ipms-bgskin-light-custcss ipms-postcomplete ipms-postcomplete-custcss ipms-postcomplete-post-101 ipms-postcomplete-post-101-custcss"> <div class="ipms-divtitle ipms-divtitle-custcss ipms-post-101 ipms-post-101-custcss"> <h1 class="ipms-title ipms-title-custcss">A theme with fantastic options</h1> </div> <div class="ipms-divexcerpt ipms-divexcerpt-custcss ipms-post-101 ipms-post-101-custcss"> <p class="ipms-excerpt ipms-excerpt-custcss"> ...... the excerpttext ..... </p> </div> </div>
The stylesheet 'multiselect_options.css' in the folder /css is used by the administration panel. If you want to change any of the styles, use the stylesheet 'multiselect_options_custom.css', because this will never be updated by any further release and is added automatically at the end, if existing.
In the folder /inoplugs_framework/css you find the stylesheets 'admin_option.css' and 'exceptions.css'. Any changing to 'admin_option.css' should be done in 'multiselect_options_custom.css', for 'exceptions.css' should be done in 'multiselect_custom.css'.
On the administration page on the left side you find a Top level Menu 'Multiselect Options' with the submenues 'Show Queries' and 'Add New'. These Options are not available in the free lite version.
An optionpanel with accordeon technology allows you to manage options for the plugin and your queries. It provides you with a syntaxchecker and also shows you the generated SQL-statement to help you developing your query.
Here you see an overview of all stored queries ordered by 'UniqueID' with essential information like 'Shortcode-slug', 'Name of Query', 'CSS-ID' and 'Comment'. Currently you cannot change the order. By clicking on the name of the shortcode-slug or the upcoming link 'Edit' you can edit the query, to permanently delete it you have to click on 'Delete'.
This option panel allows you to create a new query. It is also activated, when you want to
edit an existing query.
When you click on one of the bars in the panel, it expands, clicking again on it the
underlying information is hidden again.
If you move your cursor over an inputfield, a popup window gives you information about the
required input (works on most browsers).
"Save Changes"-button | Saves or updates your input only, if all fields have been filled in correctly and the query has a valid syntax (that means, that your query will return an output, if matching results are found). |
"Delete Query"-button | Only visible, when an existing, stored query is edited. Allows you to permanently delete the query from the database. Be sure to remove the shortcode from all pages to avoid errormessages. This step cannot be rolled back !!! |
"Discard Changes"-button | Resets your inputfields to the values loaded and discards all your input. This step cannot be rolled back !!! |
This section is only faded in after loading the page as a quick status information and disappears automatically. It cannot be reproduced. Instead look into the section 'Errors and Internals'.
Unique ID | The Unique ID of the query generated by the database (0 on a new query). This value can be used in the shortcode on a page to activate the query. This value cannot be changed. |
Shortcode-slug | A unique, short name for the query used to identify the query. This value can be used on a page to activate the query. It can be changed any time you lke, but make sure to change it on the pages also. The name must consist of at least 1 letter [A - Z], maximum 40 characters or numbers. It is not case-sensitive. The listbox on the right shows you all existing shortcode-slugs, so you can avoid duplicate names. |
Name | optional, helps you to identify the query |
Comment | optional, you can describe the content and use of the query |
CSS-ID | optional, this string is appended to the classes in the HTML - output as described in the section 'Styling the Output'. You can use the same CSS-ID for multiple queries. The listbox on the right shows you all existing CSS-ID's, so you can choose an existing one, if you wish. |
Show any posts | This checkbox corresponds to the parameter 'showposts'. |
Show Errors | This checkbox corresponds to the parameter 'error'. As the optionpanel provides a syntaxcheckbutton, you rarly need to check this. It is recommended to have this checked only for the debugging version. |
Delete Database | This field allows you to clean up your database, when deactivating the plugin. When you want to remove your plugin permanently and also all of your stored queries, you must write the word 'Delete' (case-sensitiv, without ') in the input field. In this case on deactivating the plugin all your queries are permanently deleted, the databasetable for the plugin is removed and all needed optionfields are also removed. This step cannot be rolled back !!! Any other input will leave your queries and options, so they will be available on reactivating the plugin (or any upgrade version) again. |
Enter your query | You enter your querystring here, same syntax and rules as described in 'Defining the Query String'. |
'Check Syntax' - button | Starts a syntaxcheck of your query and returns:
|
Copy the required output sections from 'Possible Values:' to 'Your Selection:' or
visa versa. You can select multiple entrys by pressing 'Ctrl' key and clicking
the required section. Clicking the buttons '>>', '>', '<', '<<'
moves the selection.
The selection of the dropdown box 'Theme has a: light background | dark background' allows you to
set a general styling for your output.
Messages produced by 'Check Syntax', 'Save Changes' and 'Delete Query' - buttons.
Summary of this documentation to help you online.
In this section you will find some examples that shall help you to form your own queries.
You site has a category-slug 'Hockey' (ID = 16) with subcategories and you want to show this category and their subcategories and the last (=newest) 7 posts on a page, ordered by posttitles descending. As of WP 3.1 WP is not able to have different order in a query, therefore only descending for title is possible. In a future release of this plugin there will be a fix to this limitation.
$$query$$ posts_per_page = 7 & categoryselection = {{ select = { cats = Hockey } }} orderby = date, title & order = desc $$display$$ $$thetitle$$ $$theexcerpt$$ $$thedate$$
or
$$query$$ categoryselection = {{ select = { cats = 16 } }} posts_per_page = 7 & orderby = date, title & order = desc $$display$$ $$thetitle$$ $$theexcerpt$$ $$thedate$$
or using the WP keyword cat
$$query$$ posts_per_page = 7 & cat = 16 & orderby = date, title & order = desc $$display$$ $$thetitle$$ $$theexcerpt$$ $$thedate$$
Same query (without order and orderby), but now you want to exclude category ID = 17:
$$query$$ posts_per_page = 7 & categoryselection = {{ select = { cats = Hockey & operator = in} relation = and & select = { cats = 17 & operator = not in} }} $$display$$ $$thetitle$$ $$theexcerpt$$ $$thedate$$
or using the WP keyword cat
$$query$$ posts_per_page = 7 & cat = 16, -17 $$display$$ $$thetitle$$ $$theexcerpt$$ $$thedate$$
The above examples with categoryselection also work, if your theme has e.g. a custom taxonomy 'portfolio_entries' with the categories 'CSS' (ID = 4) and 'HTML' (ID = 5):
$$query$$ posts_per_page = 7 & categoryselection = {{ select = { cats = css, html } }} $$display$$ $$thetitle$$ $$theexcerpt$$ $$thedate$$
or
$$query$$ posts_per_page = 7 & categoryselection = {{ select = { cats = 4, 5 } }} $$display$$ $$thetitle$$ $$theexcerpt$$ $$thedate$$
To query all categories of 'portfolio_entries':
$$query$$ posts_per_page = 7 & categoryselection = {{ select = { taxs = 'portfolio_entries'} }} $$display$$ $$thetitle$$ $$theexcerpt$$ $$thedate$$
To query all categories of the standard built in category 'category':
$$query$$ posts_per_page = 7 & categoryselection = {{ select = { taxs = 'category'} }} $$display$$ $$thetitle$$ $$theexcerpt$$ $$thedate$$
To query all categories of 'portfolio_entries' but exclude categories 'CSS'(ID = 4) and 'HTML' (ID = 5):
$$query$$ posts_per_page = 7 & categoryselection = {{ select = { taxs= 'portfolio_entries'} relation = and & select = { cats = css, 5 & operator = not in } }} $$display$$ $$thetitle$$ $$theexcerpt$$ $$thedate$$
To query the custom categories 'CSS'(ID = 4) and 'HTML' (ID = 5) and a built in category with category-slug 'Hockey' (ID = 16) with subcategories :
$$query$$ posts_per_page = 7 & categoryselection = {{ select = { cats = css, html, hockey} }} $$display$$ $$thetitle$$ $$theexcerpt$$ $$thedate$$
All the possible keywords and the appropriate possible values of WP to be used outside 'categoryselection' are clearly described in the WP documentation of WP-Query object under the section "Parameters".
You can try to define your own queries now. If you have any troubles, you can have a look at our homepage, where we will post more examples by the time or contact us in the forum and we will try to help you.
In this section you will find the chronology of the versions.
Version | Date | Comment |
---|---|---|
1.0.0.0. | 3.June 2011 | First release |