PODs Templates Not Displaying in DIVI Theme - wordpress

I have a Wordpress site that is using the DIVI Theme and PODs CMS to create and display custom Content Types. I cannot get any of the PODs data to display. A simple PODs Content Type I have created is setup like the following.
Label: Portal Phone
Name: portal_phone
Fields:
FieldName - DataType
related_user_id - Plain Number
name - String
phone_number - Phone
There are the standard audit and ID fields for the POD as well.
I am only trying to have the name-phone_number display in a bulleted list to just verify that the data can be displayed. Presently there is no filter on the CustomTemplate I have specified. Also of note I have tried the pluralized form of portal_phones and an error displays saying Pods embed error: Pod not found
Template
[pods name="portal_phone" shortcodes="1"]
[before]<ul>[/before]
[if portal_phone]
[each portal_phone]
<li>{#name}-{#phone_number}</li>
[/each]
[/if]
[after]</ul>[/after]
[/pods]

Pods embed error: Pod not found suggests the [pods name="PODNAME"] is not defined as PODS.
Try adding the name attribute correctly.

Related

How to get all pages from Ghost blog platform, using the get helper

I am trying to get all pages from ghost blog.
{{#get "posts" limit="all" filter="page:true"}}
Doesn't work.
If you are running on latest Ghost instance (or at least the version that has Content API ^2.10.0).
You can use limit=all attribute to fetch all page resouces like so:
{{#get "pages" limit="all"}}...{{/get}}
You can find more about the limit attribute in Ghost Docs for {{get}} helper and page resource here

How to display ACF taxonomy field?

I have an ACF taxonomy field which is pushed to Algolia.
In the Algolia dashboard I see that field and attributes.
rj_narucitelj:[
{
term_id: "1444"
name: "Industrijski park Nova Gradiška d.o.o."
etc.:
}
]
How to display rj_narucitelj.name attribute? The code below doesn't work
<span class="rj-narucitelj">{{{data.rj_narucitelj.name}}}</span>
On the other hand when i try to display author name on the same way it does work.
<span class="rj-author">{{{data.post_author.display_name}}}</span>
Also, every single field in that indice can display without problems.
I've tried editing the wordpress template, and made a standalone client, but I can't get it work either way.
What am I missing?

Filter by Bundle Drupal 8 Link Autocomplete

Does anyone know how to limit the autocomplete suggestions of Link Fields to only certain bundles -- not globally, but per Link Field instance? I nearly found a solution in customizing https://github.com/minnur/Alter-Entity-Autocomplete , but this is global for all autocompletes, and I need to get the calling Link Field instance somehow.
This is possible with hook form alter:
function hook_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
// if $form_id == 'xyz'
$form['field_mylink']['widget'][0]['uri']['#selection_handler']="default:node";
$form['field_mylink']['widget'][0]['uri']['#selection_settings']=[
'target_bundles'=>['article'=>'article', 'page'=>'page'], //etc
];
}
I have written the following Drupal contributed module to solve the issue:
Link Field Autocomplete Filter
The module adds a Link Field configuration for filtering the allowed
content types in the autocomplete field.
You can install the module manually with the drupal core Update Manager module (must be enabled) using the Drupal backend:
http://yourSite/admin/reports/updates/install
and follow the instructions there.
Using Drush, you can install it with:
drush dl link_field_autocomplete_filter; // download
drush en link_field_autocomplete_filter; // enable the module
You can also us Composer to download the module:
composer require drupal/link_field_autocomplete_filter
Simply enable the module, and a series of checkboxes (one for each content type) will appear in the Link Field field-instance configuration form. If you check none, then all content types will appear as suggestions in the autocomplete. Otherwise only those checked will appear.

Drupal 8 hook_update_n code example needed

We have an existing custom module for our Drupal 8 application that created a content type and a view. The "news" module is in our production environment running fine; many pieces of content have been created using it.
Now enhancements have been requested: 2 new fields and a change to the view. I have made the changes using the admin UI in our dev environment, but I will need to put these changes into the module's code for version control so that in new site instances, one need not remember to make UI changes after installing the module.
The fields:
field_show_on_page, Field Type: List (text)
field_news_dateline, Field Type: Date
View:
The change in the view is on what field the sorting is done.
It would be simple to export the fields and view configurations and add them to the module>config >install folder, but for the change to be picked up, that requires uninstalling and reinstalling the module, which can't be done without needing to delete news content, which is not acceptable.
I understand the changes can be done in hook_update_N in the news.install file. But I cannot find examples for this function that is close enough for this need. I understand the function should be written as:
news_update_8001() {} but what would go in the body to add the two fields and update the view?
Thank you.
If you have the new fields in your config you can just delete the old fields by adding this in your hook and then run drush updb before you import the config:
$field = \Drupal::entityTypeManager()->getStorage('field_config')->load('node.news.old_field');
if ($field) {
$field->delete();
}

Custom Pods.io detail page

I am attempting to create a custom template page for a details page for my Pods.io 'research_faculty' pod.
I have the url going currently to /people/details and it does go to that page but I created a 'details' page that I have assigned a custom template to display the information that I want. Problem I am having is that its treating the last part of the URL as a page and Wordpress is saying page cannot be found. So it would be /people/details/wally-kolcz. How can I use the past part of the URL as the way to pull the person's details and populate the template page rather than WordPress trying to use it as another page and defaulting to the single.php template?
Pod (Advanced Options)
Custom Rewrite Slug: people/details
You can use pods_v( 'last, 'url' ); to get the last segment of the url. If you put that in a variable you can use it to build your Pods object.
// get current item
$slug = pods_v( 'last', 'url' );
// get pods object for current item
$pods = pods( 'pod_name', $slug );
See this tutorial for more information: http://pods.io/tutorials/using-pods-pages-advanced-content-types/
Um create a pods page and on the Enter page URL section enter /people/details/* so that it responds to /people/details/+ anything. Also in the slug section u can try putting {#url,2} If it doesnt work. Also go to the advanced options of your advanced content type and in the detailed page URL enter pod_name/{#permalink} though that may not be necessary but try that and test it again.Make sure the pods page also has a pod to refer to and that it points at your php details template

Resources