Novice question - capitalise function return |
Novice question - capitalise function return |
will.birch |
Apr 28 2020, 03:44 PM
Post
#1
|
Group: Members Posts: 2 Joined: 28-April 20 Member No.: 27,305 |
Hi guys/gals
Really novice to this but trying my best. All I want to do is capitalise the return of the function to then be replaced in the wordpress shortcode. What am I missing here! CODE // Page Title Shortcode - page_title function page_title_sc( ){ return get_the_title(); } $titleupper = strtoupper('page_title_sc'); add_shortcode( 'page_title', $titleupper ); |
CharlesEF |
Apr 28 2020, 04:15 PM
Post
#2
|
Programming Fanatic Group: Members Posts: 1,981 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
You are passing a string instead of the function name, like this:
CODE $titleupper = strtoupper(page_title_sc()); |
Christian J |
Apr 28 2020, 04:20 PM
Post
#3
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
Hi!
Alas I'm not familiar with Wordpress, also I don't know from where you get the string(s) to capitalize from in the first place. return get_the_title(); Where is the above function defined? QUOTE add_shortcode( 'page_title', $titleupper ); I suppose the above calls a WP function, but I don't know what arguments that function expects. |
will.birch |
Apr 28 2020, 04:27 PM
Post
#4
|
Group: Members Posts: 2 Joined: 28-April 20 Member No.: 27,305 |
They are Wordpress values I believe
Thank you for your help Charles seems to have sorted it |
Lo-Fi Version | Time is now: 23rd April 2024 - 01:53 AM |