WordPress.org

Forums

page title, excerpt and read more link on homepage (3 posts)

  1. michaeloc
    Member
    Posted 3 years ago #

    Would appreciate if anyone could point me to a tutorial that shows how to show a page title, excerpt and read more link on a home page.

    I want to create a page template so will code the functionality directly into that page and style with css

    What I am having an issue with is finding a clear set of instructions on how to go about it. My knowledge of the codex is pretty average and php not great, but I have a pretty decent grasp of how to put things together.

  2. michaeloc
    Member
    Posted 3 years ago #

    Would appreciate if anyone could point me to a tutorial that shows how to show a page title, excerpt and read more link on a home page.

    I want to create a page template so will code the functionality directly into that page and style with css

    What I am having an issue with is finding a clear set of instructions on how to go about it. My knowledge of the codex is pretty average and php not great, but I have a pretty decent grasp of how to put things together.

  3. michaeloc
    Member
    Posted 3 years ago #

    link to test site

    I have managed to put together this code, can anyone advise how to add html tags to the title and excerpt so that I can style them individually.

    <?php
    $page_id = 5;
    $page_data = get_page( $page_id );
    $content = $page_data->post_content;
    $title = $page_data->post_title;
    echo $page_data->post_title;
    echo $page_data->post_excerpt;
    ?>
    
    <a href="<?php echo get_permalink( 5 ); ?>">page link</a>

Topic Closed

This topic has been closed to new replies.

About this Topic