I'm building a Wordpress site using Pods and Elementor. My posts have a Pod text field called 'year'. I'm trying to use the Where parameter in the Pods-List Items widget to filter the posts by 'year.' But I can't seem to get the syntax correct. year='2020' doesn't work and the same with many other attempts. Please help and thanks in advance.
Pods can be filtered by means of a shortcode. The list-items widget is just a tool that helps you easily make such a shortcode.
To add the year filter, you'd do something like this:
By shortcode directly
[pods name="my_pod_name"
where="year.meta_value = '2021'" template="template_name_if_using_one"]
In the Pods widget
In the "where" field, you'd just write:
year.meta_value = 'value_to_filter'
The important bit, and which people frequently forget, is adding the .meta_value to the the field name they're filtering on.
Related
I recently started using the Wordpress Pods plugin and I'm trying to insert a custom post field in the Pod.
It is not working. Is there any way to do this?
I have created a pod named "network-section"
This pods works:
[pods name="network-section" where="id = '4'"]
[/pods]
However, I want to use the {#network} field because I have a lot of posts with different network categories.
This is not working:
[pods name="network-section" where="id = {#network}"]
[/pods]
{#network}"] is a custom post field.
Thanks!
your shortcode won't work like that I'm afraid. The ID field is looking for an integer that corresponds to the unique ID of a certain post. That's why your first example works but second one doesn't.
If you want to have a sub-selection of network-section posts, you should find a different way to select them instead of using 'ID" ,(which, by definition, will pull at max only one post).
For instance, you could add a custom taxonomy and use that to filter by in the shortcode, or sooner other field.
The easiest solution might be too create a field in your Post called "network category" then door each of your posts you can give them a particular number.
That way, in your shortcode, you can do:
[pods name="network-section" where="network-category.meta_value = '2'"][/pods]
N.B. you will probably need to use that ".meta_value" to get the right bake in your shortcode, but it depends on how you sweet it up. AND you'll need also need to add your html and other code somewhere (can be in a Pods template or even between shortcode open and close tags) otherwise there will be nothing to display...
Good luck!
Elementor is great to link single ACF-field content.
But I need to combine some of them in the ACF Layout "group", so that it's easier for the customer to overview and edit the content.
But Elementor does not support ACF fields inside an ACF group – they simply don't show up in the Key-dropdown.
Is there a way to get that going?
According to document Elementor Integration With ACF on Elementor official website, complex custom field types such as group, repeater haven't been supported yet.
But there is a way to get value from ACF group field, see here(wordpress support thread). While I haven't tested it.
I know you may want to sort those fileds by categories or other taxonomies to get a better logic and cleaner interface. But this would also limit you to certain widget in 3rd party plugins. Built-in dynamic content is really handy, I don't think it's worthy to give it up by using ACF group field.
So I suggest you to use regular field types along with conditional logic(each of), it's a better choice at this moment though the interface would be messy.
I am customizing wordpress comments to add multiple custom fields. So i have added filters and actions to show fields, validate them, process them and finally show them in comments. I have written these and they are working fine.
However i only need them only for Post which belongs to specific category and comment is not a reply of any other comment.
I tried few things but nothing seems to work. Can somebody provide me a working solution.
Just to start, I think you could put conditions inside filters and not filters inside conditions. That said, for posts in category and category archives you can use the 'conditional tags' is category (for archive) and in_category (for posts):
https://codex.wordpress.org/Function_Reference/is_category
https://codex.wordpress.org/Function_Reference/in_category
I have a page that has a single category applied to it, for this example, "Self Help Books".
I want to put a place on content type that display a "view all [insert category here]" that links to that category listing page. I was hoping I could do something like:
<a href=%taxonomyLink:books--self-help-books%>view all%taxonomy:books%</a>
and it would pull in the category for anything using that content type. I'm using the panels modules so I had planned on placing this in a panel the content type was using. Is any of this possible?
I thought about creating a block and placing that in a panel in the panels module.
(also, if you can't tell, I'm pretty fresh to Drupal.)
you can use simple drupal api function to achieve that.
first you will need to load needed taxonomy term (lets say that 123 is taxonomy term ID)
then build the link
here is the code:
$term = taxonomy_term_load(123);
$link = l($term->name, 'taxonomy/term/' . $term->tid);
you can also find more about l() here https://api.drupal.org/api/drupal/includes%21common.inc/function/l/7
This Drupal docs page lists several modules that assist in displaying related content, via a few different methods.
As of now, the most stable 7.x compatible terms-based module appears to be Similar by Terms.
There are ways to achieve this without installing an additional module, but this will satisfy your requirements as-is.
You don't need to write code for this. If you using panels .. Find a way to put a right relationship in context for needed taxonomy term, after that you will have all the needed tokens (%placeholders) to build your content.
I have a wordpress page and I've used the plugin api to allow categories for pages. I want to get the child pages, but I want to filter which ones I get by category. I was using the get_page_children_as_html() function, but that wont let me filter my results.
Is there a simple way I can do this?
The plugin API probably created its own functions to handle the categories, therefore there wouldn't be anything to help you filter a plugins function, you'd have to get in contact with the plugin developers and see if that is possible.