Skip Navigation

[Gelöst] custom title for post , part 2

This support ticket is created vor 5 Jahre, 3 Monate. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 Antworten, has 2 Stimmen.

Last updated by Akhil vor 5 Jahre, 3 Monate.

Assisted by: Waqar.

Author
Artikel
#1185641

hi. sometime ago norman gave me workaround:https://toolset.com/forums/topic/custom-post-title-from-5-different-custom-fields/
to auto rename the post title. its working well.
now i need simple php codes to detect the value.

to cut short i have this..
....
$field_1 = $postarr['wpcf'][project-name']; //select field

if(!isset($field_1) and $field_1 == 'Major') //value 1
$title .= 'Major Project';

if(!isset($field_1) and $field_1 == 'Minor') //value 2
$title .= 'Minor Project';

if(!isset($field_1) and $field_1 == ' ') //value 3
$title .= 'No Project';

am i doing something wrong here ?

#1185689

if(isset($field_1) and $field_1 == 'Major')
{$title .= ' ***[Major Project] ';}
if(isset($field_1) and $field_1 == 'Minor')
{$title .= ' [Minor Project] ';}
if(isset($field_1) and $field_1 != 'Major' and $field_1 != 'Minor')
{$title .= ' No Project ';}

i manage to solve this halfway. wonder if this is acceptable or better way of doing it ? thanks

#1185706

Waqar
Supporter

Languages: Englisch (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Dee,

Your updated code looks good and you can further shorten it up as:


if(isset($field_1) and $field_1 == 'Major')
{$title .= '***[Major Project]';}
elseif(isset($field_1) and $field_1 == 'Minor')
{$title .= '[Minor Project]';}
else
{$title .= 'No Project';}

regards,
Waqar

#1185722

yes, thats good thanks waqar.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.