Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Sidebars & Widgets (http://forum.bytesforall.com/forumdisplay.php?f=14)
-   -   [SOLVED] Display Page-Title in Sidebar (http://forum.bytesforall.com/showthread.php?t=9178)

semperfidelis Aug 25, 2010 05:23 PM

[SOLVED] Display Page-Title in Sidebar
 
Hello!

First of all: I'm sorry for my poor English. Furthermore: neither HTML, CSS or PHP are my friends.
I'm using Atahualpa 3.5.3 on a wordpress 3 installation, and that theme is simply great.

my question:
Would it, somehow, be possible to display the page title of the current page within a widget in a sidebar? I dont care if the page title would remain on the top of the page, as usual, too, but I would like to display the current page title in a sidebar, next to the content.

My primitive understanding suggests me to somehow "get" the current page's title, using PHP? Would it be possible to do that in a standard text-widget, using HTML? Are there any plugins available that would do the job? I've tried finding one, but didnt have much success.

I'm sorry if I have posted this thread in a wrong section.

Thanks for any kind of answer or idea!

Cheers
Tom

lmilesw Aug 25, 2010 07:40 PM

You could put this code in a php friendly text widget.
HTML Code:

<?php bloginfo('name'); ?>

semperfidelis Aug 25, 2010 09:40 PM

Thanks a lot.

But that returns the blog name, and not the name or title of the currently displayed page or post.

Code:

        <!-- Post Headline -->                   
        <div class="post-headline">   
        <h1><?php
if (!is_single() and !is_page()) { ?>
            <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php
    if (function_exists('the_title_attribute')) {
        the_title_attribute();
    } elseif (function_exists('the_title')) {
        the_title();
    } ?>"><?php
}
the_title();
if (!is_single() and !is_page()) { ?>
            </a><?php
} ?>
        </h1>
        </div>

is what helped me for now.

lmilesw Aug 25, 2010 09:42 PM

Sorry about that. I read your question too quickly.


All times are GMT -6. The time now is 11:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.