Jump to content

Archived

This topic is now archived and is closed to further replies.

opwolken

Using post-title outside 'wp-content'

Recommended Posts

opwolken

Hi,

 

I'm wondering if anyone has coded this before or knows how to help me out.

 

I would like to have the post-title (of a blog of page) in a textbox elsewhere on the page. I'm trying to figure out the right code to get it done...

 

Do any of you have experience with this? 

Share this post


Link to post
Share on other sites
Danny

Hi,

 

You will not be able to use a TextBox or any Content related section to display your Post Title. The reason for this is that the Post template is universal for all posts. Therefore, if you enter the following into a TextBox:

 

Welcome to my first post, on my awesome blog.

That title will be displayed on all posts. Therefore, the only alternative is to use the NextBox section and use the following code:

 

single_post_title( '<h1>','</h1> ' );

 

This will dynamically call your post title and have it wrapped in h1 tags.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
opwolken

Like this:  <?php single_post_title( '<h1>','</h1>'); ?>

 

Cause thats not the fix for me, what am I doing wrong :(

 

Edit: I just read that you said Nextbox. Is this not possible with the original textbox?

Share this post


Link to post
Share on other sites
opwolken

I installed a free plugin that allowed me to use PHP in the TextBox. I wasn't aware that PHP wouldn't work in the TextBox

Job done

Share this post


Link to post
Share on other sites
Danny

Yeah, the TextBox section is for text and basic HTML only. No section in DMS out of the box will allow you to input PHP code, as it is not secure and will most definitely cause errors.

Therefore, to add PHP to your site you either need a plugin, use a hook, use the NextBox section or use the Hooker plugin.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

×