At the moment I'm calling taxonomy term data using URL's like this -
http://scd.blaze.wpengine.com/wp-json/posts?type=listings&filter[listing_area]=northwest
Is there a way I can call two taxonomy terms at the same time, something like this? -
http://scd.blaze.wpengine.com/wp-json/posts?type=listings&filter[listing_area]=northwest&filter[listing_area]=northeast
I've read through all documentation but I'm struggling to find a solution, andy help would be much appreciated, thanks in advance!
Without knowing the full code in place its hard to be 100% but try...
http://scd.blaze.wpengine.com/wp-json/posts?type=listings&filter[listing_area][]=northwest&filter[listing_area][]=northeast
By adding [ ] to the end of each reference to listing_area you are now passing through an array of values. Otherwise you just pass through the last value in the query string.
Related
Then I would like to get the smallest child Category of a post that belongs lots of categories (via the datalayer pageCategory used plugin called GTM4WP by Duracell Tomi).
How can I do that?
I had already known to get the biggest category: pageCategory.1
Already tried pageCategory.10 or pageCategory.length-1 but didn't work. I'm not really familiar with Javascript. Please guide me
You need to use the length of the array, but with a different syntax:
pageCategory[pageCategory.length-1]
I'm just a little desperate.
I installed the RSS Display extension.
http://typo3.org/extensions/repository/view/rss_display
Everything works fine, but I have just a little understanding problem.
I pull myself with fluid the Author for the current feed.
<feed:item.get value="author"/>
Than i look whats inside.
<f:debug><feed:item.get value="author"/></f:debug>
Thats the result.
SimplePie_Author prototype object
name => 'Name Name' (12 chars)
link => NULL
email => NULL
So what i need it's to get the name of the author.
Unfortunately i am not able to get the value.
I am really new in Fluid, Typo3.
Hopefully someone can help me.
One way to do this, is to create a fluid variable author and assign the author object to it. Then you can access the name using {author.name}.
To create a variable, you could use the ViewHelper <f:alias>, like this:
<f:alias map="{author: '{feed:item.get(value: \'author\')}'}">
{author.name}
</f:alias>
Another way would be to use the extension "vhs", which provides many tools for use with fluid. One of these tools is the ViewHelper <v:variable.set>, which could be used like this:
<v:variable.set name="author" value="{feed:item.get(value: 'author\'}"/>
{author.name}
This has the advantage that you don't need to use the variable within the tags of the ViewHelper.
There are other ways to reach the same goal, without defining variables, but this seems to be the easiest one to me.
I have a page template which displays a list of post summaries, depending on a user-defined custom query, which is supplied using the post_content, for example:
category_name=blog
This is then passed to WP_Query() which will return however many 'blog' posts there are.
However, if I pass a completely invalid query (or simply make a mistake) such as:
the rain in spain falls mainly on the plain
WP_Query->get_posts() will return ALL posts in the database, rather than letting me know that the query is meaningless / erroneous.
Is there a built-in method to test for invalid queries?
Currently, I'm doing a parse_str() to convert the query to an array, then an array_intersect_keys() against a list of valid query parameters I've compiled from the WP_Query page.
It works, but feels pretty hacky - am I missing something?
Thanks,
Dave
I don't believe there is a failed query catch built in to WP like you are asking for (I wish there were, too).
However, there may be a cleaner hack. wp_count_posts will return a count of all posts in the database. And wp_query will return a count of its results in $post_count. One thing you could do is a check on your query - if the result of wp_count_posts is equal to $post_count then you know something is wrong.
It's not as clean as a 'no results' response, but perhaps more straight forward than your current solution.
http://codex.wordpress.org/Function_Reference/wp_count_posts
http://codex.wordpress.org/Class_Reference/WP_Query (search the page for $post_count)
I'm trying to do something, on wordpress which i'm not sure is possible.
So basically, I'm using Magic fields for two things. I've created a panel called "Member", and another one called "Member actuality". I've created two categories, member and member actuality which I've binded too magic fields post.
When I go on category (site.com/category/member) member I have the list of all my members.
When I click on one of my members (site.com/memberName) I have the description of the member. So for the moment everything is ok.
Now what I want to do is find a way too display actuality of one member. Maybe something like : (site.com/actuality/member) But I have no clue on how to do that. So if someone can help me.
I'm not sure i've explained it right, so please if you didn't understand ask me to reformulate.
Thanks for your future help
I found a way to do go throu this.
I've first created a new tag when a post was added, and that allowed me to use the tag directory which i didn't used before !
!
I have a Drupal 7 website that is running apachesolr search and is using faceting through the facetapi module.
When I use the facets to narrow my searches, everything works perfectly and I can see the filters being added to the search URL, so I can copy them as links (ready-made narrowed searches) elsewhere on the site.
Here is an example of how the apachesolr URL looks after I select several facets/filters:
search_url/search_keyword?f[0]=im_field_tag_term1%3A1&f[1]=im_field_tag_term2%3A100
Where the 'search_keyword' portion is the text I'm searching for and the '%3A' is just the url encoded ':' (colon).
Knowing this format, I can create any number of ready-made searches by creating the correct format for the URL. Perfect!
However, these filters are always ANDed, the same way they are when using the facet interface. Does anyone know if there is a syntax I can use, specifically in the search URL, to OR my filters/facets? Meaning, to make it such that the result is all entries that contains EITHER of the two filters?
Thanks in advance for any help or pointers in the right direction!
New edit:
I do know how to OR terms within the same vocabulary through the URL, I'm just wondering how to do it for terms in different vocabularies. ;-)
You can write a filter query that looks like:
fq=field1:value1 OR field2:value2
Alternatively you can use localparams to specify the query operator:
fq={!q.op=OR}field1:value1 field2:value2
As far as I know, there's not any easier way to do this. There is, in fact, an rather old bug asking for a way to OR the fq parameters...
I finally found a way to do this in Drupal
Enable the fq parameter setting.
Go to admin/config/search/apachesolr/[your_search_page]/core_search/edit or just navigate to the settings of the search page you're trying to modify
Check the 'Allow user input using the URL' setting
URL Syntax
Add the following at the end of the URL: ?fq=tid:(16 OR 38), where 16 and 38 are the term ids