Forum Replies Created
-
AuthorPosts
-
Prabakaran Shankar
ParticipantIs that any other way to use the query in the relationship attribute?
set args is not working with relationships in my case.Prabakaran Shankar
ParticipantThank you for your effort to solve it.
but it is not helpful. Query is not functioning as expected (limit post - 5).
Thank you. Please close this ticket.Prabakaran Shankar
ParticipantHello,
Thank you very much.
I have used your code to display the connected jobs with the employer. But the result shows the recent jobs without any pagination.Each job is connected with the employer. So, Each employer had many jobs. My aim is to show the jobs (5 recent jobs only) by the employer.
Along with your code, I have used the standard relationship query, which shows the jobs related to the employer.
{% set args = { post_type: 'emp', posts_per_page: 5 } %} {% set employers = mb.get_posts( args ) %} {% for employer in employers %} <a href="{{ mb.get_the_permalink( employer.ID ) }}">{{ employer.post_title }}</a> {% set job_args = { post_type: 'job', relationship: {id: 69, to: employer.ID} } %} {% set jobs = mb.get_posts( job_args ) %} {% for job in jobs %} <a href="{{ mb.get_the_permalink( job.ID ) }}">{{ job.post_title }}</a><br> {% endfor %} {% endfor %} <hr> {% set relationship = attribute( relationships, '69' ) %} {% for post in relationship.to %} <a href="{{ post.url }}">{{ post.title }}</a><br> {% endfor %} <hr> {% set relationship = attribute( relationships, '69' ) %} {% for post in relationship.from %} <a href="{{ post.url }}">{{ post.title }}</a><br> {% endfor %}you can see the result on the below page
https://nviewscareer.com/emp/technical-university-of-denmark-dtu/https://1drv.ms/u/s!AjLgaRuebK87hfUKXWijXfv_5x5l0A?e=Xl4hhg
will query work with the relationship?
Prabakaran Shankar
ParticipantHello,
Thank you for your workout to show the connected jobs.
But, It shows only the recent post in the CPT job instead of the post related to the relationship.
I have used the following code.
{% set args = { post_type: 'job', posts_per_page: 5 } %} {% set jobs = mb.get_posts( args ) %} {% for job in jobs %} <a href="{{ mb.get_the_permalink( job.ID ) }}">{{ job.post_title }}<br></a> {% set emp_args = { post_type: 'emp', nopaging: true, relationship: {id: '69', from: job.ID} } %} {% set employers = mb.get_posts( emp_args ) %} {% for employer in employers %} <a href="{{ mb.get_the_permalink( emp.ID ) }}">{{ emp.post_title }}</a> {% endfor %} {% endfor %}CPT Plural:"Employers"; Singular:"Employer";URL:"emp";
CPT Plural:"Jobs"; Singular:"Job";URL:"job";
Relationship id: 69Refer to the image output
https://1drv.ms/u/s!AjW7znckfYbzg9J7VsHKVa64gaywXg?e=BakJ7Mhowever, if I use query following general code, it shows all the related post
{% set relationship = attribute( relationships, '69' ) %} {% for post in relationship.from %} <a href="{{ post.url }}">{{ post.title }}</a><br> {% endfor %}Refer to the image output
https://1drv.ms/u/s!AjW7znckfYbzg9J8ghM4PI4UJfQS2w?e=ktfDY7June 26, 2021 at 4:18 PM in reply to: ✅Meta value not stored in the custom table and postmeta, but displaying content #29135Prabakaran Shankar
ParticipantHi,
I have created a new table instead of debugging the old one.
The new table is working fine.
Please close this thicket.June 16, 2021 at 10:48 PM in reply to: ✅Meta value not stored in the custom table and postmeta, but displaying content #28950Prabakaran Shankar
ParticipantHello,
I have increased the max_input_vars, but still no data displayed in the table. However, the post displays all the data loaded in the custom fields.
June 16, 2021 at 10:13 PM in reply to: ✅Meta value not stored in the custom table and postmeta, but displaying content #28945Prabakaran Shankar
ParticipantHello,
The Values are stored and recovered, but it is not displayed in the DB table.
I will check the PHP info and get back soon.
Please bear be online, I am in need to complete the project soon. Thank you.June 16, 2021 at 4:10 PM in reply to: ✅Meta value not stored in the custom table and postmeta, but displaying content #28938Prabakaran Shankar
ParticipantHello,
For your kind notification, the custom field is not loading in the admin place. i get error notification like page unresponsive for this field group alone and the error code "Result code hung"
is this because of the too many (30+ custom fields)?June 16, 2021 at 4:00 PM in reply to: ✅Meta value not stored in the custom table and postmeta, but displaying content #28937Prabakaran Shankar
ParticipantHello,
I have custom fields from the meta box builder and point to the custom table.
Pastebin link for the custom fields https://pastebin.com/m8hA9zvQBased on the custom fields and using MB Views, I have created a post "https://nviewscareer.com/job/assistant-professor-in-political-science-aarhus-uni-denmark/", which is populated all the data. (post ID 237)
For your reference, I herewith enclose the DB table (custom table, postmeta for the post id 237)
https://1drv.ms/u/s!AjW7znckfYbzg9I6EiKyD-ReYHftxw?e=rgBZHN
https://1drv.ms/u/s!AjW7znckfYbzg9I7KKjArUAGol6HuQ?e=sTryG5
https://1drv.ms/u/s!AjW7znckfYbzg9I8v_vIU6bVCZVb0g?e=WG937FPrabakaran Shankar
ParticipantIn the single post page as well in the sidebar to show the category-based recent post.
Prabakaran Shankar
ParticipantHello,
from the contiunation.
I have used the below query to display CPT Post ID, post title and URL. It displays post ID as per query, but there is no post URL and POst title.{% set args = { post_type: 'job', posts_per_page: 10, tax_query: [ { taxonomy: 'category', field: 'slug', terms: 'ongoing' } ] } %} {% set posts = mb.get_posts( args ) %} {% for post in posts %} <li>{{ post.url }}, {{ post.ID }}, {{ post.title }}</li> {% endfor %}Results are:
<li> 230, , </li> <li> 225, , </li>Please help me with the mistake in the above code.
Prabakaran Shankar
ParticipantThank you for your input.
I have used the mb. proxy in the following way to use in the MB Views post template
'{% set post = mb.get_post( ) %}
{{ post.rank_math_focus_keyword }}'Please close this ticket.
Prabakaran Shankar
ParticipantHi,
Thank you for your suggestion.
It is working.
One more request!
Is that possible to use helper function or mb. proxy to get term list automatically to use in tax_query?
for example:{% set args = { post_type: 'book', posts_per_page: 10, tax_query: [ { taxonomy: 'book-kind', field: 'slug', terms: '{% for item in post.job_category_field %}{{ item.name }}{% endfor %}' } ] } %}or
{% set args = { post_type: 'book', posts_per_page: 10, tax_query: [ { taxonomy: 'book-kind', field: 'slug', terms: '{{ mb.get_the_term_list( post.ID, 'job-field' ) }}' } ] } %}Prabakaran Shankar
ParticipantHello,
without the tax_query, the code displays the recent post title. (if possible please share the term to be used to display post title with URL instead of {{post.post_title}})in case, if tax_query with the dynamic taxonomy terms like the below, it shows error!
'{% set args = { post_type: 'job', posts_per_page: 5, tax_query: [ { taxonomy: '[{{ mb.get_the_term_list( post.ID, 'job-fields', '', ', ' ) }}]'} ]} %}
{% set my_posts = mb.get_posts( args ) %}
{% for post in my_posts %}
{{ post.post_title }}<br>
{% endfor %}Please help me!
Prabakaran Shankar
ParticipantThank you very much for your suggestion.
According to the discussion in the two references, they were used in archive pages. If I am mistaken, please let me know.
Anyhow, I have tried the following code to display recent posts in the category.`<div class=box><p>Related posts</p>
{% set args = { post_type: 'job', posts_per_page: 2, tax_query: [ { taxonomy: 'field'} ] } %}
{% set job = mb.get_posts( args ) %}
{% for post in job %}
{{ post.post_title }}<br>
{% endfor %}
</div>
// CPT - Job; Custom taxonomy - Field;
I have used this code in post singular to display after the post content -
AuthorPosts