Forums

[resolved] post title inside the_content() (11 posts)

  1. lhoylhoy
    Member
    Posted 2 years ago #

    Could anyone please tell me how to position my post title inside the_content()? <DIV>ing the_title() and the_content() and position it in CSS doesn't work. I had this idea of just manually type the title inside the text area and just LINK it to the post. Seems working before the linking but disappeared after. Please help!

  2. lhoylhoy
    Member
    Posted 2 years ago #

    please somebody answer my questions its important to me!

  3. lhoylhoy
    Member
    Posted 2 years ago #

    i love talking to myself as always hehe

  4. t31os
    Member
    Posted 2 years ago #

    Your question makes no sense to me, and it perhaps not for others either.

    the_title(); and the_content(); are 2 functions that are both used seperately inside the loop...

    If you could explain in more detail what you want to archieve.

    <div class="somedivclass">
    <?php the_title(); ?>
    <br />
    <?php the_content();?>
    </div>

    Would most certainly work no problem.... (as an example)...

  5. lhoylhoy
    Member
    Posted 2 years ago #

    hi t31os, im sorry i didnt make myself clear. what i really wanna do is put the_title() (content of the_title()) inside the_content()(consisting of images and captions). I want the_title() inline with the caption and if possible its permalink. e.g

    *************** Post#1
    * * Some Description here
    * image here * also here
    * * also here
    ***************

    i cant achieve that using just <DIV>ing the the_title() and the_content() right? doing so will just put result to this

    Post#1
    ***************
    * * Some description here
    * * also here
    * * also here
    ***************

    u said also that the_title() and the_content() are two different things, i agree, thats why im having trouble positioning them they cant be mixed up. what am i gonna do? I hope you could help me with this thanks.

  6. lhoylhoy
    Member
    Posted 2 years ago #

    damn! my illustration sucks! asterisks there are formed as box containing image.please just figure it out thanks so much!

  7. jbbrwcky
    Member
    Posted 2 years ago #

    If you control the blog, why not just write the title of the post inside the content box?

  8. lhoylhoy
    Member
    Posted 2 years ago #

    hi jbbwcky! thanks for the reply men but its not that simple. i really wanna take advantage of the dynamic navigation feats of wordpress i want my "the_title()" displayed automatically as i post. its not just displaying the title.

  9. theNetImp
    Member
    Posted 2 years ago #

    You need to create a plugin to accomplish this.

    something like

    <?php
        add_filter('the_content', 'myplugin_add_title');
    
        function myplugin_add_title($content='')
        {
            $theTitle = '<div>' . get_the_title() . '</div>';
    
            return $theTitle . $content;
        }
    
    ?>

    What this does is when "the_content" is called the filter runs this function. The function creates a variable that stores the title of the post surrounded by divs. Then when the function returns. It returns the title before the content.

    Good luck.

  10. theNetImp
    Member
    Posted 2 years ago #

    On a 2nd note, I see this is in the Themes section. Have you tried just called "get_the_title()" from within the template?

    Edit: not sure if this will really work...

  11. lhoylhoy
    Member
    Posted 2 years ago #

    hi theNETImp

    thanks for the reply! i appreciate it. Im just not into plugins yet. anyway priorities have changed a bit. i'm reading this ebook and im getting close to that topic. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic