Can I use a function to return HTML and the result of another function?


I have a very simple function to create a shortcode to get the name of my page. I was using this shortcode in a form, but WordPress changed the Shortcode API and that no longer works. So I was wondering if I could use a second function to make a shortcode that would put in the HTML plus the result of the first shortcode?

This is what I have at the moment…

function my_title( ){
    return get_the_title();
add_shortcode( 'page_title', 'my_title' );

and then in the page I have this html…

<input type=hidden name=itemname value='[page_title] small print'>    

Can I make a new function that will have the input field plus the page title as a shortcode so I can replace the whole input field with a shortcode? Apologies is this sounds odd, I’m a total newbie at this!

, Den 11 months 0 Answers 72 views 0

Leave an answer