• Resolved steuss

    (@steuss)


    I have a pod called “Members.”

    In that pod are two fields “First_name” and “last_name”

    How do I set the pod/post title to “first_name”&” “&”last_name” ?

    *********************************

    I’d scoured the forums.

    https://www.ads-software.com/support/topic/custom-page-title-on-saving-post/

    https://pods.io/forums/topic/pods-field-into-post-title/

    They reference stuff that I have no idea about and don’t guide to anything specific.

    Repeated calls say use: pods_api_post_save_pod_item_{podname} Where do I do that? In what section?

    Then, how do I set the {@title} to my field values?

    I guess, where can i find information about filters, and then, where do you insert those filters, and then, what PHP function am I looking for to change the title?

    In writing this it seems there are a lot of questions that seem overwhelming and noobish. I am new to this. If possible can you point me in the right direction other than saying, “use this: pods_api_post_save_pod_item_{podname}” When I searched that i got https://pods.io/docs/code/action-reference/pods_api_post_save_pod_item_podname/, but it doesn’t say where to put that code.

    ********************************

    Most of the forum posts say, “hire a php developer.” What exactly would I ask them to do?

    • This topic was modified 5 years, 11 months ago by steuss.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Jim True

    (@jimtrue)

    If you’re not comfortable with PHP, you’re probably not going to be comfortable with the reference link I’m providing, but this is the exact code snippet to change the Post Title based on values in other fields:

    https://docs.pods.io/code-snippets/create-post-title-from-fields-in-the-post-using-pods_api_pre_save/

    This can’t be done with Magic Tags, because Magic Tags are for displaying your content on the front-end, not on the back-end admin, and definitely not in replacing the post-title of your post. The PHP provided will run before your post is saved and is designed to take content from fields in your post and overwrite the Post Title with that content. You will have to modify it for your post-type and your custom fields.

    If you don’t know where to put PHP code in your website, this link should also help in that area.

    https://docs.pods.io/faqs/where-should-i-put-code-for-use-by-pods/

    The reason we, or anyone states, ‘hire a PHP developer’ is, if you’re not comfortable working in PHP and don’t want to learn, then you’d need to hire someone to do that for you. If you’re going to be building WordPress websites, you’re going to have to become at least a little comfortable with PHP.

    The requirements you stated above are exactly what you would tell a PHP developer: I need code to update the post title of my Members posts based on First Name and Last Name. Any good developer should be able to handle that ??

    Thread Starter steuss

    (@steuss)

    First, I want to emphatically say, “Thank you!”

    This is an excellent post with specific details and guidance and help that goes beyond what I expected.

    I very much appreciate your detailed post with links. Thank you.

    I’m going to investigate, learn, and if needed pass it along to someone that can do it for me for $. Thank you!

    Thread Starter steuss

    (@steuss)

    I wanted to follow up. Again, thank you.

    I solved my issue with your wonderful guidance.

    Downloaded “Code Snippets.”

    Copied the code included in the first link provided.

    Pasted into a code snippet. Changed the

    pods_api_pre_save_pod_item_meal

    “Meal” to “member” and replaced sandwich and burger with the fields I wanted. Created a new record and WHAM! Success!

    Thanks again for your response and help!

    Plugin Contributor Jim True

    (@jimtrue)

    Congratulations! I’m glad we were able to help you out ??

    Thread Starter steuss

    (@steuss)

    Now… what if I want the title to be the title of a related post?

    I tried adapting the code to work for another pod called “tryout” which has a “member” related field.

    How do I set the post title of “tryout” to “member.post_title” ?

    I know I’m pushing, perhaps a point in the direction of a post about using the related field.

    $member.post_title doesn’t work, and I’m not sure why. If this is a PHP thing, can I get pointed in the right direction to learn this?

    Thread Starter steuss

    (@steuss)

    Plugin Contributor Jim True

    (@jimtrue)

    If you’re using Pods Templates, you’re better off using this video:

    Don’t do PHP unless you have to ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Set Pod post title from a field value’ is closed to new replies.