• I want my client to be able to post text to the sidebar on the homepage only. Ideally, it would be great to have them be able to add a readmore tag and only show intro text on the homepage.

    I know i personally would be able to fake this with the text widget. But there’s no editor in the widget, so the client would not be able to format the text or add links without learning html.

    I tried the category post widget, thinking the client could format a post in a category and display it with the widget, but the formatting is stripped out.

    Can anyone help?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Henry

    (@henrywright-1)

    One approach would be to display a snippet of text from a page using the get_page function. http://codex.wordpress.org/Function_Reference/get_page

    Example:

    <?php $page_id = 7;
    
    $page_data = get_page( $page_id ); 
    
    echo '<h2>'. $page_data->post_title .'</h2>';
    
    echo apply_filters('the_excerpt', $page_data->post_excerpt); ?>

    You could then link to the page using simple HTML.

    <a href="http://example.com/page-url" title="Read more">Read more</a>

    Thread Starter mcdesign

    (@mcdesign)

    Where would that snippet go? And how would it work on the homepage only?

    Henry

    (@henrywright-1)

    Assuming that you have set your homepage to ‘a list of posts’ in WordPress Admin then put the snippet in your theme’s home.php file. This is the template for your homepage.

    Note: Be sure to change the page_id in my example to the actual page you will be using.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display post on homepage sidebar’ is closed to new replies.