Okay last wordpress question for a while... I promise I would like to have the title show up inside the input box for my contact form. but since it is inside of the text area it displays the "?php the_title(); ?" instead of the actual title name. how can I make it understand that it should be reading the php code instead of displaying it as text? <textarea name="cuf_msg'.$n.'" id="cuf_msg'.$n.'" class="cuf_textarea" cols="50" rows="10">'.$cuf_msg.'I am interested in <?php the_title(); ?></textarea> Code (markup):
its easy. search for the plugin exec php (link below). This plugin allows you to enable your blog to read and execute php text on pages. hope thats what you are looking for.. http://wordpress.org/plugins/exec-php/
okay so that plugin is a little over two years old and has not had any updates, needless to say it did not complete the job. I am still looking for other options. Thanks for your post though.
oh am sorry about that.. last time when i tried out the plugin it did work for me getting the job done, thats why i recommended. Do you mind showing the link to the website so that I could take a look at the contact form and what exactly is required. If the Page Title for the contact form is showing some PHP code then there is some error, you might want to check either the page template file or the contact form / plugin or page (depends on how this was created on WP).
The problem is you are inside a php string and you are including another php start and end. Just change to this and let me know if it works. <textarea name="cuf_msg'.$n.'" id="cuf_msg'.$n.'" class="cuf_textarea" cols="50" rows="10">'.$cuf_msg.'I am interested in '.the_title().'</textarea> Code (markup):
Try: <textarea name="cuf_msg'.$n.'" id="cuf_msg'.$n.'" class="cuf_textarea" cols="50" rows="10">'.$cuf_msg.'I am interested in '.single_post_title().'</textarea> Code (markup): If this does not work you should try this: $postTitle = single_post_title(); <textarea name="cuf_msg'.$n.'" id="cuf_msg'.$n.'" class="cuf_textarea" cols="50" rows="10">'.$cuf_msg.'I am interested in '.$postTitle.'</textarea> Code (markup):
Okay the first one didn't work, but I am going to try the second one but where should I add the $postTitle = single_post_title(); Code (markup): Should I place it right above there or some where in the top of the page?
Just add it after this: $cuf_sender = (isset($_POST['cuf_sender'.$n])) ? $_POST['cuf_sender'.$n] : ''; $cuf_email = (isset($_POST['cuf_email'.$n])) ? $_POST['cuf_email'.$n] : ''; $cuf_msg = (isset($_POST['cuf_msg'.$n])) ? $_POST['cuf_msg'.$n] : ''; Code (markup): You can find it above the line where you are trying to insert the title.
Okay so I added the two lines of code. It displayed the title, but not in the input box. and also kept repeating itself. It displayed the title in the top of the entire contact form and repeated itself 2 or 3 times. Thanks for your continued help with this
I see, I have installed the plugin on one of my WP sites and finally found what to do: Change to this: $postTitle = get_the_title($post->post_parent); Code (markup): <textarea name="cuf_msg'.$n.'" id="cuf_msg'.$n.'" class="cuf_textarea" cols="50" rows="10">'.$cuf_msg.' I am interested in '.$postTitle.'</textarea> Code (markup): If you want to add this to the widget in sidebar you add the same lines inside: function showFormWidget( $params = '' ) { .... } Code (markup):