cncup
Forum Replies Created
-
Ok I got it working this way:
t.ID != IF ('{@get.post}' = '', 0, CAST('{@get.post}' AS UNSIGNED))There could be a more elegant way to do it, but it’s working.
Sorry to brink this back. Earlier I checked only on Edit of an existing post and it worked. But on Add New the magic tag {@get.post} returns nothing, and this yields an error in the ‘Customized WHERE’ field query.
You have an error in your SQL syntax; … t.ID !=
How to avoid it?
This is it. Many thanks!
Anyone?
Trying again, hopefully more clear.
A CPT with a relationship field to itself.
When editing a post, all posts of this CPT appear in this field’s list as available to create a relationship to, including this very post that is being edited.
How to prevent the post from creating a relationship to itself? ie. how to exclude it from the field’s list of available options?
Well, before a post (card) is first saved, naturally it has no ID and therefor can’t appear as an available relationship in its own ‘related_cards’ field. But after it is saved, when returning to edit the post, then it appears in its own list and that is what I’m trying to avoid.
The way I asked the question (attempting to get the current post ID) may not be the way to go because of this very reason that a post has no ID before it is created. But how else to exclude the post being edited from the relationship list?
Oh, very good to know. Appreciated!
Thanks for the quick reply, Paul. This is perfect.
I needed it in php actually, so just for future reference if someone finds it helpful, it looks like this:
$pod = pods( 'my_cpt_name', get_the_ID() );
$alt_text = $pod->field( 'image_1._wp_attachment_image_alt' );Many thanks!
If I need the alt-text separately, forget src, forget the tag, just the alt-text. Is there something like this:
field='image_1._alt'In php I could also use:
$alt_text = get_post_meta($image_id , '_wp_attachment_image_alt', true);But I’d still need the help of Pods to know the value of $image_id.
Is there something like this:
field='image_1._id'The question is, can Pods in any way spare me from having to query the database in order to get the alt-text?
Pods template / CPT is not included in the score as said above.
In addition, Pods fields are not recognized when adding custom field tags to meta description / title, both for a single post in the editor and for all posts via menu Search Appearance > Content Types.
In addition, in Dashboard Overview when selecting the Pods CPT in the combo box, it always shows 0 posts.
So AIOSEO is aware that a Pods CPT exists, but other than that appears to be all-around blind to the data in that CPT.
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] Disable pagination in pod templateUnderstood about the theme loop. This is all challenging my technical level but I will look into posts_nav_link();
Turns out what I wanted to achieve was not as simple as I thought, and I had misguided expectations of Pods. My apologies for the long thread. I appreciate your patience guys. Thank you.
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] Disable pagination in pod templateI see. I think…
I want the regular blog post to have pagination but the pod post to not have pagination. Is there any way to accomplish that?
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] Disable pagination in pod templateMaybe the question I need to ask is where. Where do I set pagination for an auto template? Is the shortcode not supposed to be inside the template?
- This reply was modified 3 years, 5 months ago by cncup.
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] Disable pagination in pod templateI’m familiar with magic tags. I’m not trying to output a field. I have a pod with auto template, I’m trying to disable pagination for that pod/template. It’s in the thread’s headline and everything is explained in the first post.
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] Disable pagination in pod templateBut then how? When I remove the template attribute I get
Pods embed error: Please provide either a template or field nameAn example would be appreciated.
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] Disable pagination in pod templateThat’s a generality which doesn’t answer the specific question. I’ll rephrase. What does a shortcode with a template attribute do? Does it load the template? Or does it instruct the template to do something? I hope you see where my confusion is.
I’ll be more specific. Pods complains when a shortcode contains neither field nor template attribute. field attribute is not needed for a pagination instruction, so I have to use the template attribute. But the shortcode runs inside that same template because where else would I put it. So the result is template inside template.
The following is the code inside template my_template :
<div class="my-template"> blah blah<br> [pods name="my_pod" template="my_template" pagination="false"] </div>Is the shortcode in the right place?
Is the syntax correct?
Could someone be so kind as to provide an example? I’m in the dark here.- This reply was modified 3 years, 5 months ago by cncup.